diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-12 08:06:49 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-12 08:06:49 +0000 |
commit | f988bf17bb4613803060bf5579e8ffe61b5a17b5 (patch) | |
tree | 68ce75677caeee7d6c087461672686477f8068c2 /lib/xmlrpc/server.rb | |
parent | e199582e24a5b8233380502e550019bd3055189e (diff) |
* backport r32856 from trunk.
* 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/branches/ruby_1_9_3@32947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/xmlrpc/server.rb')
-rw-r--r-- | lib/xmlrpc/server.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/xmlrpc/server.rb b/lib/xmlrpc/server.rb index b7345cd9d6..b7215385ad 100644 --- a/lib/xmlrpc/server.rb +++ b/lib/xmlrpc/server.rb @@ -456,7 +456,7 @@ class CGIServer < BasicServer $stdin.binmode if $stdin.respond_to? :binmode data = $stdin.read(length) - http_error(400, "Bad Request") if data.nil? or data.size != length + http_error(400, "Bad Request") if data.nil? or data.bytesize != length http_write(process(data), "Content-type" => "text/xml; charset=utf-8") } @@ -487,7 +487,7 @@ class CGIServer < BasicServer h = {} header.each {|key, value| h[key.to_s.capitalize] = value} h['Status'] ||= "200 OK" - h['Content-length'] ||= body.size.to_s + h['Content-length'] ||= body.bytesize.to_s str = "" h.each {|key, value| str << "#{key}: #{value}\r\n"} @@ -531,7 +531,7 @@ class ModRubyServer < BasicServer @ap.binmode data = @ap.read(length) - http_error(400, "Bad Request") if data.nil? or data.size != length + http_error(400, "Bad Request") if data.nil? or data.bytesize != length http_write(process(data), 200, "Content-type" => "text/xml; charset=utf-8") } @@ -562,7 +562,7 @@ class ModRubyServer < BasicServer h = {} header.each {|key, value| h[key.to_s.capitalize] = value} h['Status'] ||= "200 OK" - h['Content-length'] ||= body.size.to_s + h['Content-length'] ||= body.bytesize.to_s h.each {|key, value| @ap.headers_out[key] = value } @ap.content_type = h["Content-type"] @@ -751,17 +751,17 @@ class WEBrickServlet < BasicServer data = request.body - if data.nil? or data.size != length + if data.nil? or data.bytesize != length raise WEBrick::HTTPStatus::BadRequest end resp = process(data) - if resp.nil? or resp.size <= 0 + if resp.nil? or resp.bytesize <= 0 raise WEBrick::HTTPStatus::InternalServerError end response.status = 200 - response['Content-Length'] = resp.size + response['Content-Length'] = resp.bytesize response['Content-Type'] = "text/xml; charset=utf-8" response.body = resp end |