[ruby/cgi] When parsing cookies, only decode the values
https://github.com/ruby/cgi/commit/052eb3a828
This commit is contained in:
parent
da34f31ad0
commit
0f31b3f465
@ -159,7 +159,6 @@ class CGI
|
|||||||
raw_cookie.split(/;\s?/).each do |pairs|
|
raw_cookie.split(/;\s?/).each do |pairs|
|
||||||
name, values = pairs.split('=',2)
|
name, values = pairs.split('=',2)
|
||||||
next unless name and values
|
next unless name and values
|
||||||
name = CGI.unescape(name)
|
|
||||||
values ||= ""
|
values ||= ""
|
||||||
values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
|
values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
|
||||||
if cookies.has_key?(name)
|
if cookies.has_key?(name)
|
||||||
|
@ -101,6 +101,11 @@ class CGICookieTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_cgi_cookie_parse_not_decode_name
|
||||||
|
cookie_str = "%66oo=baz;foo=bar"
|
||||||
|
cookies = CGI::Cookie.parse(cookie_str)
|
||||||
|
assert_equal({"%66oo" => ["baz"], "foo" => ["bar"]}, cookies)
|
||||||
|
end
|
||||||
|
|
||||||
def test_cgi_cookie_arrayinterface
|
def test_cgi_cookie_arrayinterface
|
||||||
cookie = CGI::Cookie.new('name1', 'a', 'b', 'c')
|
cookie = CGI::Cookie.new('name1', 'a', 'b', 'c')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user