tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Sampaleanu" <asampale...@activience.com>
Subject Bug(?) and suggested solution for chunked transfer-encoding POST request
Date Fri, 08 Nov 2002 16:54:07 GMT

We are having a problem with Catalina 4.1.12 (I believe we also had issues with previous versions,
but can't say for sure) with respect to how POSTed requests are handled if the transfer encoding
is "chunked". It seems that request parameters in the content are not processed in this case.

Looking at the source, in HttpRequestBase.java the method parseParameters() does the following
check:

if ("POST".equals(getMethod()) && (getContentLength() > 0)
    && (this.stream == null)
    && "application/x-www-form-urlencoded".equals(contentType)) {

   ...
   Processing of params in the content
   ...
}

The problem is that with chunked transfer encoding the content length condition isn't met
since parseHeaders() in HttpProcessor.java only sets this if the content-length header exists
which is not the case with chunked transfers. It would seem that the check in HttpRequestBase.java
shoud really be:

String transferEncoding = request.getHeader("Transfer-Encoding");
boolean chunked = ((transferEncoding != null) && (transferEncoding.indexOf("chunked")
!= -1));

if ("POST".equals(getMethod()) && (getContentLength() > 0 || chunked)
    && (this.stream == null)
    && "application/x-www-form-urlencoded".equals(contentType))


If I'm way off base, does anyone have the real solution?

Thanks,
Adrian Sampaleanu
Activience Inc.

	 

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message