summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cgi.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 8598cff6c6..87ef8f7cbe 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -971,7 +971,7 @@ class CGI
end
def read_multipart(boundary, content_length)
- params = Hash.new([])
+ params = Hash.new { |h,k| h[k] = [] }
boundary = "--" + boundary
quoted_boundary = Regexp.quote(boundary, "n")
buf = ""
@@ -1063,11 +1063,8 @@ class CGI
/Content-Disposition:.* name="?([^\";\s]*)"?/ni.match(head)
name = $1.dup
- if params.has_key?(name)
- params[name].push(body)
- else
- params[name] = [body]
- end
+ params[name].push(body)
+
break if buf.size == 0
break if content_length == -1
end