]> 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 09:55:05 +0000 (12:55 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Tue, 11 Jun 2013 09:55:05 +0000 (12:55 +0300)
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 47c781e25285534d9bb6395d7ff8d339865ecdcd..71203b4dbd726917fc7333cb5076b27b6beee56b 100644 (file)
@@ -1253,9 +1253,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,9 @@ void Adaptation::Icap::ModXact::finalizeLogInfo()
 
     al.request = request_;
     HTTPMSGLOCK(al.request);
+    al.adapted_request = adapted_request_;
+    HTTPMSGLOCK(al.adapted_request);
+
     if (reply_) {
         al.reply = reply_;
         HTTPMSGLOCK(al.reply);
@@ -1314,7 +1319,7 @@ void Adaptation::Icap::ModXact::finalizeLogInfo()
         packerClean(&p);
         mb.clean();
     }
-    prepareLogWithRequestDetails(request_, alep);
+    prepareLogWithRequestDetails(adapted_request_, alep);
     Xaction::finalizeLogInfo();
 }