tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@apache.org>
Subject Re: Chunked encoding should be used also when not using keepalive
Date Thu, 01 Apr 2010 10:42:02 GMT
Doing this would be bad. When serving JSP's (or anything dynamic greater 
than the buffer size) - the content length is not sent to the client. So 
when the end of the request is sent - there is no signal to the client 
to let them know the request is over and they can start a new request 
over the same connection.

With chunked encoded - we can get away with no content length header 
because the each chunk as the length.

-Tim

On 4/1/2010 6:02 AM, Óscar Frías Barranco wrote:
> Hello.
>
> Currently Tomcat HTTP 1.1 Connector disables the use of chunked encoding if
> keepalive is not used.  This happens when an HTTP 1.1 request contains a
> "Connection: close" header.
> I propose to change Coyote to use chunked encoding (for HTTP 1.1) even if
> keepalive is disabled.
>
> Chunked transfer-encoding is an alternative to content-length, for use when
> the content-length cannot initially be determined.  While it is mandatory to
> have either of them to support keep-alive, its use is not restricted to
> keep-alive and one useful immediate benefit of using it is to allow a client
> to distinguish a connection abort from a complete response in order to avoid
> storing truncated data.
>
> Another useful case is when a reverse-proxy is installed in front of the
> server, and this reverse proxy tries to maintain keep-alive connections with
> the clients and intends to close the connections with the servers (like
> apache 1.3, haproxy, and I think nginx).  The lack of content-length and
> chunked encoding prevents the proxy from keeping client connections alive.
> The "connection: close" sent by the proxy to the server only indicates that
> the proxy will send just one request to the server, not that it does not
> care about the response length.  The same is true when that proxy caches.
> Without any content-length nor chunked encoding, the cache could store and
> distribute truncated response believing they are complete, while this would
> not happen with chunked encoding because the cache will be able to know it
> has not seen the end of the response.

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


Mime
View raw message