]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1513 Some 206 responses logged incorrectly
authorwessels <>
Sat, 18 Feb 2006 07:04:30 +0000 (07:04 +0000)
committerwessels <>
Sat, 18 Feb 2006 07:04:30 +0000 (07:04 +0000)
Fortunately the AccessLog class already had the HttpReply. We just need
to use it and for good meaure, lock and unlock it.

src/access_log.cc
src/client_side.cc

index cbee3165d9b08f14ed156b77aa4fc61c18410daa..73b939fccc2c79372a930055720b30a78c424914 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.cc,v 1.108 2006/02/17 18:10:59 wessels Exp $
+ * $Id: access_log.cc,v 1.109 2006/02/18 00:04:30 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -1786,11 +1786,7 @@ accessLogFreeMemory(AccessLogEntry * aLogEntry)
     safe_free(aLogEntry->headers.reply);
     safe_free(aLogEntry->cache.authuser);
 
-    if (aLogEntry->reply) {
-        delete aLogEntry->reply;
-        aLogEntry->reply = NULL;
-    }
-
+    HTTPMSGUNLOCK(aLogEntry->reply);
     HTTPMSGUNLOCK(aLogEntry->request);
 }
 
index 5781554b336bcf0daf38221d0818626240a1a524..1307c9fef96cc790b32dc3514132308027c380fb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.711 2006/02/17 20:59:31 wessels Exp $
+ * $Id: client_side.cc,v 1.712 2006/02/18 00:04:30 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -486,16 +486,25 @@ ClientHttpRequest::logRequest()
         al.url = log_uri;
         debug(33, 9) ("clientLogRequest: al.url='%s'\n", al.url);
 
-        if (loggingEntry() && loggingEntry()->mem_obj) {
+        if (al.reply) {
+            al.http.code = al.reply->sline.status;
+            al.http.content_type = al.reply->content_type.buf();
+        } else if (loggingEntry() && loggingEntry()->mem_obj) {
             al.http.code = loggingEntry()->mem_obj->getReply()->sline.status;
             al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.buf();
-            al.cache.objectSize = contentLen(loggingEntry());
         }
 
+        if (loggingEntry() && loggingEntry()->mem_obj)
+            al.cache.objectSize = contentLen(loggingEntry());
+
         al.cache.caddr = getConn().getRaw() != NULL ? getConn()->log_addr : no_addr;
+
         al.cache.size = out.size;
+
         al.cache.highOffset = out.offset;
+
         al.cache.code = logType;
+
         al.cache.msec = tvSubMsec(start, current_time);
 
         if (request)
@@ -1247,7 +1256,7 @@ clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http,
     if (!context->startOfOutput())
         context->sendBody(rep, recievedData);
     else {
-        http->al.reply = rep;
+        http->al.reply = HTTPMSGLOCK(rep);
         context->sendStartOfMessage(rep, recievedData);
     }
 }