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

* lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Support

multiple names in a response. [ruby-core:41711] [Bug #5774]
  Reported by Roman Riha. Thanks!!!
* test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_override):
  Add a test of the above case.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2013-06-13 13:46:54 +00:00
parent 102e2cd563
commit 16d5c80678
3 changed files with 28 additions and 3 deletions

View file

@ -1,3 +1,11 @@
Thu Jun 13 22:44:52 2013 Kouhei Sutou <kou@cozmixng.org>
* lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Support
multiple names in a response. [ruby-core:41711] [Bug #5774]
Reported by Roman Riha. Thanks!!!
* test/xmlrpc/test_client.rb (XMLRPC::ClientTest#test_cookie_override):
Add a test of the above case.
Thu Jun 13 22:35:50 2013 Kouhei Sutou <kou@cozmixng.org>
* lib/xmlrpc/client.rb (XMLRPC::Client#parse_set_cookies): Use

View file

@ -515,10 +515,16 @@ module XMLRPC # :nodoc:
return if set_cookies.nil?
return if set_cookies.empty?
require 'webrick/cookie'
@cookie = set_cookies.collect do |set_cookie|
pairs = {}
set_cookies.each do |set_cookie|
cookie = WEBrick::Cookie.parse_set_cookie(set_cookie)
WEBrick::Cookie.new(cookie.name, cookie.value).to_s
end.join("; ")
pairs.delete(cookie.name)
pairs[cookie.name] = cookie.value
end
cookies = pairs.collect do |name, value|
WEBrick::Cookie.new(name, value).to_s
end
@cookie = cookies.join("; ")
end
def gen_multicall(methods=[], async=false)

View file

@ -287,6 +287,17 @@ module XMLRPC
assert_equal("param1=value1; param2=value2", client.cookie)
end
def test_cookie_override
client = Fake::Client.new2('http://example.org/cookie')
client.send(:parse_set_cookies,
[
"param1=value1",
"param2=value2",
"param1=value3",
])
assert_equal("param2=value2; param1=value3", client.cookie)
end
private
def read filename
File.read File.expand_path(File.join(__FILE__, '..', 'data', filename))