From 90a8964c0bf9762d1dd442cc35b1ac25f8b5771e Mon Sep 17 00:00:00 2001 From: wessels <> Date: Sat, 18 Feb 2006 07:04:30 +0000 Subject: [PATCH] Bug #1513 Some 206 responses logged incorrectly 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 | 8 ++------ src/client_side.cc | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/access_log.cc b/src/access_log.cc index cbee3165d9..73b939fccc 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -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); } diff --git a/src/client_side.cc b/src/client_side.cc index 5781554b33..1307c9fef9 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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); } } -- 2.47.3