Re: [PATCH] Do not chunk Content-Range responses

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 10 Sep 2012 16:40:06 -0600

On 08/24/2012 04:28 AM, Amos Jeffries wrote:
> On 24/08/2012 4:30 p.m., Alex Rousskov wrote:
>> Hello,
>>
>> When Squid forwards a response with a Content-Range header,
>> ClientSocketContext::socketState() detects the end of the response
>> range(s) and returns STREAM_*COMPLETE to
>> ClientSocketContext::writeComplete(). The latter thinks that the writing
>> of the response to the client must be over and calls
>> keepaliveNextRequest() instead of writing the last-chunk (if any). If
>> the to-client response was chunked, the client gets stuck waiting for
>> that missing last-chunk.
>>
>> The multipart Range request case was already excluded from chunking (or
>> it would probably suffer from the same problem). With this change, no
>> Content-Range responses will be chunked.
>>
>> N.B. Some servers send Content-Range responses to basic GET requests
>> without a Range header, so the problem affects more than just Range
>> requests.
>>
>> A proper fix would be to rewrite ClientSocketContext::writeComplete()
>> and other code so that it does not mix internal ClientStream completion
>> with [possibly chunk-encoded] writing completion. This should probably
>> be done along with fixing ClientSocketContext::socketState() and other
>> state-checking code to ignore to-client persistence
>> (flags.proxy_keepalive), which is not related to the internal
>> ClientStream state. Those changes are too big and too potentially
>> disruptive to be included in this fix though. Patches welcome.
>>
>>
>> Thank you,
>>
>> Alex.
>
>
> +1.
>
> Can you mark that comment in the code with a FIXME or similar please so
> we don't loose track of it for later.

Committed to trunk as r12318 after adding an XXX mark. The same change
should be ported to v3.2 IMO.

Thank you,

Alex.
Received on Mon Sep 10 2012 - 22:40:20 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 11 2012 - 12:00:05 MDT