You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "James, Barnaby" <ba...@caere.com> on 2000/01/23 00:09:16 UTC

Tomcat handling of large form-data requests

I posted this to tomcat-general a few days ago but it was suggested that I
might have better luck by posting it to tomcat-dev.

----

Hi,

I've been developing a servlet that handles file uploads using a
multipart/form-data request. On the servlet side, there is a limit on the
size of request that it will handle (I'm using Jason Hunter's super-useful
MultipartRequest class) and the idea is that an error page would be produced
if the post is too large. Under JRun, it look like the servlet engine cannot
interrupt the client so the client sends all the data and then gets the
response page indicating the problem. It would be nice if I could interrupt
the client in the middle of processing but it seems like this won't fly.

In Tomcat 3.1 (Jan 18th build), the behaviour is different. Under IE 5.0 the
client gets a "Server not found" page and under Netscape, the client puts up
a "Connect reset by peer" dialog. In any event, it looks like, since my
servlet never reads the input stream and sends the response page, the client
gets an error because the connection gets reset. I would guess that JRun
finishes reading the input stream if the Servlet doesn't.

Now the question is, which behaviour is correct? Is my servlet on the hook
to make sure that the input stream is fully read or should the servlet
engine. It seems like it would be pretty easy for the servlet engine to
check and I would be willing to take a crack at fixing this (somewhat
obscure) bug. Or am I way off base here?

On another note, it looks like the Jan 18th build doesn't include xml.jar in
the lib directory so server.xml cannot be parsed. And the Jan 19th / Jan
20th builds seem to have failed for some reason.

Thanks,
Barnaby

Barnaby James
Caere Corp.
Barnaby.James@caere.com
0393 A583 DB54 8ACE CB36  9A1D C7AD F8BA 2709 5008
http://pgp5.ai.mit.edu:11371/pks/lookup?op=get&search=0x27095008