tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: Tomcat 3.3 - Cactus Issue
Date Thu, 07 Feb 2002 22:33:00 GMT
On Thu, 7 Feb 2002, Vincent Massol wrote:

> Are you saying that the logic in Tomcat is that prior to closing a
> socket, all data is read first ?

No, tomcat will just try to flush it's input buffers.

We don't want to read all data - the servlet is supposed to
process the request and decide if it wants to read the body or
not. If it's a POST and getParameter() is called, we read the
body for the user. If the user calls getInputStream(), he
can read as much as he wants ( he may read the first bytes
and decide it doesn't care for the file ).

If for any reason the servlet hasn't read the full body
( either a POST where getParameter() is not called, or
an input stream that is not completely read ), tomcat will
discard the rest. Maybe you're in a DOS, or doing a large
upload and the servlet doesn't want it - no need to load
the network.

The code is just trying to read whatever is still in the
buffer ( received from net but not processed by
java, so still in the OS TCP stack ). If you have
data in the OS TCP stack, it'll send an ABORT packet
to signal to the other end the error condition ( so
the other side will know that some of the data it sent
was not processed ).

IMHO the correct behavior is to _do_ send the
ABORT, because that will allow the user to know what
happened. But many OSes just ignore the ABORT or
don't send it.

> And thus if I changed my test case to explicitly tell Tomcat to read the
> body (using request.getParameter("xxx")) the problem will disappear ?

I'm pretty sure of that. Or read the full body. Or catch the exception,
as it is a correct response from tomcat indicating the body didn't
reached the target ( the servlet ).

> Could it be because for this test case (testPostMethod) HTTP parameters
> are sent both in the URL _and_ in the body as POST data ?

Definitely no - I'm pretty sure we deal with that, and we have few good

We can even deal with a servlet that reads some data using
input stream and then call getParameter().


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message