1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

When parsing cookies, only decode the values

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2021-11-24 11:41:55 +00:00
parent 1fbf663b00
commit 02c341c9bc
3 changed files with 6 additions and 2 deletions

View file

@ -165,7 +165,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)

View file

@ -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')

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.6.9"
#define RUBY_RELEASE_DATE "2021-11-24"
#define RUBY_PATCHLEVEL 206
#define RUBY_PATCHLEVEL 207
#define RUBY_RELEASE_YEAR 2021
#define RUBY_RELEASE_MONTH 11