[squid-users] Squid cannot parse Content-Length header value and closes connection before sending body?

Alex Rousskov rousskov at measurement-factory.com
Mon May 1 23:37:46 UTC 2017

On 05/01/2017 04:12 PM, Masha Lifshin wrote:

> when I turn on icap, squid shuts down the connection early,
> without returning the body of the response.  It seems it cannot read the
> content length header and that messes up both squid and icap.

> 2017/04/28 08:11:47.297 kid1| 55,2| HttpHeader.cc(1483)
> httpHeaderNoteParsedEntry: cannot parse hdr field: 'Content-Length: 606'

These "cannot parse hdr field" lines is a sign of a minor accounting bug
(fixed in the latest Squid; v5 r15019). Do not worry about it -- it does
not affect Squid behavior beyond header statistics reporting.

> 2017/04/28 08:11:47.576 kid1| 93,3|
> Adaptation::Icap::Xaction::noteCommRead threw exception: garbage
> instead of CRLF line terminator

This exception can explain your symptoms: Squid failed to parse some
portion of the ICAP response from your ICAP server. This is either a
Squid bug or an ICAP server bug.

Please make sure your Squid v4 contains a fix for bug #4551:


Squid v4.0.13 and newer should have that fix. If your Squid is v4.0.17
then bug #4551 should be fixed, but perhaps there is another bug OR the
ICAP server itself is misbehaving.

>  Or is there some disconnect about the 206 code from icap?  

The posted logs do not show enough info for me to pinpoint the problem.
Try replacing "93,3" with "93,9 74,9" in your debug_options. Is that
enough to get the ICAP server response logged? (I do not remember the
minimum set of debug_options necessary to accomplish that.) If you post
a new log, please attach (or post a link to) it instead of quoting it in
the email because email formatting often screws up important details.

Alternatively, post a pcap-format capture of TCP packets between Squid
and ICAP server (but be careful with what you share on the list).



More information about the squid-users mailing list