From 818d6a1e4f145f3ff9a60933f71336a034c59536 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 6 Nov 2003 07:22:39 +0000 Subject: * 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 --- lib/cgi.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/cgi.rb') 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 -- cgit v1.2.3