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, lib/xmlrpc/server.rb: should use

String#bytesize instead of String#size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2011-08-05 04:35:28 +00:00
parent 55148a2501
commit c3a750ebee
4 changed files with 22 additions and 12 deletions

View file

@ -501,7 +501,7 @@ module XMLRPC
header = {
"User-Agent" => USER_AGENT,
"Content-Type" => "text/xml; charset=utf-8",
"Content-Length" => request.size.to_s,
"Content-Length" => request.bytesize.to_s,
"Connection" => (async ? "close" : "keep-alive")
}
@ -559,10 +559,10 @@ module XMLRPC
end
expected = resp["Content-Length"] || "<unknown>"
if data.nil? or data.size == 0
raise "Wrong size. Was #{data.size}, should be #{expected}"
elsif expected != "<unknown>" and expected.to_i != data.size and resp["Transfer-Encoding"].nil?
raise "Wrong size. Was #{data.size}, should be #{expected}"
if data.nil? or data.bytesize == 0
raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
elsif expected != "<unknown>" and expected.to_i != data.bytesize and resp["Transfer-Encoding"].nil?
raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
end
set_cookies = resp.get_fields("Set-Cookie")