rack-proxy 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rack/proxy.rb +2 -5
- data/test/rack_proxy_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c71d8f5f093330b71efd20ec95ce541c396b16
|
4
|
+
data.tar.gz: 1a5584b604965a50245ab35caf7da811c33a2fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98a8805b4ae8e3c86c24c780b958a3095fb0ea1bd86eec1c103ee9634e9a8ebdb5ba62c49af6a75687902b7793c71221a12618f912f936cd36aab4884f1ef76d
|
7
|
+
data.tar.gz: e77ed4762415ff980601d2c33f82d08e7d257088c60360323846a304e1df91d82cd81585b5dc65c8e185a03ceb96041f7ed6e84d82012ce8ebd08a17206025d2
|
data/Gemfile.lock
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.5.
|
8
|
+
VERSION = "0.5.13"
|
9
9
|
|
10
10
|
class << self
|
11
11
|
def extract_http_request_headers(env)
|
@@ -26,7 +26,7 @@ module Rack
|
|
26
26
|
|
27
27
|
def normalize_headers(headers)
|
28
28
|
mapped = headers.map do|k, v|
|
29
|
-
[k, if v.is_a? Array then v.
|
29
|
+
[k, if v.is_a? Array then v.join("\n") else v end]
|
30
30
|
end
|
31
31
|
Hash[mapped]
|
32
32
|
end
|
@@ -84,9 +84,6 @@ module Rack
|
|
84
84
|
target_request.body_stream.rewind
|
85
85
|
end
|
86
86
|
|
87
|
-
# Create a streaming response (the actual network communication is deferred, a.k.a. streamed)
|
88
|
-
target_response = HttpStreamingResponse.new(target_request, source_request.host, source_request.port)
|
89
|
-
|
90
87
|
backend = @backend || source_request
|
91
88
|
use_ssl = backend.scheme == "https"
|
92
89
|
ssl_verify_none = (env.delete('rack.ssl_verify_none') || @ssl_verify_none) == true
|
data/test/rack_proxy_test.rb
CHANGED
@@ -73,6 +73,17 @@ class RackProxyTest < Test::Unit::TestCase
|
|
73
73
|
assert !headers.key?('NOT-HTTP-HEADER')
|
74
74
|
end
|
75
75
|
|
76
|
+
def test_duplicate_headers
|
77
|
+
proxy_class = Rack::Proxy
|
78
|
+
env = { 'Set-Cookie' => ["cookie1=foo", "cookie2=bar"] }
|
79
|
+
|
80
|
+
headers = proxy_class.normalize_headers(env)
|
81
|
+
assert headers['Set-Cookie'].include?('cookie1=foo'), "Include the first value"
|
82
|
+
assert headers['Set-Cookie'].include?("\n"), "Join multiple cookies with newlines"
|
83
|
+
assert headers['Set-Cookie'].include?('cookie2=bar'), "Include the second value"
|
84
|
+
end
|
85
|
+
|
86
|
+
|
76
87
|
def test_handles_missing_content_length
|
77
88
|
assert_nothing_thrown do
|
78
89
|
post "/", nil, "CONTENT_LENGTH" => nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacek Becela
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|