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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b5f3b3d0ce122bb0437c305d39b81065462a923
4
- data.tar.gz: f07ac10950d3c79c3a7b7d56324bb63ad3c18a81
3
+ metadata.gz: e4c2ae20074f71f838b2681b3186bff902f2a723
4
+ data.tar.gz: c67d60f387164527a0643d567fd2d45f46c53ec0
5
5
  SHA512:
6
- metadata.gz: e50bf526bc98629172483e2ed48206ea362aacf55f59f1f2396f09c33db182bca44ee638c72b473d5f4b82d39fa013bf64343560b2b5e046dcf6aaa9df22a63a
7
- data.tar.gz: 57a3c7b969f9b569fd39123cd37256cf0c5f8fe58cf6e5eb084b689770a70fd1738eecf5dd6bbfa848c8a41ebe9d0d0675ae9671fdf4065909b762148cc0d933
6
+ metadata.gz: 617b9a447d31502449cb7f993f8c35bb2a9f13e3da7f7efff7d534de3d4863e675826d9063f36ca933c3575bac2a27e74db91926f0e5978b22222c55ce37fbd5
7
+ data.tar.gz: 80d11e84db0a526d7eec6d6b16cf33f9fe3845454437252b8c197f258770450e74c2492e51efb84b4f1dd5d5632bc6abdf141bb8355a032921265a14d31dddb8
@@ -0,0 +1,7 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - "1.9.3"
5
+ - "2.1.6"
6
+ - "2.2.2"
7
+ - jruby
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
@@ -1,2 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
9
+ rescue LoadError
10
+ # no rspec available
11
+ end
@@ -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::Options]
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.
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module RequestReplication
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
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.5
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-07-23 00:00:00.000000000 Z
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