mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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
2 changed files with 5 additions and 1 deletions
|
@ -159,7 +159,6 @@ class CGI
|
|||
raw_cookie.split(/;\s?/).each do |pairs|
|
||||
name, values = pairs.split('=',2)
|
||||
next unless name and values
|
||||
name = CGI.unescape(name)
|
||||
values ||= ""
|
||||
values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
|
||||
if cookies.has_key?(name)
|
||||
|
|
|
@ -101,6 +101,11 @@ class CGICookieTest < Test::Unit::TestCase
|
|||
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
|
||||
cookie = CGI::Cookie.new('name1', 'a', 'b', 'c')
|
||||
|
|
Loading…
Reference in a new issue