]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove dead "binary HTTP header logging" code (-DHEADERS_LOG) (#1319)
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 3 Apr 2023 22:14:26 +0000 (22:14 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 4 Apr 2023 02:57:20 +0000 (02:57 +0000)
The secret HEADERS_LOG hack was added in 2000 commit c360932 to collect
"better stats" than mgr:http_headers. The corresponding access_log.cc
code does not build since 2006 commit 985c86b (at least):

* 'm' was not declared in this scope
* cannot convert 'int*' to 'const char*'
* cannot convert 'short unsigned int*' to 'const char*'
* invalid conversion from 'unsigned char*' to 'const char*'
* invalid conversion from 'void*' to 'HttpReply*'
* invalid conversion from 'void*' to 'HttpRequest*'
* invalid use of incomplete type 'class HttpHdrCc'
* too few arguments to function 'logfileOpen(const char*, size_t, int)'

The removed hack is not to be confused with log_mime_hdrs directive.

doc/release-notes/release-7.sgml.in
src/client_side_request.cc
src/esi/Include.cc
src/http.cc
src/http/Stream.cc
src/log/access_log.cc
src/log/access_log.h
src/tests/stub_liblog.cc

index 0955ace31f5a8eeabf912f21c399524c6fb397cf..ecb5b90267ff2afcfe61ca7131ae108571d775cc 100644 (file)
@@ -97,7 +97,9 @@ This section gives an account of those changes in three categories:
 <sect1>Removed options<label id="removedoptions">
 <p>
 <descrip>
-       <p>No removed options in this version.
+       <tag>CPPFLAGS=-DHEADERS_LOG</tag>
+       <p>The code enabled by this preprocessor macro has not built for many
+          years, indicating that the feature is unused.
 
 </descrip>
 
index 5f7b8bdc56a26711a995939b57d19342c22162b1..0643dbca6152e8aae0518388ffb726a52dacc956 100644 (file)
@@ -1838,10 +1838,6 @@ ClientHttpRequest::doCallouts()
     cbdataReferenceDone(calloutContext->http);
     delete calloutContext;
     calloutContext = nullptr;
-#if HEADERS_LOG
-
-    headersLog(0, 1, request->method, request);
-#endif
 
     debugs(83, 3, "calling processRequest()");
     processRequest();
index f340c6f59ca6f335d8e5c89eb98c5ab244dc943d..dad4b4df15d3e51f15ed3e20289b416d32b2163b 100644 (file)
@@ -97,11 +97,6 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply *
                 return;
             }
 
-#if HEADERS_LOG
-            /* should be done in the store rather than every recipient?  */
-            headersLog(0, 0, http->request->method, rep);
-
-#endif
             rep = nullptr;
         }
     }
index 141305249de08e81255ec00cbf405b90b7757bf3..70cef385ce77b50f81634a0529dabd6113e50ad1 100644 (file)
@@ -1057,11 +1057,6 @@ HttpStateData::haveParsedReplyHeaders()
         }
 #endif
     }
-
-#if HEADERS_LOG
-    headersLog(1, 0, request->method, rep);
-
-#endif
 }
 
 HttpStateData::ConnectionStatus
index 542c2933328fe3a163a564a5b7c7cdda928347fd..1912d4f113c2bed97899a7666854f955295f2e73 100644 (file)
@@ -275,9 +275,6 @@ Http::Stream::sendStartOfMessage(HttpReply *rep, StoreIOBuffer bodyData)
 
     /* Save length of headers for persistent conn checks */
     http->out.headers_sz = mb->contentSize();
-#if HEADERS_LOG
-    headersLog(0, 0, http->request->method, rep);
-#endif
 
     if (bodyData.data && bodyData.length) {
         if (multipartRangeRequest())
index b268a379f12254143c4a383e13f29ca864b01318..ad124dd2eccf802c21d1ce52db8162aa4592ea90 100644 (file)
 
 #include <unordered_map>
 
-#if HEADERS_LOG
-static Logfile *headerslog = NULL;
-#endif
-
 #if MULTICAST_MISS_STREAM
 static int mcast_miss_fd = -1;
 
@@ -190,12 +186,6 @@ accessLogRotate(void)
     for (log = Config.Log.accesslogs; log; log = log->next) {
         log->rotate();
     }
-
-#if HEADERS_LOG
-
-    logfileRotate(headerslog, Config.Log.rotateNumber);
-
-#endif
 }
 
 void
@@ -209,14 +199,6 @@ accessLogClose(void)
             log->logfile = nullptr;
         }
     }
-
-#if HEADERS_LOG
-
-    logfileClose(headerslog);
-
-    headerslog = NULL;
-
-#endif
 }
 
 HierarchyLogEntry::HierarchyLogEntry() :
@@ -401,13 +383,6 @@ accessLogInit(void)
 #endif
     }
 
-#if HEADERS_LOG
-
-    headerslog = logfileOpen("/usr/local/squid/logs/headers.log", 512);
-
-    assert(NULL != headerslog);
-
-#endif
 #if MULTICAST_MISS_STREAM
 
     if (Config.mcast_miss.addr.s_addr != no_addr.s_addr) {
@@ -530,58 +505,3 @@ mcast_encode(unsigned int *ibuf, size_t isize, const unsigned int *key)
 
 #endif
 
-#if HEADERS_LOG
-void
-headersLog(int cs, int pq, const HttpRequestMethod& method, void *data)
-{
-    HttpReply *rep;
-    HttpRequest *req;
-    unsigned short magic = 0;
-    unsigned char M = (unsigned char) m;
-    char *hmask;
-    int ccmask = 0;
-
-    if (0 == pq) {
-        /* reply */
-        rep = data;
-        req = NULL;
-        magic = 0x0050;
-        hmask = rep->header.mask;
-
-        if (rep->cache_control)
-            ccmask = rep->cache_control->mask;
-    } else {
-        /* request */
-        req = data;
-        rep = NULL;
-        magic = 0x0051;
-        hmask = req->header.mask;
-
-        if (req->cache_control)
-            ccmask = req->cache_control->mask;
-    }
-
-    if (0 == cs) {
-        /* client */
-        magic |= 0x4300;
-    } else {
-        /* server */
-        magic |= 0x5300;
-    }
-
-    magic = htons(magic);
-    ccmask = htonl(ccmask);
-
-    unsigned short S = 0;
-    if (0 == pq)
-        S = static_cast<unsigned short>(rep->sline.status());
-
-    logfileWrite(headerslog, &magic, sizeof(magic));
-    logfileWrite(headerslog, &M, sizeof(M));
-    logfileWrite(headerslog, &S, sizeof(S));
-    logfileWrite(headerslog, hmask, sizeof(HttpHeaderMask));
-    logfileWrite(headerslog, &ccmask, sizeof(int));
-}
-
-#endif
-
index b5648dcb0c9cff62a14adede306fe87c41d96d43..f127c9b4d20d51de715534b99c9535d5c91c7c52 100644 (file)
@@ -20,10 +20,5 @@ void fvdbCountVia(const SBuf &);
 /// count occurrences of the given X-Forwarded-For header value
 void fvdbCountForwarded(const SBuf &);
 
-#if HEADERS_LOG
-class HttpRequestMethod;
-void headersLog(int cs, int pq, const HttpRequestMethod& m, void *data);
-#endif
-
 #endif /* SQUID_LOG_ACCESS_LOG_H_ */
 
index 321472597677cb443ee8f2f50056632f6e0a238f..ec0eb5f86e557fd120c96decaccf789513673f8c 100644 (file)
@@ -32,9 +32,6 @@ const char *accessLogTime(time_t) STUB_RETVAL(nullptr)
 
 #include "log/access_log.h"
 void fvdbCountVia(const SBuf &) STUB
-#if HEADERS_LOG
-void headersLog(int, int, const HttpRequestMethod &, void *) STUB
-#endif
 
 #include "log/Config.h"
 namespace Log