On 08/22/2010 04:49 AM, Amos Jeffries wrote:
Alex Rousskov wrote:
Send chunked responses if body size is unknown.

Apply HTTP chunked transfer encoding to the response body if all of
the following conditions are met:

* client claims HTTP version 1.1 or later support
* response does not have a Content-Length header already
* response does not use multipart/byteranges encoding
* connection is persistent

If we decide to send chunked reply, chunked_reply flag is set. Chunked
encoding is done in ClientSocketContext::packChunk(). The last-chunk
is sent only when clientReplyContext complete flag is set.

--------

This feature was requested to make Squid work with HTTP/1.1 clients
that can handle chunked responses but cannot handle connection
closures in the middle of a transaction sequence. The earlier version
of the patch (for Squid v3.1) was tested in production.

N.B. A bug in Squid may result in server-side code not treating
premature server-side connection termination as an error. That bug
results in Squid client-side sending a complete chunked response to
the client instead of omitting the last-chunk to indicate a truncated
response. Fixing that bug is outside this project scope (but we might
have a patch for it somewhere, I need to check).


+1.

Though it's worth noting that the logic as given also excludes chunking
in HTTP 2.0, 3.0, etc

Indeed, I missed that bug. I have another patch somewhere that adds proper comparison operators to the HttpVersion class. Will use that instead of the hand-made comparison.

Thank you,

Alex.

Reply via email to