[tbnl-devel] large file uploads

Zach Beane xach at xach.com
Wed May 3 15:41:15 UTC 2006


On Wed, May 03, 2006 at 05:32:26PM +0200, Edi Weitz wrote:
> > Is it ok to close the content-stream and error out of
> > initialize-instance on the request? Is there a better way?
> 
> I would assume that it is "OK" in the sense that it doesn't wreak
> havoc.  You'll be caught by the IGNORE-ERRORS in LISTEN-FOR-REQUEST
> which in turn will close the stream.  If you're behind Apache, it will
> then as a result of this sooner or later close the stream to the
> client which is still trying to send stuff.  Of course, there's no way
> to re-use these streams and/or to send a message to the client.
> 
> It's not pretty, though, but OTOH I think there /is/ no pretty way of
> doing this.  Do you want to do this as some kind of anti-DoS measure?

Yes, though not an intentional DoS. My application accepts image files
and only processes files of a reasonable size. Allowing uploads of
very large files only to reject them later in the process consumes
CPU, bandwidth, and memory that could be used elsewhere.

I have a local patch for this (the large files were also crashing
SBCL, so I needed to do something quickly). If I figure out a nice
way to do it, I will send along a TBNL patch too.

Zach



More information about the Tbnl-devel mailing list