I'm looking at writing a Mongrel handler that mimics the behavior of the Apache mod_put [1]. It allows for the streaming upload of very large (GB) files; it also supports resumable upload.
Before I get too involved, I'd like to ask if my reading of the mongrel source code is correct, i.e. what I want to do isn't currently possible. Looking at the class HttpRequest I see that request bodies larger than Mongrel::MAX_BODY get streamed to a tempfile before they are handed off to any handlers registered in the chain. Things were looking up for me when I saw the HttpHandler#request_progress call, but it doesn't hand the body off to the handler (only the params). In other words, mongrel would need to stream the entire upload to a tempfile before it hands off to my "PUT handler," right? If that's the case, any suggestions on how I could hack the code to hook into the HttpRequest class and redirect the write from "tempfile" to the real permanent file? This code path would only need to be activated for HTTP PUT where Content-Length is greater than Mongrel::MAX_BODY. Of course, I'd like that hack to allow all other requests to work normally. Thanks for any input and pointers. If you think I'm nuts for looking at Mongrel to do this operation, suggest another method that doesn't involve Apache and mod_put. cr [1] http://www.gknw.at/development/apache/httpd-2.0/unix/modules/ mod_put-2.0.8.tar.gz _______________________________________________ Mongrel-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/mongrel-users
