Bugs item #2708, was opened at 2005-10-24 15:44
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2708&group_id=426

Category: Standard Library
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Zev Blut (zev)
Assigned to: Nobody (None)
Summary: CGI read_multipart implementaion can create Tempfiles for files less than 10KB

Initial Comment:
Hello,

My colleagues and I have discovered a problem with the implementation
of the CGI library's read_multipart method.

When the posted content length is greater than 10 kilobytes the CGI
read_multipart implementation will create a temporary file for each
parsed parameter until the consumed content length is less than 10
kilobytes.  When it is less than 10 kilobytes each data value is a
StringIO object.

The current implementation can cause problems.  We have situations
where we send images and many select options in a post.  When the
select options are parsed first this creates hundreds of small
Tempfiles.  Creating large amounts of Tempfiles can cause our servers
to become unresponsive.

Attached is a patch for read_multipart to only create Tempfiles for
each data entry greater than 10 kilobytes.  With this modification our
servers are responsive and show no other problems with my change.
This modification has been running on our production servers with no
problems for a number of weeks.  I believe that this patch is
implementing the intended goal of read_multipart's implementation.

The patch is against the cgi.rb v.1.83 
For more information see ruby-core[06076]

Best Regards,
Zev Blut


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2708&group_id=426