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 2001/09/20 12:08:56 UTC

DO NOT REPLY [Bug 3745] New: - Http10Interceptor hangs on PUT without Content-Length

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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3745

Http10Interceptor hangs on PUT without Content-Length

           Summary: Http10Interceptor hangs on PUT without Content-Length
           Product: Tomcat 3
           Version: 3.3 Beta 2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Connectors
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: stefan.eissing@greenbytes.de


When a PUT request has no Content-Length header, tomcat "hangs"
on HttpServletRequest.getInputStream.read() as it will forever
return 0 and never -1.

The comment in ServletInputStreamFacade (see extract below) indicates
that this can only happen in chunked encoding. This is a wrong assumpation
as chunked encoding is only available in HTTP/1.1. In HTTP/1.0 the
end of the message body can be indicated by closing the client side
of the connection/socket. This is the behaviour working in Tomcat 3.2.x.

Returning 0 results from the interplay between the following code extracts:

In Lines 233-235 of Http10Interceptor.java

    public int doRead(byte[] b, int off, int len) throws IOException {
	if( available <= 0 )
	    return 0;

In ServletInputStreamFacade.java, lines 107-119:
	if (limit == -1) {
	    // Ask the adapter for more data. We are in the 'no content-length'
	    // case - i.e. chunked encoding ( acording to http spec CL is 
required
	    // for everything else.
	    int rd=reqA.doRead();
	    if( rd<0 ) {
		limit=0; // no more bytes can be read.
	    } else {
		bytesRead++; // for statistics
	    }
	    return rd;
	}