rack-proxy 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rack/proxy.rb +4 -2
- data/test/rack_proxy_test.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40c24e4b559fc7669c3b675184af8d7f0b9ba693d3a7b41e6433274c16429adc
|
|
4
|
+
data.tar.gz: 6f8790c5c391e102275c11225a869e2572d109f2e52e4783cdc5cbbb50733579
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2885f787b2f08c712c99b938218749d7f5d35348588290414f058c446104e10ba80b7f0b439ea60c3fc4daea1a0b0f991c92e853a3a9de4ef238d5f864d85d20
|
|
7
|
+
data.tar.gz: 3f70b5ab5eee94517d10e82f72f517a7e4cd3fec346ba78142ed6d93bd34bb7d175f6e857c037c7b0beffd710889651f15d107920e38da7208bdc132f246f712
|
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.8.
|
|
8
|
+
VERSION = "0.8.2".freeze
|
|
9
9
|
|
|
10
10
|
HOP_BY_HOP_HEADERS = {
|
|
11
11
|
'connection' => true,
|
|
@@ -39,7 +39,9 @@ module Rack
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def build_header_hash(pairs)
|
|
42
|
-
|
|
42
|
+
# Pass inherit: false so we only check Rack's own constants — otherwise
|
|
43
|
+
# a top-level ::Headers defined by the host app would falsely match.
|
|
44
|
+
if Rack.const_defined?(:Headers, false)
|
|
43
45
|
# Rack::Headers is only available from Rack 3 onward
|
|
44
46
|
Headers.new.tap { |headers| pairs.each { |k, v| headers[k] = v } }
|
|
45
47
|
else
|
data/test/rack_proxy_test.rb
CHANGED
|
@@ -250,6 +250,22 @@ class RackProxyTest < Test::Unit::TestCase
|
|
|
250
250
|
"expected debug output to include request line, got: #{sink.string.inspect}")
|
|
251
251
|
end
|
|
252
252
|
|
|
253
|
+
# Regression: build_header_hash must not match a top-level ::Headers
|
|
254
|
+
# constant defined by the host app (would happen with inherit: true).
|
|
255
|
+
def test_build_header_hash_ignores_toplevel_headers_constant
|
|
256
|
+
Object.send(:remove_const, :Headers) if Object.const_defined?(:Headers, false)
|
|
257
|
+
Object.const_set(:Headers, Class.new)
|
|
258
|
+
begin
|
|
259
|
+
result = Rack::Proxy.send(:build_header_hash, [['X-Test', 'value']])
|
|
260
|
+
# On Rack 3+ we get Rack::Headers; on Rack 2 we get Rack::Utils::HeaderHash.
|
|
261
|
+
# In neither case should we get the bogus top-level ::Headers.
|
|
262
|
+
assert_not_equal ::Headers, result.class,
|
|
263
|
+
"build_header_hash leaked into top-level ::Headers"
|
|
264
|
+
ensure
|
|
265
|
+
Object.send(:remove_const, :Headers)
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
|
|
253
269
|
def test_no_logger_means_no_debug_output
|
|
254
270
|
# Without a :logger option, Net::HTTP's set_debug_output should never be
|
|
255
271
|
# called. We can't directly assert that, but we can confirm requests still
|