When the first ICAP service in a chain respond with 204 the next service
is aborted on Must(old_request->canonical) expression inside Adaptation::Icap::ModXact::encapsulateHead method.
Squid ICAP try to set the request::canonical member of the adapted request
inside Adaptation::Icap::ModXact::prepEchoing when the 204 response received.
The adapted.header->parse(..) call some lines after will set canonical member
to NULL.
This patch calls the urlCanonical() function after parse() method
to build canonical member for the adapted request, instead of trying to copy
this member from the original request.
Must(!adapted.header);
{
HttpMsg::Pointer newHead;
- if (const HttpRequest *oldR = dynamic_cast<const HttpRequest*>(oldHead)) {
+ if (dynamic_cast<const HttpRequest*>(oldHead)) {
HttpRequest::Pointer newR(new HttpRequest);
- newR->canonical = oldR->canonical ?
- xstrdup(oldR->canonical) : NULL; // parse() does not set it
newHead = newR;
} else if (dynamic_cast<const HttpReply*>(oldHead)) {
newHead = new HttpReply;
Must(adapted.header->parse(&httpBuf, true, &error));
+ if (HttpRequest *r = dynamic_cast<HttpRequest*>(adapted.header))
+ urlCanonical(r); // parse does not set HttpRequest::canonical
+
Must(adapted.header->hdr_sz == httpBuf.contentSize()); // no leftovers
httpBuf.clean();