Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ruby 1.9: cookie header parser works with either newline-delimited st…

…rings or arrays
  • Loading branch information...
commit f85ab90e4fbe38ac5ad211d07a8113d5be301f51 1 parent 564ace6
@jeremy jeremy authored
View
4 actionpack/lib/action_controller/integration.rb
@@ -323,7 +323,9 @@ def process(method, path, parameters = nil, headers = nil)
@headers = Rack::Utils::HeaderHash.new(headers)
- (@headers['Set-Cookie'] || "").split("\n").each do |cookie|
+ cookies = @headers['Set-Cookie']
+ cookies = cookies.to_s.split("\n") unless cookies.is_a?(Array)
+ cookies.each do |cookie|
name, value = cookie.match(/^([^=]*)=([^;]*);/)[1,2]
@cookies[name] = value
end
View
1  actionpack/test/controller/integration_test.rb
@@ -324,7 +324,6 @@ def test_cookie_monster
assert_equal "Gone", status_message
assert_response 410
assert_response :gone
- assert_equal "cookie_1=; path=/\ncookie_3=chocolate; path=/", headers["Set-Cookie"]
assert_equal({"cookie_1"=>"", "cookie_2"=>"oatmeal", "cookie_3"=>"chocolate"}, cookies)
assert_equal "Gone", response.body
end
Please sign in to comment.
Something went wrong with that request. Please try again.