[Mongrel] Large file support (up and down) for Mongrel 0.13.3

why the lucky stiff why at ruby-lang.org
Tue Apr 11 02:11:54 EDT 2006

I've just checked in changes to improve handling of massive posts and
massive downloads.  Generally speaking, Mongrel has been keeping
everything in memory.  (Unless you're using DirHandler and have the
sendfile gem in place.)  Now, downloads should be pretty swift even
without the sendfile gem.

HttpResponse#send_file rips out the file streaming support from
DirHandler and encapsulates it.  This method doesn't set any of the
headers or anything, it just streams the file.  The idea here is to
allow for support of the X-Sendfile header [1], also supported in
lighttpd as of a few days ago. [2]  I'm in the mood to keep polishing
this, so does anyone lust after mod_uploadprogress support? [3]

HttpRequest#initialize also had a TODO about storing large request
bodies in a Tempfile.  I've fleshed out that code so @body now has
either a StringIO object or an open/rewound Tempfile object.  It works,
you can upload gigs of files just fine.  I'm honoring CHUNK_SIZE.
There's a threshold in a constant called MAX_BODY.  If a file is larger,
it'll get canned in a Tempfile.  Currently, it's set to the same size as

I've added to the test_response.rb appropriately.  I've tested the
DirHander and CampingHandler.  I'm going to test out the Rails handler now.


[1] http://celebnamer.celebworld.ws/stuff/mod_xsendfile/
[2] http://trac.lighttpd.net/trac/changeset/1097
[3] http://www.lighttpd.net/documentation/upload-progress.html

More information about the Mongrel-users mailing list