Permalink
Browse files

Merge pull request #20672 from mtsmfm/4-2-stable-fix-header-modificat…

…ion-by-ssl

ActionDispatch::SSL should keep original header's behavior
  • Loading branch information...
guilleiguaran committed Jun 23, 2015
2 parents fced418 + 2468b16 commit 8a8e301ed67c29423cfcbe18676cd1d6b54d5ab1
View
@@ -1,3 +1,11 @@
* Fix to keep original header instance in `ActionDispatch::SSL`
`ActionDispatch::SSL` changes headers to `Hash`.
So some headers will be broken if there are some middlewares
on `ActionDispatch::SSL` and if it uses `Rack::Utils::HeaderHash`.
*Fumiaki Matsushima*
* Fix rake routes not showing the right format when
nesting multiple routes.
@@ -22,7 +22,7 @@ def call(env)
if request.ssl?
status, headers, body = @app.call(env)
headers = hsts_headers.merge(headers)
headers.reverse_merge!(hsts_headers)
flag_cookies_as_secure!(headers)
[status, headers, body]
else
@@ -216,4 +216,15 @@ def test_redirect_to_secure_subdomain_when_on_deep_subdomain
assert_equal "https://example.co.uk/path?key=value",
response.headers['Location']
end
def test_keeps_original_headers_behavior
headers = Rack::Utils::HeaderHash.new(
"Content-Type" => "text/html",
"Connection" => ["close"]
)
self.app = ActionDispatch::SSL.new(lambda { |env| [200, headers, ["OK"]] })
get "https://example.org/"
assert_equal "close", response.headers["Connection"]
end
end

0 comments on commit 8a8e301

Please sign in to comment.