rack-proxy 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -2
- data/Rakefile +1 -0
- data/lib/rack/proxy.rb +2 -2
- data/test/net_http_hacked_test.rb +1 -1
- data/test/rack_proxy_test.rb +14 -1
- metadata +9 -7
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rack-proxy (0.3.
|
4
|
+
rack-proxy (0.3.7)
|
5
5
|
rack
|
6
6
|
|
7
7
|
GEM
|
@@ -10,11 +10,12 @@ GEM
|
|
10
10
|
rack (1.2.1)
|
11
11
|
rack-test (0.5.6)
|
12
12
|
rack (>= 1.0)
|
13
|
+
rake (0.9.2.2)
|
13
14
|
|
14
15
|
PLATFORMS
|
15
16
|
ruby
|
16
17
|
|
17
18
|
DEPENDENCIES
|
18
|
-
rack
|
19
19
|
rack-proxy!
|
20
20
|
rack-test
|
21
|
+
rake
|
data/Rakefile
CHANGED
data/lib/rack/proxy.rb
CHANGED
@@ -5,7 +5,7 @@ module Rack
|
|
5
5
|
|
6
6
|
# Subclass and bring your own #rewrite_request and #rewrite_response
|
7
7
|
class Proxy
|
8
|
-
VERSION = "0.3.
|
8
|
+
VERSION = "0.3.7"
|
9
9
|
|
10
10
|
def call(env)
|
11
11
|
rewrite_response(perform_request(rewrite_env(env)))
|
@@ -49,7 +49,7 @@ module Rack
|
|
49
49
|
|
50
50
|
def extract_http_request_headers(env)
|
51
51
|
headers = env.reject do |k, v|
|
52
|
-
!(/^HTTP_[A-Z_]+$/ === k)
|
52
|
+
!(/^HTTP_[A-Z_]+$/ === k) || v.nil?
|
53
53
|
end.map do |k, v|
|
54
54
|
[reconstruct_header_name(k), v]
|
55
55
|
end.inject(Utils::HeaderHash.new) do |hash, k_v|
|
data/test/rack_proxy_test.rb
CHANGED
@@ -5,7 +5,6 @@ class RackProxyTest < Test::Unit::TestCase
|
|
5
5
|
class TrixProxy < Rack::Proxy
|
6
6
|
def rewrite_env(env)
|
7
7
|
env["HTTP_HOST"] = "trix.pl"
|
8
|
-
|
9
8
|
env
|
10
9
|
end
|
11
10
|
end
|
@@ -29,4 +28,18 @@ class RackProxyTest < Test::Unit::TestCase
|
|
29
28
|
header = proxy.send(:reconstruct_header_name, "HTTP_ABC_D")
|
30
29
|
assert header == "ABC-D"
|
31
30
|
end
|
31
|
+
|
32
|
+
def test_extract_http_request_headers
|
33
|
+
proxy = Rack::Proxy.new
|
34
|
+
env = {
|
35
|
+
'NOT-HTTP-HEADER' => 'test-value',
|
36
|
+
'HTTP_ACCEPT' => 'text/html',
|
37
|
+
'HTTP_CONNECTION' => nil
|
38
|
+
}
|
39
|
+
|
40
|
+
headers = proxy.send(:extract_http_request_headers, env)
|
41
|
+
assert headers.key?('ACCEPT')
|
42
|
+
assert !headers.key?('CONNECTION')
|
43
|
+
assert !headers.key?('NOT-HTTP-HEADER')
|
44
|
+
end
|
32
45
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 7
|
10
|
+
version: 0.3.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jacek Becela
|
@@ -15,10 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-02-02 00:00:00 +01:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: rack
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
@@ -30,9 +30,9 @@ dependencies:
|
|
30
30
|
- 0
|
31
31
|
version: "0"
|
32
32
|
type: :runtime
|
33
|
+
name: rack
|
33
34
|
version_requirements: *id001
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
|
-
name: rack-test
|
36
36
|
prerelease: false
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
@@ -44,6 +44,7 @@ dependencies:
|
|
44
44
|
- 0
|
45
45
|
version: "0"
|
46
46
|
type: :development
|
47
|
+
name: rack-test
|
47
48
|
version_requirements: *id002
|
48
49
|
description: A Rack app that provides request/response rewriting proxy capabilities with streaming.
|
49
50
|
email:
|
@@ -69,6 +70,7 @@ files:
|
|
69
70
|
- test/net_http_hacked_test.rb
|
70
71
|
- test/rack_proxy_test.rb
|
71
72
|
- test/test_helper.rb
|
73
|
+
has_rdoc: true
|
72
74
|
homepage: http://rubygems.org/gems/rack-proxy
|
73
75
|
licenses: []
|
74
76
|
|
@@ -98,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
100
|
requirements: []
|
99
101
|
|
100
102
|
rubyforge_project: rack-proxy
|
101
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 1.6.2
|
102
104
|
signing_key:
|
103
105
|
specification_version: 3
|
104
106
|
summary: A request/response rewriting HTTP proxy. A Rack app.
|