]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Log '-' on requests with no Referer or User-Agent headers
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 27 Feb 2012 10:03:03 +0000 (03:03 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 27 Feb 2012 10:03:03 +0000 (03:03 -0700)
This data is actually meaningful for the analysis of client behaviour.

squid-dev have agreed that it is worth removing the old log behaviour of
omitting these entries.

src/log/FormatSquidReferer.cc
src/log/FormatSquidUseragent.cc

index a498af9b49aa33219af453f63bf6f9cd35b3779f..0c7236d2a42c4d02b51e426cd08f11b35147d318 100644 (file)
 void
 Log::Format::SquidReferer(AccessLogEntry *al, Logfile *logfile)
 {
-    // do not log unless there is something to be displayed
-    if (!al || !al->request)
-        return;
+    const char *referer = NULL;
+    if (al && al->request)
+        referer = al->request->header.getStr(HDR_REFERER);
 
-    const char *referer = al->request->header.getStr(HDR_REFERER);
-
-    // do not log unless there is something to be displayed
     if (!referer || *referer == '\0')
-        return;
+        referer = "-";
 
     char clientip[MAX_IPSTRLEN];
     al->getLogClientIp(clientip, MAX_IPSTRLEN);
index 470629e1f4f49c6238fe6111a5a14eccce74f97c..bfe3245e874b0d962c1aa46ee8975e74b168fe9e 100644 (file)
 void
 Log::Format::SquidUserAgent(AccessLogEntry * al, Logfile * logfile)
 {
-    // do not log unless there is something to be displayed.
-    if (!al || !al->request)
-        return;
+    const char *agent = NULL;
 
-    const char *agent = al->request->header.getStr(HDR_USER_AGENT);
+    if (al && al->request)
+        agent = al->request->header.getStr(HDR_USER_AGENT);
 
-    // do not log unless there is something to be displayed.
     if (!agent || *agent == '\0')
-        return;
+        agent = "-";
 
     char clientip[MAX_IPSTRLEN];
     al->getLogClientIp(clientip, MAX_IPSTRLEN);