[前][次][番号順一覧][スレッド一覧]

ruby-changes:13986

From: ryan <ko1@a...>
Date: Mon, 16 Nov 2009 13:03:04 +0900 (JST)
Subject: [ruby-changes:13986] Ruby:r25794 (trunk): Rolled out last change

ryan	2009-11-16 13:02:20 +0900 (Mon, 16 Nov 2009)

  New Revision: 25794

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25794

  Log:
    Rolled out last change

  Modified files:
    trunk/lib/cgi/core.rb

Index: lib/cgi/core.rb
===================================================================
--- lib/cgi/core.rb	(revision 25793)
+++ lib/cgi/core.rb	(revision 25794)
@@ -426,7 +426,7 @@
       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 @@
         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 @@
             define_method(:content_type){""}
           end
         else
-          params[name] << body
+          (params[name] ||= []) << body
           @files[name]=body
         end
         ## break loop
@@ -518,6 +518,7 @@
         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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]