[squid-dev] is this really an ICAP 206 response "protocol error", if so what?

Alex Rousskov rousskov at measurement-factory.com
Fri Nov 13 01:54:49 UTC 2015


On 11/12/2015 05:27 PM, Eliezer Croitoru wrote:

> What I have found is an exception in the logs which results in
> "ICAP_ERR_OTHER" but I am unable to understand what the issue is.
> 
> The lines from the log are:
> 2015/11/13 01:47:22.072 kid1| 0,3| TextException.cc(87) Throw:
> ModXact.cc:918: exception: state.allowedPostview206


The code on that line is pretty clear IMO:

> void Adaptation::Icap::ModXact::handle206PartialContent()
> {
> if (state.writing == State::writingPaused) {
>     Must(preview.enabled());
>     Must(state.allowedPreview206);
>     debugs(93, 7, HERE << "206 inside preview");
> } else {
>     Must(state.writing > State::writingPaused);
>     Must(state.allowedPostview206);
>     debugs(93, 7, HERE << "206 outside preview");
> }


The state.allowedPostview206 exception means that Squid thinks that the
following are all true:

1. Squid received ICAP 206 response;
2. Squid received a response outside of Preview; and
3. Squid did _not_ allow 206 outside of Preview.

You need to figure out which of those three assumptions are false.

If you start digging around, you may eventually find that Squid did not
allow your service to send a 206 response in the first place:

> RESPMOD icap://127.0.0.2:1344/allow_cache ICAP/1.0
> Encapsulated: req-hdr=0, res-hdr=144, null-body=444
> Allow: 204

but your service did anyway:

> ICAP/1.0 206 Partial Content
> Encapsulated: res-hdr=0, res-body=331

There are other problems with your service response. For example, it
tells Squid to use a body (use-original-body=0) that Squid said does not
exist (null-body).

As I have mentioned before, writing a high-quality ICAP service is more
difficult than it may seem. Correctly handling 206 transactions is even
more so.


As a consolation prize, consider reproducing and filing a bug report
against Squid as well: AFAICT, the state.writing == State::writingPaused
condition in handle206PartialContent() is wrong because when there is no
HTTP message body at all, Squid may be in Preview state (from the ICAP
point of view), but state.writing will not be State::writingPaused. It
will be State::writingReallyDone AFAICT. Your logs seem to confirm that.


HTH,

Alex.
P.S. Please do not use .gz extension for bzip2-compressed files.



More information about the squid-dev mailing list