request-replay 0.7.0 → 0.7.1

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: 0335c8c8c412eae553868c108b0d157521c76b0b
4
- data.tar.gz: 393e2da293913de62fff4960b5e6fb12b70f6593
3
+ metadata.gz: 481cb39dcc322bbf56565497c32253602ac569f8
4
+ data.tar.gz: cf769c68314c369afe197eed38e2d624c010701b
5
5
  SHA512:
6
- metadata.gz: 854270e4079d0737727d53e88f9ceabb836f16ecbbb6cbd7fde7a4400625ea999451c6931d7d1e406216f14cf83bb75cea257110d25657b861c0d4c3e5a03ada
7
- data.tar.gz: dc452c780b57c25e28d763acccc48f3e0efa8d71472a772174bdac7ebd525e7af65f303b6d82e230037ef452cdb31585dd9148b7f7c088ec69869c84f4526cce
6
+ metadata.gz: e4800dd8b5e6a374b8f040302b402d38bb0e51e0f31d79238200bdb45adccc3f43aaecb3820035ff05544d97b2a1ac88326e8bff5a87f57eea18a29172bf5032
7
+ data.tar.gz: f3b2a8b62282e76ee189310020f2fe0cfe716fc0ec14bfef34390a9cfe4e4520459e6c6517432770b2ec2b0b6392a923bf759f3da64f4804da1b279eadcb6da0
data/CHANGES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGES
2
2
 
3
+ ## request-replay 0.7.1 -- 2014-03-30
4
+
5
+ * Add a default header: `Connection: close` for RequestReplay::Proxy since
6
+ we're not going to reuse the connection anyway. There's no way to return
7
+ the socket back to the web server after hijacking according to Rack's SPEC.
8
+ This should fix some weird issues with web pages with a lot of images.
9
+
3
10
  ## request-replay 0.7.0 -- 2014-03-30
4
11
 
5
12
  * Fixed a bug where nginx with sendfile on might not send a full file back.
data/README.md CHANGED
@@ -14,7 +14,7 @@ Replay the request via Rack env
14
14
 
15
15
  ## REQUIREMENTS:
16
16
 
17
- * Tested with MRI (official CRuby) 1.9.3, 2.0.0, Rubinius and JRuby.
17
+ * Tested with MRI (official CRuby), Rubinius and JRuby.
18
18
 
19
19
  ## INSTALLATION:
20
20
 
data/Rakefile CHANGED
@@ -8,6 +8,6 @@ end
8
8
 
9
9
  Gemgem.init(dir) do |s|
10
10
  s.name = 'request-replay'
11
- s.version = '0.7.0'
11
+ s.version = '0.7.1'
12
12
  %w[bacon muack rack].each{ |g| s.add_development_dependency(g) }
13
13
  end
@@ -4,17 +4,23 @@ require 'request-replay'
4
4
  class RequestReplay::Proxy
5
5
  def initialize host, options={}
6
6
  @host, @options = host, options
7
+ # since we're hijacking, we don't manage connections
8
+ (@options[:add_headers] ||= {})['Connection'] ||= 'close'
7
9
  end
8
10
 
9
11
  def call env
10
- env['rack.hijack'].call
11
- RequestReplay.new(rewrite_env(env), @host, @options).start do |sock|
12
- IO.copy_stream(sock, env['rack.hijack_io'])
13
- env['rack.hijack_io'].close
14
- end
12
+ replay(rewrite_env(env), env['rack.hijack'].call)
15
13
  [200, {}, []]
16
14
  end
17
15
 
16
+ def replay env, io
17
+ RequestReplay.new(env, @host, @options).start do |sock|
18
+ IO.copy_stream(sock, io)
19
+ end
20
+ ensure
21
+ io.close
22
+ end
23
+
18
24
  def rewrite_env env
19
25
  if rewrite = @options[:rewrite_env]
20
26
  rewrite.call(env)
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: request-replay 0.7.0 ruby lib
2
+ # stub: request-replay 0.7.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "request-replay"
6
- s.version = "0.7.0"
6
+ s.version = "0.7.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
@@ -26,6 +26,7 @@ describe RequestReplay::Proxy do
26
26
  GET /?q=1 HTTP/1.1\r
27
27
  Host: localhost\r
28
28
  Pork: BEEF\r
29
+ Connection: close\r
29
30
  \r
30
31
  HTTP
31
32
 
@@ -41,6 +42,7 @@ Pork: BEEF\r
41
42
  GET /?q=1 HTTP/1.1\r
42
43
  Host: ex.com\r
43
44
  Pork: BEEF\r
45
+ Connection: close\r
44
46
  \r
45
47
  HTTP
46
48
 
@@ -56,6 +58,7 @@ Pork: BEEF\r
56
58
  GET /a?q=1 HTTP/1.1\r
57
59
  Host: localhost\r
58
60
  Pork: BEEF\r
61
+ Connection: close\r
59
62
  \r
60
63
  HTTP
61
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request-replay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)