You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/06/02 17:17:33 UTC

DO NOT REPLY [Bug 29345] New: - Wrong Content-length returned when chunked encoding

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29345>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29345

Wrong Content-length returned when chunked encoding

           Summary: Wrong Content-length returned when chunked encoding
           Product: Tomcat 4
           Version: 4.1.18
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Connector:Other
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: andpro77@gmx.net


Using the org.apache.ajp.tomcat4.Ajp13Connector 
HttpServletRequest.getContentLength() returns 0 if no content-length header was 
set in the HTTP request due to chunked transfer-encoding. Actually it should 
return -1. Btw org.apache.coyote.tomcat4.CoyoteConnector does this right.

It works if one initialises contentLength to -1 instead of 0 in 
org.apache.tomcat.util.http.BaseRequest. However, this might not be the 
right/nice place to fix this bug. 

In org.apache.ajp.RequestHandler there is the following code, which seems to 
solve the problem but doesn't get called if no content-length header is set.

                if (hId == SC_REQ_CONTENT_LENGTH) {
                    // just read content-length header
                    int contentLength = (vMB == null) ? -1 : vMB.getInt();
                    req.setContentLength(contentLength);

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