]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix request headers logging for icap_log
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Tue, 11 Jun 2013 14:55:34 +0000 (08:55 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 11 Jun 2013 14:55:34 +0000 (08:55 -0600)
The %http::>h does not print the original request headers but the adapted
request headers. Also the %http::>ha does not print adapted headers.

src/adaptation/icap/ModXact.cc

index a6d3259d70331f6468638e64d194894e478773e7..1520dfce7dead9341ee8d6421aa72f9a85ab392f 100644 (file)
@@ -1254,9 +1254,11 @@ void prepareLogWithRequestDetails(HttpRequest *, AccessLogEntry::Pointer &);
 void Adaptation::Icap::ModXact::finalizeLogInfo()
 {
     HttpRequest * request_ = NULL;
+    HttpRequest * adapted_request_ = NULL;
     HttpReply * reply_ = NULL;
-    if (!(request_ = dynamic_cast<HttpRequest*>(adapted.header))) {
-        request_ = (virgin.cause? virgin.cause: dynamic_cast<HttpRequest*>(virgin.header));
+    request_ = (virgin.cause? virgin.cause: dynamic_cast<HttpRequest*>(virgin.header));
+    if (!(adapted_request_ = dynamic_cast<HttpRequest*>(adapted.header))) {
+        adapted_request_ = request_;
         reply_ = dynamic_cast<HttpReply*>(adapted.header);
     }
 
@@ -1270,6 +1272,8 @@ void Adaptation::Icap::ModXact::finalizeLogInfo()
     al.cache.caddr = request_->client_addr;
 
     al.request = HTTPMSGLOCK(request_);
+    al.adapted_request = HTTPMSGLOCK(adapted_request_);
+
     if (reply_)
         al.reply = HTTPMSGLOCK(reply_);
     else
@@ -1313,7 +1317,7 @@ void Adaptation::Icap::ModXact::finalizeLogInfo()
         packerClean(&p);
         mb.clean();
     }
-    prepareLogWithRequestDetails(request_, alep);
+    prepareLogWithRequestDetails(adapted_request_, alep);
     Xaction::finalizeLogInfo();
 }