зеркало из https://github.com/github/ruby.git
* lib/cgi.rb: use bytesize instead of size/length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ce2b7d3a58
Коммит
760ee4ec04
|
@ -1,3 +1,7 @@
|
|||
Fri Aug 22 15:47:38 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* lib/cgi.rb: use bytesize instead of size/length.
|
||||
|
||||
Fri Aug 22 14:28:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* strftime.c (rb_strftime): supported flags and precision for most
|
||||
|
|
34
lib/cgi.rb
34
lib/cgi.rb
|
@ -730,7 +730,7 @@ class CGI
|
|||
end
|
||||
end
|
||||
|
||||
options["length"] = content.length.to_s
|
||||
options["length"] = content.bytesize.to_s
|
||||
output = stdoutput
|
||||
output.binmode if defined? output.binmode
|
||||
output.print header(options)
|
||||
|
@ -990,7 +990,7 @@ class CGI
|
|||
|
||||
# start multipart/form-data
|
||||
stdinput.binmode if defined? stdinput.binmode
|
||||
boundary_size = boundary.size + EOL.size
|
||||
boundary_size = boundary.bytesize + EOL.bytesize
|
||||
content_length -= boundary_size
|
||||
status = stdinput.read(boundary_size)
|
||||
if nil == status
|
||||
|
@ -1012,9 +1012,9 @@ class CGI
|
|||
next
|
||||
end
|
||||
|
||||
if head and ( (EOL + boundary + EOL).size < buf.size )
|
||||
body.print buf[0 ... (buf.size - (EOL + boundary + EOL).size)]
|
||||
buf[0 ... (buf.size - (EOL + boundary + EOL).size)] = ""
|
||||
if head and ( (EOL + boundary + EOL).bytesize < buf.bytesize )
|
||||
body.print buf[0 ... (buf.bytesize - (EOL + boundary + EOL).bytesize)]
|
||||
buf[0 ... (buf.bytesize - (EOL + boundary + EOL).bytesize)] = ""
|
||||
end
|
||||
|
||||
c = if bufsize < content_length
|
||||
|
@ -1026,7 +1026,7 @@ class CGI
|
|||
raise EOFError, "bad content body"
|
||||
end
|
||||
buf.concat(c)
|
||||
content_length -= c.size
|
||||
content_length -= c.bytesize
|
||||
end
|
||||
|
||||
buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{quoted_boundary}([\r\n]{1,2}|--)/n) do
|
||||
|
@ -1065,7 +1065,7 @@ class CGI
|
|||
else
|
||||
params[name] = [body]
|
||||
end
|
||||
break if buf.size == 0
|
||||
break if buf.bytesize == 0
|
||||
break if content_length == -1
|
||||
end
|
||||
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
|
||||
|
@ -1122,7 +1122,7 @@ class CGI
|
|||
end
|
||||
|
||||
def print(data)
|
||||
if @morph_check && (@cur_size + data.size > @threshold)
|
||||
if @morph_check && (@cur_size + data.bytesize > @threshold)
|
||||
convert_body
|
||||
end
|
||||
@body.print data
|
||||
|
@ -1503,12 +1503,12 @@ class CGI
|
|||
if value.kind_of?(String)
|
||||
checkbox(name, value) + value
|
||||
else
|
||||
if value[value.size - 1] == true
|
||||
if value[value.bytesize - 1] == true
|
||||
checkbox(name, value[0], true) +
|
||||
value[value.size - 2]
|
||||
value[value.bytesize - 2]
|
||||
else
|
||||
checkbox(name, value[0]) +
|
||||
value[value.size - 1]
|
||||
value[value.bytesize - 1]
|
||||
end
|
||||
end
|
||||
}.join
|
||||
|
@ -1879,13 +1879,13 @@ class CGI
|
|||
if value.kind_of?(String)
|
||||
option({ "VALUE" => value }){ value }
|
||||
else
|
||||
if value[value.size - 1] == true
|
||||
if value[value.bytesize - 1] == true
|
||||
option({ "VALUE" => value[0], "SELECTED" => true }){
|
||||
value[value.size - 2]
|
||||
value[value.bytesize - 2]
|
||||
}
|
||||
else
|
||||
option({ "VALUE" => value[0] }){
|
||||
value[value.size - 1]
|
||||
value[value.bytesize - 1]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -1958,12 +1958,12 @@ class CGI
|
|||
if value.kind_of?(String)
|
||||
radio_button(name, value) + value
|
||||
else
|
||||
if value[value.size - 1] == true
|
||||
if value[value.bytesize - 1] == true
|
||||
radio_button(name, value[0], true) +
|
||||
value[value.size - 2]
|
||||
value[value.bytesize - 2]
|
||||
else
|
||||
radio_button(name, value[0]) +
|
||||
value[value.size - 1]
|
||||
value[value.bytesize - 1]
|
||||
end
|
||||
end
|
||||
}.join
|
||||
|
|
Загрузка…
Ссылка в новой задаче