]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Major rewrite of logging. Now log accesses when the client data
authorwessels <>
Sat, 30 Mar 1996 07:09:02 +0000 (07:09 +0000)
committerwessels <>
Sat, 30 Mar 1996 07:09:02 +0000 (07:09 +0000)
structure (icpStateData) gets destroyed.  TCP_DONE is gone and
TCP_MISS is now logged when the request completes and has a valid
size.  Made some adjustments to get error logging working also.
Had to add 'abort_code' element to the StoreEntry Mem_Obj structure.

src/errorpage.cc
src/http.cc
src/squid.h

index b73af98667493925334dd6d739c2872f37263aa1..9aa1c3cb97541861180a749b6c44df10409d844e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: errorpage.cc,v 1.6 1996/03/29 21:15:23 wessels Exp $ */
+/* $Id: errorpage.cc,v 1.7 1996/03/30 00:09:02 wessels Exp $ */
 
 /* DEBUG: Section 4             cached_error: Error printing routines */
 
@@ -105,57 +105,54 @@ int log_errors = 1;
 
 void cached_error_entry(entry, type, msg)
      StoreEntry *entry;
-     error_t type;
+     int type;
      char *msg;
 {
-    if (type == ERR_NONE || type > ERR_MAX)
-       return;
+    int index;
+    if (type < ERR_MIN || type > ERR_MAX)
+       fatal_dump("cached_error_entry: type out of range.");
+    index = (int) (type - ERR_MIN);
     sprintf(tmp_error_buf, CACHED_ERROR_MSG_P1,
        entry->url,
        entry->url,
-       ErrorData[type].shrt);
+       ErrorData[index].shrt);
     if (msg) {
        sprintf(tbuf, CACHED_ERROR_MSG_P2, msg);
        strcat(tmp_error_buf, tbuf);
     }
     sprintf(tbuf, CACHED_ERROR_MSG_P3,
-       ErrorData[type].lng,
+       ErrorData[index].lng,
        SQUID_VERSION,
        getMyHostname());
     strcat(tmp_error_buf, tbuf);
+    entry->mem_obj->abort_code = type;
     storeAbort(entry, tmp_error_buf);
-    if (!log_errors)
-       return;
-    CacheInfo->log_append(CacheInfo,
-       entry->url,
-       "0.0.0.0",
-       entry->mem_obj->e_current_len,
-       ErrorData[type].tag,
-       "GET");
 }
 
 
 
 char *cached_error_url(url, type, msg)
      char *url;
-     error_t type;
+     int type;
      char *msg;
 {
-    tmp_error_buf[0] = '\0';
+    int index;
 
-    if (type == ERR_NONE || type > ERR_MAX)
-       return tmp_error_buf;
+    tmp_error_buf[0] = '\0';
+    if (type == ERR_MIN || type > ERR_MAX)
+       fatal_dump("cached_error_url: type out of range.");
+    index = (int) (type - ERR_MIN);
     sprintf(tmp_error_buf, CACHED_ERROR_MSG_P1,
        url,
        url,
-       ErrorData[type].shrt);
+       ErrorData[index].shrt);
 
     if (msg) {
        sprintf(tbuf, CACHED_ERROR_MSG_P2, msg);
        strcat(tmp_error_buf, tbuf);
     }
     sprintf(tbuf, CACHED_ERROR_MSG_P3,
-       ErrorData[type].lng,
+       ErrorData[index].lng,
        SQUID_VERSION,
        getMyHostname());
     if (!log_errors)
@@ -164,7 +161,7 @@ char *cached_error_url(url, type, msg)
        url,
        "0.0.0.0",
        0,
-       ErrorData[type].tag,
+       ErrorData[index].tag,
        "GET");
     return tmp_error_buf;
 }
index e7fd8b24c72400ff11dc6ef55483d6dd6f4feefc..1bcb58f2c3c653ba408725fecedc5e0aeacee195 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: http.cc,v 1.15 1996/03/29 21:19:21 wessels Exp $ */
+/* $Id: http.cc,v 1.16 1996/03/30 00:09:04 wessels Exp $ */
 
 /*
  * DEBUG: Section 11          http: HTTP
@@ -450,7 +450,10 @@ void httpConnInProgress(fd, data)
 {
     StoreEntry *entry = data->entry;
 
-    if (comm_connect(fd, data->host, data->port) != COMM_OK)
+    debug(11, 5, "httpConnInProgress: FD %d data=%p\n", fd, data);
+
+    if (comm_connect(fd, data->host, data->port) != COMM_OK) {
+       debug(11, 5, "httpConnInProgress: FD %d errno=%d\n", fd, errno);
        switch (errno) {
        case EINPROGRESS:
        case EALREADY:
@@ -467,6 +470,7 @@ void httpConnInProgress(fd, data)
            httpCloseAndFree(fd, data);
            return;
        }
+    }
     /* Call the real write handler, now that we're fully connected */
     comm_set_select_handler(fd, COMM_SELECT_WRITE,
        (PF) httpSendRequest, (caddr_t) data);
index fda3ed4319e28f7bc23026c18b73a848a83f5e63..f5b002b5f1704e7add688e12946bf28eeb15ca62 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $Id: squid.h,v 1.6 1996/03/28 05:21:28 wessels Exp $ */
+/* $Id: squid.h,v 1.7 1996/03/30 00:09:05 wessels Exp $ */
 
 #include "config.h"
 #include "autoconf.h"
@@ -89,7 +89,6 @@ typedef unsigned long u_num32;
 #include "ansihelp.h"
 #include "blocklist.h"
 #include "cache_cf.h"
-#include "cached_error.h"
 #include "comm.h"
 #include "debug.h"
 #include "disk.h"
@@ -99,7 +98,7 @@ typedef unsigned long u_num32;
 #include "hash.h"
 #include "proto.h"
 #include "icp.h"
-#include "icp_lib.h"
+#include "cached_error.h"      /* must go after icp.h */
 #include "ipcache.h"
 #include "mime.h"
 #include "neighbors.h"