[Mongrel] Canceled uploads and exceptions.

Christian chippersbox at gmail.com
Wed Nov 21 01:18:34 EST 2007

I'm currently putting together a program that allows a user to cancel
a current file upload while it's happening. When I cancel the upload
in the browser, I get a " Error reading HTTP body: #<RuntimeError:
Socket read returned insufficient data: 4139>" exception.

That's all fine, and understandable, given the browser just closes the
connection without warning after previously sending a content-length
header. What I would like to know, is there anyway I can rescue this?
I've tried putting a begin rescue block around most places I can see
(Outside of the core mongrel), but this execption gets hit before the
process function of the handler is even called.

It doesn't affect the application in any way from what I can see, it
just fills up my logfile with a bunch of exceptions I'd rather not
have in there. Does anyone know of a way around this, where I could
maybe catch this exception? Or better still, another way to receive
files? Perhaps something like x-sendfile in reverse? I did google for
these, but haven't had much luck. Perhaps I'm looking in the wrong

Any help would be appreciated.



"Every child has many wishes. Some include a wallet, two chicks and a
cigar, but that's another story."

More information about the Mongrel-users mailing list