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

* lib/webrick/httpproxy.rb (WEBrick::HTTPProxyServer#do_CONNECT):

use #bytesize instead of #size.  a patch submitted from
  raspberry lemon in  [ruby-core:18571].

* lib/webrick/httpauth/digestauth.rb, lib/webrick/httpproxy.rb,
  lib/webrick/httprequest.rb, lib/webrick/httpservlet/cgi_runner.rb,
  lib/webrick/httpservlet/abstract.rb, lib/webrick/httpresponse.rb,
  lib/webrick/httpservlet/cgihandler.rb, lib/webrick/utils.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-11-08 09:41:24 +00:00
parent 75fcee4a23
commit 877ac7236a
10 changed files with 37 additions and 26 deletions

View file

@ -59,7 +59,7 @@ module WEBrick
def redirect_to_directory_uri(req, res)
if req.path[-1] != ?/
location = WEBrick::HTTPUtils.escape_path(req.path + "/")
if req.query_string && req.query_string.size > 0
if req.query_string && req.query_string.bytesize > 0
location << "?" << req.query_string
end
res.set_redirect(HTTPStatus::MovedPermanently, location)

View file

@ -13,7 +13,7 @@ def sysread(io, size)
while size > 0
tmp = io.sysread(size)
buf << tmp
size -= tmp.size
size -= tmp.bytesize
end
return buf
end

View file

@ -48,14 +48,14 @@ module WEBrick
end
dump = Marshal.dump(meta)
cgi_in.write("%8d" % cgi_out.path.size)
cgi_in.write("%8d" % cgi_out.path.bytesize)
cgi_in.write(cgi_out.path)
cgi_in.write("%8d" % cgi_err.path.size)
cgi_in.write("%8d" % cgi_err.path.bytesize)
cgi_in.write(cgi_err.path)
cgi_in.write("%8d" % dump.size)
cgi_in.write("%8d" % dump.bytesize)
cgi_in.write(dump)
if req.body and req.body.size > 0
if req.body and req.body.bytesize > 0
cgi_in.write(req.body)
end
ensure
@ -65,7 +65,7 @@ module WEBrick
data = cgi_out.read
cgi_out.close(true)
if errmsg = cgi_err.read
if errmsg.size > 0
if errmsg.bytesize > 0
@logger.error("CGIHandler: #{@script_filename}:\n" + errmsg)
end
end

View file

@ -407,13 +407,13 @@ module WEBrick
list.each{ |name, time, size|
if name == ".."
dname = "Parent Directory"
elsif name.size > 25
elsif name.bytesize > 25
dname = name.sub(/^(.{23})(?:.*)/, '\1..')
else
dname = name
end
s = " <A HREF=\"#{HTTPUtils::escape(name)}\">#{dname}</A>"
s << " " * (30 - dname.size)
s << " " * (30 - dname.bytesize)
s << (time ? time.strftime("%Y/%m/%d %H:%M ") : " " * 22)
s << (size >= 0 ? size.to_s : "-") << "\n"
res.body << s