From 96f39461d2126332e7767df6af546b1000699787 Mon Sep 17 00:00:00 2001 From: Christos Tsantilas Date: Thu, 22 Dec 2011 00:19:32 -0700 Subject: [PATCH] Bug 3448: 204 response problem in adaptation chains 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. --- src/adaptation/icap/ModXact.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/adaptation/icap/ModXact.cc b/src/adaptation/icap/ModXact.cc index d769dd1cd8..0451714b0f 100644 --- a/src/adaptation/icap/ModXact.cc +++ b/src/adaptation/icap/ModXact.cc @@ -945,10 +945,8 @@ void Adaptation::Icap::ModXact::prepEchoing() Must(!adapted.header); { HttpMsg::Pointer newHead; - if (const HttpRequest *oldR = dynamic_cast(oldHead)) { + if (dynamic_cast(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(oldHead)) { newHead = new HttpReply; @@ -965,6 +963,9 @@ void Adaptation::Icap::ModXact::prepEchoing() Must(adapted.header->parse(&httpBuf, true, &error)); + if (HttpRequest *r = dynamic_cast(adapted.header)) + urlCanonical(r); // parse does not set HttpRequest::canonical + Must(adapted.header->hdr_sz == httpBuf.contentSize()); // no leftovers httpBuf.clean(); -- 2.47.2