rack-request_replication 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/README.md +13 -0
- data/Rakefile +9 -0
- data/lib/rack/request_replication/forwarder.rb +30 -1
- data/lib/rack/request_replication/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c2ae20074f71f838b2681b3186bff902f2a723
|
4
|
+
data.tar.gz: c67d60f387164527a0643d567fd2d45f46c53ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 617b9a447d31502449cb7f993f8c35bb2a9f13e3da7f7efff7d534de3d4863e675826d9063f36ca933c3575bac2a27e74db91926f0e5978b22222c55ce37fbd5
|
7
|
+
data.tar.gz: 80d11e84db0a526d7eec6d6b16cf33f9fe3845454437252b8c197f258770450e74c2492e51efb84b4f1dd5d5632bc6abdf141bb8355a032921265a14d31dddb8
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Rack::RequestReplication - Replicate Rack app HTTP requests
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/Springest/rack-request_replication.svg?branch=master)](https://travis-ci.org/Springest/rack-request_replication)
|
4
|
+
|
3
5
|
Replicate requests from one app instance to another. At
|
4
6
|
[Springest](http://www.springest.com) we used
|
5
7
|
[Gor](https://github.com/buger/gor) once to test our new Postgres stack
|
@@ -102,6 +104,17 @@ class TestApp < Sinatra::Base
|
|
102
104
|
end
|
103
105
|
```
|
104
106
|
|
107
|
+
## Supported Ruby Versions
|
108
|
+
|
109
|
+
We currently support the following Ruby versions:
|
110
|
+
|
111
|
+
- 1.9.3
|
112
|
+
- 2.1.6
|
113
|
+
- 2.2.2
|
114
|
+
- jruby (latest)
|
115
|
+
|
116
|
+
Please note that Rubinious is currently not supported.
|
117
|
+
|
105
118
|
## Contributing
|
106
119
|
|
107
120
|
1. Fork it ( https://github.com/[my-github-username]/rack-request_replication/fork )
|
data/Rakefile
CHANGED
@@ -8,6 +8,7 @@ require 'active_support/core_ext/hash/conversions'
|
|
8
8
|
module Rack
|
9
9
|
module RequestReplication
|
10
10
|
DEFAULT_PORTS = { 'http' => 80, 'https' => 443, 'coffee' => 80 }
|
11
|
+
VALID_REQUEST_METHODS = %w(head get post put patch propfind delete options trace)
|
11
12
|
|
12
13
|
##
|
13
14
|
# This class implements forwarding of requests
|
@@ -67,6 +68,8 @@ module Rack
|
|
67
68
|
opts = replicate_options_and_data(request)
|
68
69
|
uri = forward_uri(request)
|
69
70
|
|
71
|
+
return unless VALID_REQUEST_METHODS.include?(opts[:request_method].downcase)
|
72
|
+
|
70
73
|
http = Net::HTTP.new(uri.host, uri.port)
|
71
74
|
http.use_ssl = options[:use_ssl]
|
72
75
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless options[:verify_ssl]
|
@@ -285,12 +288,38 @@ module Rack
|
|
285
288
|
#
|
286
289
|
# @param [URI] uri
|
287
290
|
# @param [Hash{Symbol => Object}] opts ({})
|
288
|
-
# @returns [Net:HTTP::
|
291
|
+
# @returns [Net:HTTP::Propfind]
|
289
292
|
#
|
290
293
|
def create_propfind_request(uri, opts = {})
|
291
294
|
Net::HTTP::Propfind.new(uri.request_uri)
|
292
295
|
end
|
293
296
|
|
297
|
+
##
|
298
|
+
# Prepare a TRACE request to the forward app.
|
299
|
+
#
|
300
|
+
# The passed in options hash is ignored.
|
301
|
+
#
|
302
|
+
# @param [URI] uri
|
303
|
+
# @param [Hash{Symbol => Object}] opts ({})
|
304
|
+
# @returns [Net:HTTP::Trace]
|
305
|
+
#
|
306
|
+
def create_trace_request(uri, opts = {})
|
307
|
+
Net::HTTP::Trace.new(uri.request_uri)
|
308
|
+
end
|
309
|
+
|
310
|
+
##
|
311
|
+
# Prepare a HEAD request to the forward app.
|
312
|
+
#
|
313
|
+
# The passed in options hash is ignored.
|
314
|
+
#
|
315
|
+
# @param [URI] uri
|
316
|
+
# @param [Hash{Symbol => Object}] opts ({})
|
317
|
+
# @returns [Net:HTTP::Head]
|
318
|
+
#
|
319
|
+
def create_head_request(uri, opts = {})
|
320
|
+
Net::HTTP::Head.new(uri.request_uri)
|
321
|
+
end
|
322
|
+
|
294
323
|
##
|
295
324
|
# Replicates all the options and data that was in
|
296
325
|
# the original request and puts them in a Hash.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-request_replication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter de Vos
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -160,6 +160,7 @@ extensions: []
|
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
162
|
- ".gitignore"
|
163
|
+
- ".travis.yml"
|
163
164
|
- Gemfile
|
164
165
|
- LICENSE.txt
|
165
166
|
- README.md
|