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 +4 -4
- data/CHANGES.md +7 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/request-replay/proxy.rb +11 -5
- data/request-replay.gemspec +2 -2
- data/test/test_proxy.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481cb39dcc322bbf56565497c32253602ac569f8
|
4
|
+
data.tar.gz: cf769c68314c369afe197eed38e2d624c010701b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/Rakefile
CHANGED
data/lib/request-replay/proxy.rb
CHANGED
@@ -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)
|
data/request-replay.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: request-replay 0.7.
|
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.
|
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"]
|
data/test/test_proxy.rb
CHANGED
@@ -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
|
|