[Mongrel] Canceled uploads and exceptions.

Christian
Wed, 21 Nov 2007 06:18:34 -0000

Hi,
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
places.

Any help would be appreciated.

Christian

--

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