rack-streaming-proxy 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/lib/rack/streaming_proxy.rb +1 -1
- data/lib/rack/streaming_proxy/proxy_request.rb +10 -4
- data/spec/streaming_proxy_spec.rb +12 -0
- metadata +4 -5
- data/.gitignore +0 -18
data/Rakefile
CHANGED
@@ -17,11 +17,12 @@ Bones {
|
|
17
17
|
url 'http://github.com/aniero/rack-streaming-proxy'
|
18
18
|
version Rack::StreamingProxy::VERSION
|
19
19
|
ignore_file '.gitignore'
|
20
|
-
depend_on "rack", :version => "~> 1.0
|
20
|
+
depend_on "rack", :version => "~> 1.1.0"
|
21
21
|
depend_on "servolux", :version => "~> 0.8.1"
|
22
22
|
depend_on "rack-test", :version => "~> 0.5.1", :development => true
|
23
23
|
spec {
|
24
24
|
opts ["--colour", "--loadby mtime", "--reverse", "--diff unified"]
|
25
25
|
}
|
26
|
+
enable_sudo
|
26
27
|
}
|
27
28
|
|
data/lib/rack/streaming_proxy.rb
CHANGED
@@ -4,7 +4,7 @@ module Rack
|
|
4
4
|
class Error < StandardError; end
|
5
5
|
|
6
6
|
# :stopdoc:
|
7
|
-
VERSION = '1.0.
|
7
|
+
VERSION = '1.0.2'
|
8
8
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
9
9
|
PATH = ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "..")) + ::File::SEPARATOR
|
10
10
|
# :startdoc:
|
@@ -19,7 +19,9 @@ class Rack::StreamingProxy
|
|
19
19
|
end
|
20
20
|
|
21
21
|
%w(Accept Accept-Encoding Accept-Charset
|
22
|
-
X-Requested-With Referer User-Agent Cookie
|
22
|
+
X-Requested-With Referer User-Agent Cookie
|
23
|
+
Authorization
|
24
|
+
).each do |header|
|
23
25
|
key = "HTTP_#{header.upcase.gsub('-', '_')}"
|
24
26
|
proxy_request[header] = request.env[key] if request.env[key]
|
25
27
|
end
|
@@ -52,11 +54,15 @@ class Rack::StreamingProxy
|
|
52
54
|
@headers = HeaderHash.new(read_from_child)
|
53
55
|
end
|
54
56
|
rescue => e
|
55
|
-
@piper
|
56
|
-
|
57
|
+
if @piper
|
58
|
+
@piper.parent { raise }
|
59
|
+
@piper.child { @piper.puts e }
|
60
|
+
else
|
61
|
+
raise
|
62
|
+
end
|
57
63
|
ensure
|
58
64
|
# child needs to exit, always.
|
59
|
-
@piper.child { exit!(0) }
|
65
|
+
@piper.child { exit!(0) } if @piper
|
60
66
|
end
|
61
67
|
|
62
68
|
def each
|
@@ -143,5 +143,17 @@ describe Rack::StreamingProxy do
|
|
143
143
|
lambda { get "/not_proxied/boom" }.should raise_error(RuntimeError, /app error/)
|
144
144
|
end
|
145
145
|
|
146
|
+
it "preserves cookies" do
|
147
|
+
set_cookie "foo"
|
148
|
+
post "/env"
|
149
|
+
YAML.load(last_response.body)["HTTP_COOKIE"].should == "foo"
|
150
|
+
end
|
151
|
+
|
152
|
+
it "preserves authentication info" do
|
153
|
+
basic_authorize "admin", "secret"
|
154
|
+
post "/env"
|
155
|
+
YAML.load(last_response.body)["HTTP_AUTHORIZATION"].should == "Basic YWRtaW46c2VjcmV0\n"
|
156
|
+
end
|
157
|
+
|
146
158
|
end
|
147
159
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-streaming-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Witmer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-09 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.0
|
23
|
+
version: 1.1.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: servolux
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.0
|
53
|
+
version: 3.2.0
|
54
54
|
version:
|
55
55
|
description: Streaming proxy for Rack, the rainbows to Rack::Proxy's unicorn.
|
56
56
|
email: nwitmer@gmail.com
|
@@ -62,7 +62,6 @@ extra_rdoc_files:
|
|
62
62
|
- History.txt
|
63
63
|
- README.txt
|
64
64
|
files:
|
65
|
-
- .gitignore
|
66
65
|
- History.txt
|
67
66
|
- README.txt
|
68
67
|
- Rakefile
|
data/.gitignore
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# The list of files that should be ignored by Mr Bones.
|
2
|
-
# Lines that start with '#' are comments.
|
3
|
-
#
|
4
|
-
# A .gitignore file can be used instead by setting it as the ignore
|
5
|
-
# file in your Rakefile:
|
6
|
-
#
|
7
|
-
# Bones {
|
8
|
-
# ignore_file '.gitignore'
|
9
|
-
# }
|
10
|
-
#
|
11
|
-
# For a project with a C extension, the following would be a good set of
|
12
|
-
# exclude patterns (uncomment them if you want to use them):
|
13
|
-
# *.[oa]
|
14
|
-
# *~
|
15
|
-
announcement.txt
|
16
|
-
coverage
|
17
|
-
doc
|
18
|
-
pkg
|