]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/adaptation/icap/icap_log.cc
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / adaptation / icap / icap_log.cc
index 80470480d3d29191b329f0f24ce5a6be464ba29c..44522f375242304b0493787d18954015656b81b6 100644 (file)
@@ -1,6 +1,17 @@
+/*
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #include "squid.h"
-#include "icap_log.h"
 #include "AccessLogEntry.h"
+#include "acl/FilledChecklist.h"
+#include "globals.h"
+#include "HttpReply.h"
+#include "icap_log.h"
 #include "log/CustomLog.h"
 #include "log/File.h"
 #include "log/Formats.h"
@@ -17,7 +28,7 @@ icapLogOpen()
         if (log->type == Log::Format::CLF_NONE)
             continue;
 
-        log->logfile = logfileOpen(log->filename, MAX_URL << 1, 1);
+        log->logfile = logfileOpen(log->filename, log->bufferSize, log->fatal);
 
         IcapLogfileStatus = LOG_ENABLE;
     }
@@ -31,7 +42,7 @@ icapLogClose()
     for (log = Config.Log.icaplogs; log; log = log->next) {
         if (log->logfile) {
             logfileClose(log->logfile);
-            log->logfile = NULL;
+            log->logfile = nullptr;
         }
     }
 }
@@ -41,13 +52,20 @@ icapLogRotate()
 {
     for (CustomLog* log = Config.Log.icaplogs; log; log = log->next) {
         if (log->logfile) {
-            logfileRotate(log->logfile);
+            logfileRotate(log->logfile, Config.Log.rotateNumber);
         }
     }
 }
 
-void icapLogLog(AccessLogEntry::Pointer &al, ACLChecklist * checklist)
+void icapLogLog(AccessLogEntry::Pointer &al)
 {
-    if (IcapLogfileStatus == LOG_ENABLE)
-        accessLogLogTo(Config.Log.icaplogs, al, checklist);
+    if (IcapLogfileStatus == LOG_ENABLE) {
+        ACLFilledChecklist checklist(nullptr, al->adapted_request, nullptr);
+        if (al->reply) {
+            checklist.reply = al->reply.getRaw();
+            HTTPMSGLOCK(checklist.reply);
+        }
+        accessLogLogTo(Config.Log.icaplogs, al, &checklist);
+    }
 }
+