* 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:
parent
ce2b7d3a58
commit
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>
|
Fri Aug 22 14:28:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* strftime.c (rb_strftime): supported flags and precision for most
|
* 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
|
||||||
end
|
end
|
||||||
|
|
||||||
options["length"] = content.length.to_s
|
options["length"] = content.bytesize.to_s
|
||||||
output = stdoutput
|
output = stdoutput
|
||||||
output.binmode if defined? output.binmode
|
output.binmode if defined? output.binmode
|
||||||
output.print header(options)
|
output.print header(options)
|
||||||
@ -990,7 +990,7 @@ class CGI
|
|||||||
|
|
||||||
# start multipart/form-data
|
# start multipart/form-data
|
||||||
stdinput.binmode if defined? stdinput.binmode
|
stdinput.binmode if defined? stdinput.binmode
|
||||||
boundary_size = boundary.size + EOL.size
|
boundary_size = boundary.bytesize + EOL.bytesize
|
||||||
content_length -= boundary_size
|
content_length -= boundary_size
|
||||||
status = stdinput.read(boundary_size)
|
status = stdinput.read(boundary_size)
|
||||||
if nil == status
|
if nil == status
|
||||||
@ -1012,9 +1012,9 @@ class CGI
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
if head and ( (EOL + boundary + EOL).size < buf.size )
|
if head and ( (EOL + boundary + EOL).bytesize < buf.bytesize )
|
||||||
body.print buf[0 ... (buf.size - (EOL + boundary + EOL).size)]
|
body.print buf[0 ... (buf.bytesize - (EOL + boundary + EOL).bytesize)]
|
||||||
buf[0 ... (buf.size - (EOL + boundary + EOL).size)] = ""
|
buf[0 ... (buf.bytesize - (EOL + boundary + EOL).bytesize)] = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
c = if bufsize < content_length
|
c = if bufsize < content_length
|
||||||
@ -1026,7 +1026,7 @@ class CGI
|
|||||||
raise EOFError, "bad content body"
|
raise EOFError, "bad content body"
|
||||||
end
|
end
|
||||||
buf.concat(c)
|
buf.concat(c)
|
||||||
content_length -= c.size
|
content_length -= c.bytesize
|
||||||
end
|
end
|
||||||
|
|
||||||
buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{quoted_boundary}([\r\n]{1,2}|--)/n) do
|
buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{quoted_boundary}([\r\n]{1,2}|--)/n) do
|
||||||
@ -1065,7 +1065,7 @@ class CGI
|
|||||||
else
|
else
|
||||||
params[name] = [body]
|
params[name] = [body]
|
||||||
end
|
end
|
||||||
break if buf.size == 0
|
break if buf.bytesize == 0
|
||||||
break if content_length == -1
|
break if content_length == -1
|
||||||
end
|
end
|
||||||
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
|
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
|
||||||
@ -1122,7 +1122,7 @@ class CGI
|
|||||||
end
|
end
|
||||||
|
|
||||||
def print(data)
|
def print(data)
|
||||||
if @morph_check && (@cur_size + data.size > @threshold)
|
if @morph_check && (@cur_size + data.bytesize > @threshold)
|
||||||
convert_body
|
convert_body
|
||||||
end
|
end
|
||||||
@body.print data
|
@body.print data
|
||||||
@ -1503,12 +1503,12 @@ class CGI
|
|||||||
if value.kind_of?(String)
|
if value.kind_of?(String)
|
||||||
checkbox(name, value) + value
|
checkbox(name, value) + value
|
||||||
else
|
else
|
||||||
if value[value.size - 1] == true
|
if value[value.bytesize - 1] == true
|
||||||
checkbox(name, value[0], true) +
|
checkbox(name, value[0], true) +
|
||||||
value[value.size - 2]
|
value[value.bytesize - 2]
|
||||||
else
|
else
|
||||||
checkbox(name, value[0]) +
|
checkbox(name, value[0]) +
|
||||||
value[value.size - 1]
|
value[value.bytesize - 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}.join
|
}.join
|
||||||
@ -1879,13 +1879,13 @@ class CGI
|
|||||||
if value.kind_of?(String)
|
if value.kind_of?(String)
|
||||||
option({ "VALUE" => value }){ value }
|
option({ "VALUE" => value }){ value }
|
||||||
else
|
else
|
||||||
if value[value.size - 1] == true
|
if value[value.bytesize - 1] == true
|
||||||
option({ "VALUE" => value[0], "SELECTED" => true }){
|
option({ "VALUE" => value[0], "SELECTED" => true }){
|
||||||
value[value.size - 2]
|
value[value.bytesize - 2]
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
option({ "VALUE" => value[0] }){
|
option({ "VALUE" => value[0] }){
|
||||||
value[value.size - 1]
|
value[value.bytesize - 1]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1958,12 +1958,12 @@ class CGI
|
|||||||
if value.kind_of?(String)
|
if value.kind_of?(String)
|
||||||
radio_button(name, value) + value
|
radio_button(name, value) + value
|
||||||
else
|
else
|
||||||
if value[value.size - 1] == true
|
if value[value.bytesize - 1] == true
|
||||||
radio_button(name, value[0], true) +
|
radio_button(name, value[0], true) +
|
||||||
value[value.size - 2]
|
value[value.bytesize - 2]
|
||||||
else
|
else
|
||||||
radio_button(name, value[0]) +
|
radio_button(name, value[0]) +
|
||||||
value[value.size - 1]
|
value[value.bytesize - 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}.join
|
}.join
|
||||||
|
Loading…
x
Reference in New Issue
Block a user