summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-16 04:02:20 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-16 04:02:20 +0000
commit6e9e286b3cdb8dbbb0511e3e3f43cedb5d83ec09 (patch)
tree03932aac38c9c0da754abb272608446051aa4216 /lib
parente1335844f8a06da676e09430bae8426269f11091 (diff)
downloadruby-6e9e286b3cdb8dbbb0511e3e3f43cedb5d83ec09.tar.gz
ruby-6e9e286b3cdb8dbbb0511e3e3f43cedb5d83ec09.tar.xz
ruby-6e9e286b3cdb8dbbb0511e3e3f43cedb5d83ec09.zip
Rolled out last change
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi/core.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index e216cafe0..393066333 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -426,7 +426,7 @@ class CGI
raise EOFError.new("no content body") unless status
raise EOFError.new("bad content body") unless first_line == status
## parse and set params
- params = Hash.new { |h,k| h[k] = [] }
+ params = {}
@files = {}
boundary_rexp = /--#{Regexp.quote(boundary)}(#{EOL}|--)/
boundary_size = "#{EOL}--#{boundary}#{EOL}".bytesize
@@ -496,7 +496,7 @@ class CGI
name = $1 || $2 || ''
if body.original_filename.empty?
value=body.read.dup.force_encoding(@accept_charset)
- params[name] << value
+ (params[name] ||= []) << value
unless value.valid_encoding?
if @accept_charset_error_block
@accept_charset_error_block.call(name,value)
@@ -510,7 +510,7 @@ class CGI
define_method(:content_type){""}
end
else
- params[name] << body
+ (params[name] ||= []) << body
@files[name]=body
end
## break loop
@@ -518,6 +518,7 @@ class CGI
break if content_length == -1
end
raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/
+ params.default = []
params
end # read_multipart
private :read_multipart