From: wessels <> Date: Sat, 30 Mar 1996 07:09:02 +0000 (+0000) Subject: Major rewrite of logging. Now log accesses when the client data X-Git-Tag: SQUID_3_0_PRE1~6333 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6350239ff4cf4bc87d0af6ea9c2e1c33a95a8914;p=thirdparty%2Fsquid.git Major rewrite of logging. Now log accesses when the client data 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. --- diff --git a/src/errorpage.cc b/src/errorpage.cc index b73af98667..9aa1c3cb97 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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; } diff --git a/src/http.cc b/src/http.cc index e7fd8b24c7..1bcb58f2c3 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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); diff --git a/src/squid.h b/src/squid.h index fda3ed4319..f5b002b5f1 100644 --- a/src/squid.h +++ b/src/squid.h @@ -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"