On Wed, 3 May 2006 10:29:05 -0400, Zach Beane xach@xach.com wrote:
I would like to prevent files over a certain size from being uploaded. I don't want to check after the fact; I'd like to abort request processing as soon as the content-length is known to be too large.
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?
Cheers, Edi.