summaryrefslogtreecommitdiff
path: root/lib/cgi.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-06 07:22:39 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-06 07:22:39 +0000
commit818d6a1e4f145f3ff9a60933f71336a034c59536 (patch)
tree277366327de60bb4c1132c3117fe90a46cd3aa44 /lib/cgi.rb
parent113423bdff9c888195c6e22949d5d7f849a05b04 (diff)
* eval.c (rb_load): allow interrupt during loaded program
evaluation. [ruby-dev:21834] * hash.c (rb_hash_fetch): always warn if default argument and a block are supplied at the same time. [ruby-dev:21842] * hash.c (env_fetch): ditto. * array.c (rb_ary_fetch): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi.rb')
-rw-r--r--lib/cgi.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 43a5aa89f0..fc94772948 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -984,7 +984,7 @@ class CGI
raise EOFError, "bad content body"
end
- until -1 == content_length
+ loop do
head = nil
if 10240 < content_length
require "tempfile"
@@ -1020,14 +1020,13 @@ class CGI
else
stdinput.read(content_length) or ''
end
- buf += c
+ buf.concat(c)
content_length -= c.size
-
end
buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n) do
body.print $1
- if "--" == $2 or EOL == $2
+ if "--" == $2
content_length = -1
end
""
@@ -1072,7 +1071,8 @@ class CGI
else
params[name] = [body]
end
-
+ break if buf.size == 0
+ break if content_length === -1
end
params
@@ -1115,6 +1115,7 @@ class CGI
@multipart = true
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
else
+ @multipart = false
@params = CGI::parse(
case env_table['REQUEST_METHOD']
when "GET", "HEAD"
@@ -1133,10 +1134,13 @@ class CGI
end
@cookies = CGI::Cookie::parse((env_table['HTTP_COOKIE'] or env_table['COOKIE']))
-
end
private :initialize_query
+ def multipart?
+ @multipart
+ end
+
class Value < String # :nodoc:
def initialize(str, params)
@params = params