]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
clean up access logging, remove lots of Cacheinfo garbage
authorwessels <>
Sat, 21 Jun 1997 08:38:03 +0000 (08:38 +0000)
committerwessels <>
Sat, 21 Jun 1997 08:38:03 +0000 (08:38 +0000)
Need to relocate enums to an enums.h file, too many other wierd
dependencies.

src/Makefile.in
src/cache_cf.cc
src/main.cc
src/neighbors.cc
src/peer_select.cc
src/squid.h
src/stat.cc
src/tools.cc
src/url.cc

index a2379f4e923c0c2c92b43a0adfccb05ca9b1eaf0..a32f463ed04def60d79f907b421e1c64de73074c 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.77 1997/06/18 00:19:50 wessels Exp $
+#  $Id: Makefile.in,v 1.78 1997/06/21 02:38:03 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -74,6 +74,7 @@ UTILS           = dnsserver unlinkd
 SUID_UTILS     = pinger
 CGIPROGS       = cachemgr.cgi
 OBJS           = \
+               access_log.o \
                acl.o \
                aiops.o \
                async_io.o \
index af827c675e484a4591bb588cdfb5919806183204..7b490bd6bb73e338aa5de5b01699854e693392c3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.196 1997/06/04 06:15:46 wessels Exp $
+ * $Id: cache_cf.cc,v 1.197 1997/06/21 02:38:04 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -167,9 +167,7 @@ struct SquidConfig Config;
 #define DefaultAccelWithProxy  0       /* default off */
 #define DefaultSourcePing      0       /* default off */
 #define DefaultCommonLogFormat 0       /* default off */
-#if LOG_FULL_HEADERS
 #define DefaultLogMimeHdrs     0       /* default off */
-#endif /* LOG_FULL_HEADERS */
 #define DefaultIdentLookup     0       /* default off */
 #define DefaultQuickAbortMin   -1      /* default off */
 #define DefaultQuickAbortPct   0       /* default off */
@@ -1065,10 +1063,8 @@ parseConfigFile(const char *file_name)
        else if (!strcmp(token, "emulate_httpd_log"))
            parseOnOff(&Config.commonLogFormat);
 
-#if LOG_FULL_HEADERS
        else if (!strcmp(token, "log_mime_hdrs"))
            parseOnOff(&Config.logMimeHdrs);
-#endif /* LOG_FULL_HEADERS */
 
        else if (!strcmp(token, "ident_lookup"))
            parseOnOff(&Config.identLookup);
@@ -1329,9 +1325,7 @@ configSetFactoryDefaults(void)
     Config.quickAbort.pct = DefaultQuickAbortPct;
     Config.quickAbort.max = DefaultQuickAbortMax;
     Config.commonLogFormat = DefaultCommonLogFormat;
-#if LOG_FULL_HEADERS
     Config.logMimeHdrs = DefaultLogMimeHdrs;
-#endif /* LOG_FULL_HEADERS */
     Config.identLookup = DefaultIdentLookup;
     Config.debugOptions = safe_xstrdup(DefaultDebugOptions);
     Config.neighborTimeout = DefaultNeighborTimeout;
index 21c9883e07e5753c5a9230cb49a120d747df9d4c..9daa2550c7e352fbc8a37b0b8404a38288ee28de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.155 1997/06/18 00:19:57 wessels Exp $
+ * $Id: main.cc,v 1.156 1997/06/21 02:38:09 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -682,7 +682,7 @@ main(int argc, char **argv)
            _db_rotate_log();   /* cache.log */
            storeWriteCleanLogs();
            storeRotateLog();   /* store.log */
-           stat_rotate_log();  /* access.log */
+           accessLogRotate();  /* access.log */
            useragentRotateLog();       /* useragent.log */
            icmpOpen();
            rotate_pending = 0;
index 0185c859373c197f1e589827572a88b08eec96ef..f51f87017eea4f0fea2957645ea9678f0500af65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.146 1997/06/18 00:19:58 wessels Exp $
+ * $Id: neighbors.cc,v 1.147 1997/06/21 02:38:10 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -171,21 +171,6 @@ whichPeer(const struct sockaddr_in *from)
     return NULL;
 }
 
-void
-hierarchyNote(request_t * request,
-    hier_code code,
-    icp_ping_data * icpdata,
-    const char *cache_host)
-{
-    if (request == NULL)
-       return;
-    request->hierarchy.code = code;
-    if (icpdata)
-       request->hierarchy.icp = *icpdata;
-    request->hierarchy.host = xstrdup(cache_host);
-    request->hierarchy.icp.stop = current_time;
-}
-
 static peer_t
 neighborType(const peer * p, const request_t * request)
 {
index 6ac01aa57d44b40c2b410f92153c7e860ec93371..d3c5959a2004f8500d6fde83638d95cd4b4738b3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.14 1997/06/18 00:20:01 wessels Exp $
+ * $Id: peer_select.cc,v 1.15 1997/06/21 02:38:13 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -245,7 +245,7 @@ peerSelectFoo(ps_state * psstate)
     debug(44, 3) ("peerSelect: direct = %d\n", direct);
     if (direct == DIRECT_YES) {
        debug(44, 3) ("peerSelect: DIRECT\n");
-       hierarchyNote(request, DIRECT, &psstate->icp, request->host);
+       hierarchyNote(&request->hier, DIRECT, &psstate->icp, request->host);
        peerSelectCallback(psstate, NULL);
        return;
     }
@@ -271,20 +271,20 @@ peerSelectFoo(ps_state * psstate)
     if ((p = psstate->first_parent_miss)) {
        code = FIRST_PARENT_MISS;
        debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
-       hierarchyNote(request, code, &psstate->icp, p->host);
+       hierarchyNote(&request->hier, code, &psstate->icp, p->host);
        peerSelectCallback(psstate, p);
     } else if (direct != DIRECT_NO) {
        code = DIRECT;
        debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], request->host);
-       hierarchyNote(request, code, &psstate->icp, request->host);
+       hierarchyNote(&request->hier, code, &psstate->icp, request->host);
        peerSelectCallback(psstate, NULL);
     } else if ((p = peerGetSomeParent(request, &code))) {
        debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
-       hierarchyNote(request, code, &psstate->icp, p->host);
+       hierarchyNote(&request->hier, code, &psstate->icp, p->host);
        peerSelectCallback(psstate, p);
     } else {
        code = NO_DIRECT_FAIL;
-       hierarchyNote(request, code, &psstate->icp, NULL);
+       hierarchyNote(&request->hier, code, &psstate->icp, NULL);
        peerSelectCallbackFail(psstate);
     }
 }
@@ -324,14 +324,14 @@ peerHandleIcpReply(peer * p, peer_t type, icp_opcode op, void *data)
            }
        }
     } else if (op == ICP_OP_HIT || op == ICP_OP_HIT_OBJ) {
-       hierarchyNote(request,
+       hierarchyNote(&request->hier,
            type == PEER_PARENT ? PARENT_HIT : SIBLING_HIT,
            &psstate->icp,
            p->host);
        peerSelectCallback(psstate, p);
        return;
     } else if (op == ICP_OP_SECHO) {
-       hierarchyNote(request,
+       hierarchyNote(&request->hier,
            SOURCE_FASTEST,
            &psstate->icp,
            request->host);
index 30b5e7f90c27c43a6bbb1c5c17b8f4a6d1ab84a2..27c1556191f85d28748b8a7df3f47ea48ac5a63e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.123 1997/06/20 00:00:14 wessels Exp $
+ * $Id: squid.h,v 1.124 1997/06/21 02:38:15 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -236,6 +236,8 @@ typedef struct _cachemgr_passwd cachemgr_passwd;
 typedef struct _fileMap fileMap;
 typedef struct _cwstate CommWriteStateData;
 typedef struct _ipcache_addrs ipcache_addrs;
+typedef struct _AccessLogEntry AccessLogEntry;
+typedef struct _HierarchyLogEntry HierarchyLogEntry;
 
 /* 32 bit integer compatability hack */
 #if SIZEOF_INT == 4
@@ -271,6 +273,7 @@ typedef void SIH _PARAMS((void *, int));    /* swap in */
 typedef int QS _PARAMS((const void *, const void *));  /* qsort */
 typedef void STCB _PARAMS((void *, char *, ssize_t));  /* store callback */
 
+#include "enums.h"
 #include "cache_cf.h"
 #include "fd.h"
 #include "comm.h"
@@ -281,6 +284,7 @@ typedef void STCB _PARAMS((void *, char *, ssize_t));       /* store callback */
 #include "proto.h"             /* must go before neighbors.h */
 #include "peer_select.h"       /* must go before neighbors.h */
 #include "neighbors.h"         /* must go before url.h */
+#include "access_log.h"
 #include "url.h"
 #include "icp.h"
 #include "errorpage.h"         /* must go after icp.h */
index a1fa9fc629bd099dc50be25f3bd62e3157777b5c..2d07d059b6d0a7a7bfd44c452e3b63505750c093 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.144 1997/06/20 05:08:32 wessels Exp $
+ * $Id: stat.cc,v 1.145 1997/06/21 02:38:16 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -134,24 +134,16 @@ extern int fileno_stack_count;
 static const char *describeStatuses _PARAMS((const StoreEntry *));
 static const char *describeFlags _PARAMS((const StoreEntry *));
 static const char *describeTimestamps _PARAMS((const StoreEntry *));
-static FILE_WALK_HD logReadEndHandler;
 static void proto_count _PARAMS((cacheinfo *, protocol_t, log_type));
 static void proto_newobject _PARAMS((cacheinfo *, protocol_t, int, int));
 static void proto_purgeobject _PARAMS((cacheinfo *, protocol_t, int));
 static void proto_touchobject _PARAMS((cacheinfo *, protocol_t, int));
-static FILE_WALK_HD squidReadEndHandler;
 static void statFiledescriptors _PARAMS((StoreEntry *));
 static void stat_io_get _PARAMS((StoreEntry *));
 static void stat_objects_get _PARAMS((StoreEntry *, int vm_or_not));
 static void stat_utilization_get _PARAMS((cacheinfo *, StoreEntry *, const char *desc));
-static FILE_WALK_LHD logReadHandler;
-static FILE_WALK_LHD squidReadHandler;
 static int memoryAccounted _PARAMS((void));
 
-static int LogfileStatus;
-static int LogfileFD;
-static char *LogfileName;
-
 #ifdef XMALLOC_STATISTICS
 static void info_get_mallstat _PARAMS((int, int, StoreEntry *));
 #endif
@@ -419,108 +411,6 @@ stat_get(const char *req, StoreEntry * sentry)
     }
 }
 
-
-/* generate logfile status information */
-void
-log_status_get(StoreEntry * sentry)
-{
-    if (LogfileStatus == LOG_ENABLE) {
-       storeAppendPrintf(sentry, "{\"Logfile is Enabled. Filename: %s\"}\n",
-           LogfileName);
-    } else {
-       storeAppendPrintf(sentry, "{\"Logfile is Disabled.\"}\n");
-    }
-}
-
-
-
-/* log convert handler */
-/* call for each line in file, use fileWalk routine */
-static void
-logReadHandler(int fd_unused, const char *buf, int size_unused, void *data)
-{
-    log_read_data_t *ctrl = data;
-    storeAppendPrintf(ctrl->sentry, "{%s}\n", buf);
-}
-
-/* log convert end handler */
-/* call when a walk is completed or error. */
-static void
-logReadEndHandler(int fd, int errflag_unused, void *data)
-{
-    log_read_data_t *ctrl = data;
-    storeAppendPrintf(ctrl->sentry, close_bracket);
-    storeComplete(ctrl->sentry);
-    safe_free(ctrl);
-    file_close(fd);
-}
-
-/* start converting logfile to processed format */
-void
-log_get_start(StoreEntry * sentry)
-{
-    log_read_data_t *data = NULL;
-    int fd;
-
-    if (LogfileStatus == LOG_DISABLE) {
-       /* Manufacture status when logging is disabled */
-       log_status_get(sentry);
-       storeComplete(sentry);
-       return;
-    }
-    fd = file_open(LogfileName, O_RDONLY, NULL, NULL);
-    if (fd < 0) {
-       debug(50, 0) ("Cannot open logfile: %s: %s\n",
-           LogfileName, xstrerror());
-       return;
-    }
-    data = xcalloc(1, sizeof(log_read_data_t));
-    data->sentry = sentry;
-    storeAppendPrintf(sentry, "{\n");
-    file_walk(fd,
-       logReadEndHandler,
-       data,
-       logReadHandler,
-       data);
-    return;
-}
-
-
-/* squid convert handler */
-/* call for each line in file, use fileWalk routine */
-static void
-squidReadHandler(int fd_unused, const char *buf, int size_unused, void *data)
-{
-    squid_read_data_t *ctrl = data;
-    storeAppendPrintf(ctrl->sentry, "{\"%s\"}\n", buf);
-}
-
-/* squid convert end handler */
-/* call when a walk is completed or error. */
-static void
-squidReadEndHandler(int fd_unused, int errflag_unused, void *data)
-{
-    squid_read_data_t *ctrl = data;
-    storeAppendPrintf(ctrl->sentry, close_bracket);
-    storeComplete(ctrl->sentry);
-    file_close(ctrl->fd);
-    safe_free(ctrl);
-}
-
-
-/* start convert squid.conf file to processed format */
-void
-squid_get_start(StoreEntry * sentry)
-{
-    squid_read_data_t *data;
-
-    data = xcalloc(1, sizeof(squid_read_data_t));
-    data->sentry = sentry;
-    data->fd = file_open(ConfigFile, O_RDONLY, NULL, NULL);
-    storeAppendPrintf(sentry, open_bracket);
-    file_walk(data->fd, squidReadEndHandler, data, squidReadHandler, data);
-}
-
 void
 server_list(StoreEntry * sentry)
 {
@@ -923,237 +813,6 @@ parameter_get(StoreEntry * sentry)
     storeAppendPrintf(sentry, close_bracket);
 }
 
-#if LOG_FULL_HEADERS
-static const char c2x[] =
-"000102030405060708090a0b0c0d0e0f"
-"101112131415161718191a1b1c1d1e1f"
-"202122232425262728292a2b2c2d2e2f"
-"303132333435363738393a3b3c3d3e3f"
-"404142434445464748494a4b4c4d4e4f"
-"505152535455565758595a5b5c5d5e5f"
-"606162636465666768696a6b6c6d6e6f"
-"707172737475767778797a7b7c7d7e7f"
-"808182838485868788898a8b8c8d8e8f"
-"909192939495969798999a9b9c9d9e9f"
-"a0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
-"b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
-"c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
-"d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
-"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
-"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
-
-/* log_quote -- URL-style encoding on MIME headers. */
-
-static char *
-log_quote(const char *header)
-{
-    int c, i;
-    char *buf, *buf_cursor;
-    if (header == NULL) {
-       buf = xcalloc(1, 1);
-       *buf = '\0';
-       return buf;
-    }
-    buf = xcalloc((strlen(header) * 3) + 1, 1);
-    buf_cursor = buf;
-    /*
-     * We escape: \x00-\x1F"#%;<>?{}|\\\\^~`\[\]\x7F-\xFF 
-     * which is the default escape list for the CPAN Perl5 URI module
-     * modulo the inclusion of space (x40) to make the raw logs a bit
-     * more readable.
-     */
-    while ((c = *(const unsigned char *) header++)) {
-       if (c <= 0x1F
-           || c >= 0x7F
-           || c == '"'
-           || c == '#'
-           || c == '%'
-           || c == ';'
-           || c == '<'
-           || c == '>'
-           || c == '?'
-           || c == '{'
-           || c == '}'
-           || c == '|'
-           || c == '\\'
-           || c == '^'
-           || c == '~'
-           || c == '`'
-           || c == '['
-           || c == ']') {
-           *buf_cursor++ = '%';
-           i = c * 2;
-           *buf_cursor++ = c2x[i];
-           *buf_cursor++ = c2x[i + 1];
-       } else {
-           *buf_cursor++ = c;
-       }
-    }
-    *buf_cursor = '\0';
-    return buf;
-}
-#endif /* LOG_FULL_HEADERS */
-
-
-static void
-log_append(const cacheinfo * obj,
-    const char *url,
-    struct in_addr caddr,
-    int size,
-    const char *action,
-    const char *method,
-    int http_code,
-    int msec,
-    const char *ident,
-    const struct _hierarchyLogData *hierData,
-#if LOG_FULL_HEADERS
-    const char *request_hdr,
-    const char *reply_hdr,
-#endif                         /* LOG_FULL_HEADERS */
-    const char *content_type
-)
-{
-#if LOG_FULL_HEADERS
-    LOCAL_ARRAY(char, tmp, 10000);     /* MAX_URL is 4096 */
-#else
-    LOCAL_ARRAY(char, tmp, 6000);      /* MAX_URL is 4096 */
-#endif /* LOG_FULL_HEADERS */
-    int x;
-    const char *client = NULL;
-    hier_code hier_code = HIER_NONE;
-    const char *hier_host = dash_str;
-    int hier_timeout = 0;
-#ifdef LOG_ICP_NUMBERS
-    int ns = 0;
-    int ne = 0;
-    int nr = 0;
-    int tt = 0;
-#endif
-
-    if (LogfileStatus != LOG_ENABLE)
-       return;
-
-    if (Config.Log.log_fqdn)
-       client = fqdncache_gethostbyaddr(caddr, 0);
-    if (client == NULL)
-       client = inet_ntoa(caddr);
-    if (!method)
-       method = dash_str;
-    if (!url)
-       url = dash_str;
-    if (!content_type || *content_type == '\0')
-       content_type = dash_str;
-    if (!ident || *ident == '\0')
-       ident = dash_str;
-    if (hierData) {
-       hier_code = hierData->code;
-       hier_host = hierData->host ? hierData->host : dash_str;
-       hier_timeout = hierData->timeout;
-#ifdef LOG_ICP_NUMBERS
-       tt = hierData->delay;
-       ns = hierData->n_sent;
-       ne = hierData->n_expect;
-       nr = hierData->n_recv;
-#endif
-    }
-    if (Config.commonLogFormat)
-       sprintf(tmp, "%s %s - [%s] \"%s %s\" %s:%s %d\n",
-           client,
-           ident,
-           mkhttpdlogtime(&squid_curtime),
-           method,
-           url,
-           action,
-           hier_strings[hier_code],
-           size);
-    else
-#ifdef LOG_ICP_NUMBERS
-       sprintf(tmp, "%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s/%d/%d/%d/%d %s\n",
-#else
-       sprintf(tmp, "%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s %s\n",
-#endif
-           (int) current_time.tv_sec,
-           (int) current_time.tv_usec / 1000,
-           msec,
-           client,
-           action,
-           http_code,
-           size,
-           method,
-           url,
-           ident,
-           hier_timeout ? "TIMEOUT_" : "",
-           hier_strings[hier_code],
-           hier_host,
-#ifdef LOG_ICP_NUMBERS
-           ns, ne, nr, tt,
-#endif
-           content_type);
-#if LOG_FULL_HEADERS
-    if (Config.logMimeHdrs) {
-       int msize = strlen(tmp);
-       char *ereq = log_quote(request_hdr);
-       char *erep = log_quote(reply_hdr);
-
-       if (msize + strlen(ereq) + strlen(erep) + 7 <= sizeof(tmp))
-           sprintf(tmp + msize - 1, " [%s] [%s]\n", ereq, erep);
-       else
-           debug(18, 1) ("log_append: Long headers not logged.\n");
-       safe_free(ereq);
-       safe_free(erep);
-    }
-#endif /* LOG_FULL_HEADERS */
-    x = file_write(LogfileFD,
-       xstrdup(tmp),
-       strlen(tmp),
-       NULL,
-       NULL,
-       xfree);
-    if (x != DISK_OK)
-       debug(18, 1) ("log_append: File write failed.\n");
-}
-
-void
-log_enable(StoreEntry * sentry)
-{
-    if (LogfileStatus == LOG_DISABLE) {
-       LogfileStatus = LOG_ENABLE;
-       /* open the logfile */
-       LogfileFD = file_open(LogfileName, O_WRONLY | O_CREAT, NULL, NULL);
-       if (LogfileFD == DISK_ERROR) {
-           debug(18, 0) ("Cannot open logfile: %s\n", LogfileName);
-           LogfileStatus = LOG_DISABLE;
-       }
-    }
-}
-
-void
-log_disable(StoreEntry * sentry)
-{
-    if (LogfileStatus == LOG_ENABLE)
-       file_close(LogfileFD);
-    LogfileStatus = LOG_DISABLE;
-}
-
-void
-log_clear(StoreEntry * sentry)
-{
-    /* what should be done here. Erase file ??? or move it to another name?  At the moment, just erase it.  bug here need to be fixed. what if there are still data in memory. Need flush here */
-    if (LogfileStatus == LOG_ENABLE)
-       file_close(LogfileFD);
-    unlink(LogfileName);
-    /* reopen it anyway */
-    LogfileFD = file_open(LogfileName, O_WRONLY | O_CREAT, NULL, NULL);
-    if (LogfileFD == DISK_ERROR) {
-       debug(18, 0) ("Cannot open logfile: %s\n", LogfileName);
-       LogfileStatus = LOG_DISABLE;
-    }
-    /* at the moment, store one char to make a storage manager happy */
-    storeAppendPrintf(sentry, " ");
-}
-
-
-
 static void
 proto_newobject(cacheinfo * obj, protocol_t proto_id, int size, int restart)
 {
@@ -1220,16 +879,8 @@ stat_init(cacheinfo ** object, const char *logfilename)
 
     debug(18, 5) ("stat_init: Initializing...\n");
     obj = xcalloc(1, sizeof(cacheinfo));
-    if (logfilename) {
-       memset(LogfileName, '\0', SQUID_MAXPATHLEN);
-       xstrncpy(LogfileName, logfilename, SQUID_MAXPATHLEN);
-       LogfileFD = file_open(LogfileName, O_WRONLY | O_CREAT, NULL, NULL);
-       if (LogfileFD == DISK_ERROR) {
-           debug(50, 0) ("%s: %s\n", LogfileName, xstrerror());
-           fatal("Cannot open logfile.");
-       }
-    }
-    obj->log_append = log_append;
+    if (logfilename)
+       accessLogOpen(logfilename);
     obj->proto_id = urlParseProtocol;
     obj->proto_newobject = proto_newobject;
     obj->proto_purgeobject = proto_purgeobject;
@@ -1274,51 +925,3 @@ stat_init(cacheinfo ** object, const char *logfilename)
     }
     *object = obj;
 }
-
-void
-stat_rotate_log(void)
-{
-    int i;
-    LOCAL_ARRAY(char, from, MAXPATHLEN);
-    LOCAL_ARRAY(char, to, MAXPATHLEN);
-    char *fname = NULL;
-    struct stat sb;
-
-    if ((fname = LogfileName) == NULL)
-       return;
-#ifdef S_ISREG
-    if (stat(fname, &sb) == 0)
-       if (S_ISREG(sb.st_mode) == 0)
-           return;
-#endif
-
-    debug(18, 1) ("stat_rotate_log: Rotating\n");
-
-    /* Rotate numbers 0 through N up one */
-    for (i = Config.Log.rotateNumber; i > 1;) {
-       i--;
-       sprintf(from, "%s.%d", fname, i - 1);
-       sprintf(to, "%s.%d", fname, i);
-       rename(from, to);
-    }
-    /* Rotate the current log to .0 */
-    if (Config.Log.rotateNumber > 0) {
-       sprintf(to, "%s.%d", fname, 0);
-       rename(fname, to);
-    }
-    /* Close and reopen the log.  It may have been renamed "manually"
-     * before HUP'ing us. */
-    file_close(LogfileFD);
-    LogfileFD = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL);
-    if (LogfileFD == DISK_ERROR) {
-       debug(18, 0) ("stat_rotate_log: Cannot open logfile: %s\n", fname);
-       LogfileStatus = LOG_DISABLE;
-       fatal("Cannot open logfile.");
-    }
-}
-
-void
-statCloseLog(void)
-{
-    file_close(LogfileFD);
-}
index 14d953e954a17bc71e6704af900db839b2911c76..b924244a0826368c75bdecb276ee2712f2457535 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.109 1997/06/04 06:16:14 wessels Exp $
+ * $Id: tools.cc,v 1.110 1997/06/21 02:38:18 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -356,7 +356,7 @@ normal_shutdown(void)
     PrintRusage();
     dumpMallocStats();
     storeCloseLog();
-    statCloseLog();
+    accessLogClose();
 #if PURIFY
     configFreeMemory();
     storeFreeMemory();
index 3b6ce7dbef3fbd094c46375eab627dcd6ff6c717..beb7f972c853e1e9ae6bc9ba494efb1e86a9e5cb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.58 1997/06/04 06:16:16 wessels Exp $
+ * $Id: url.cc,v 1.59 1997/06/21 02:38:19 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -313,7 +313,6 @@ requestUnlink(request_t * request)
     request->link_count--;
     if (request->link_count)
        return;
-    safe_free(request->hierarchy.host);
     safe_free(request->headers);
     put_free_request_t(request);
 }