]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Enhanced access logging. Now log HTTP reply code and elapsed
authorwessels <>
Wed, 3 Apr 1996 04:50:22 +0000 (04:50 +0000)
committerwessels <>
Wed, 3 Apr 1996 04:50:22 +0000 (04:50 +0000)
time in msec.  In icpSendMoreData we parse the object for a HTTP
reply code if necesary.

src/errorpage.cc
src/http.cc
src/stat.cc
src/store.cc

index 5005c4fcbbe935cb0b80977e19a9d7d6a4cd64a6..810f68b6e4d0286c2d06a24e67fa281326f7e26c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: errorpage.cc,v 1.9 1996/04/02 00:51:52 wessels Exp $ */
+/* $Id: errorpage.cc,v 1.10 1996/04/02 21:50:22 wessels Exp $ */
 
 /* DEBUG: Section 4             cached_error: Error printing routines */
 
@@ -162,6 +162,8 @@ char *cached_error_url(url, type, msg)
        "0.0.0.0",
        0,
        ErrorData[index].tag,
-       "GET");
+       "GET",
+       0,
+       0);
     return tmp_error_buf;
 }
index 956b8b9b67a41d911ff2765386c7572b6c3f3fb6..c181b0e16ef6e8549a20edf6deedbd8acf0cbec3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: http.cc,v 1.23 1996/04/02 00:51:54 wessels Exp $ */
+/* $Id: http.cc,v 1.24 1996/04/02 21:50:22 wessels Exp $ */
 
 /*
  * DEBUG: Section 11          http: HTTP
@@ -225,6 +225,7 @@ static void httpProcessReplyHeader(data, buf)
            storeAddEntry(entry);
            break;
        }
+       entry->mem_obj->http_code = data->http_code;
     }
 }
 
index 487205c516a8c667064be2d9be7d3af911238787..c6e5b067d492bdff73745f41297202cf489bf582 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stat.cc,v 1.13 1996/04/01 18:24:30 wessels Exp $ */
+/* $Id: stat.cc,v 1.14 1996/04/02 21:50:24 wessels Exp $ */
 
 /*
  * DEBUG: Section 18          stat
@@ -748,13 +748,15 @@ void parameter_get(obj, sentry)
 }
 
 
-void log_append(obj, url, id, size, action, method)
+void log_append(obj, url, id, size, action, method, http_code, msec)
      cacheinfo *obj;
      char *url;
      char *id;
      int size;
      char *action;
      char *method;
+     int http_code;
+     int msec;
 {
     static char tmp[6000];     /* MAX_URL is 4096 */
     char *buf = NULL;
@@ -785,11 +787,13 @@ void log_append(obj, url, id, size, action, method)
            sprintf(tmp, "%s - - [%s] \"%s %s\" %s %d\n",
                id, mkhttpdlogtime(&cached_curtime), method, url, action, size);
        else
-           sprintf(tmp, "%9d.%06d %s %s %d %s %s\n",
+           sprintf(tmp, "%9d.%03d %6d %s %s/%03d %d %s %s\n",
                (int) current_time.tv_sec,
-               (int) current_time.tv_usec,
+               (int) current_time.tv_usec / 1000,
+               msec,
                id,
                action,
+               http_code,
                size,
                method,
                url);
index 4b2c39b8ad81a39d76df755f5b8b2aa79475bf1c..3b5cabe0256e73b826a6651bea5450f96c433fec 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $Id: store.cc,v 1.22 1996/04/02 01:00:31 wessels Exp $ */
+/* $Id: store.cc,v 1.23 1996/04/02 21:50:25 wessels Exp $ */
 
 /*
  * DEBUG: Section 20          store
@@ -48,7 +48,7 @@
 #define STORE_MAINTAIN_RATE    (20)
 
 #define STORE_BUCKETS          (7921)
-#define STORE_IN_MEM_BUCKETS   (143)
+#define STORE_IN_MEM_BUCKETS           (143)
 
 /* Now, this table is inaccessible to outsider. They have to use a method
  * to access a value in internal storage data structure. */
@@ -100,7 +100,7 @@ static MemObject *new_MemObject()
 }
 
 static StoreEntry *new_StoreEntry(mem_obj_flag)
-    int mem_obj_flag;
+     int mem_obj_flag;
 {
     StoreEntry *e = NULL;
 
@@ -229,7 +229,7 @@ void storeSetMemStatus(e, status)
 
     /* It is not an error to call this with a NULL e->key */
     if (e->key != NULL) {
-       if (e->mem_status == IN_MEMORY && status != IN_MEMORY) {
+       if (status != IN_MEMORY && e->mem_status == IN_MEMORY) {
            if ((ptr = hash_lookup(in_mem_table, e->key)))
                hash_delete_link(in_mem_table, ptr);
        } else if (status == IN_MEMORY && e->mem_status != IN_MEMORY) {
@@ -438,6 +438,7 @@ StoreEntry *storeCreateEntry(url, req_hdr, cachable, html_req, method)
     StoreEntry *e = NULL;
     MemObject *m = NULL;
     debug(20, 5, "storeCreateEntry: '%s'\n", url);
+    debug(20, 5, "storeCreateEntry: cachable=%d\n", cachable);
 
     if (meta_data.hot_vm > store_hotobj_high)
        storeGetMemSpace(0, 1);
@@ -829,7 +830,7 @@ static void InvokeHandlers(e)
 void storeExpireNow(e)
      StoreEntry *e;
 {
-    debug(20, 3, "storeExpireNow: Object %s\n", e->key);
+    debug(20, 3, "storeExpireNow: Object %s\n", e->url);
     e->expires = cached_curtime;
 }
 
@@ -995,10 +996,12 @@ int storeSwapInStart(e)
      StoreEntry *e;
 {
     int fd;
+    char *path = NULL;
 
     /* sanity check! */
     if ((e->swap_status != SWAP_OK) || (e->swap_file_number < 0)) {
-       debug(20, 0, "storeSwapInStart: <No filename:%d> ? <URL:%s>\n", e->swap_file_number, e->url);
+       debug(20, 0, "storeSwapInStart: <No filename:%d> ? <URL:%s>\n",
+           e->swap_file_number, e->url);
        if (has_mem_obj(e))
            e->mem_obj->swap_fd = -1;
        return -1;
@@ -1006,27 +1009,27 @@ int storeSwapInStart(e)
     /* create additional structure for object in memory */
     e->mem_obj = new_MemObject();
 
-    e->mem_obj->swap_fd = fd =
-       file_open(storeSwapFullPath(e->swap_file_number, NULL), NULL, O_RDONLY);
+    path = storeSwapFullPath(e->swap_file_number, NULL);
+    fd = e->mem_obj->swap_fd = file_open(path, NULL, O_RDONLY);
     if (fd < 0) {
-       debug(20, 0, "storeSwapInStart: Unable to open swapfile: %s for\n\t<URL:%s>\n",
-           storeSwapFullPath(e->swap_file_number, NULL), e->url);
+       debug(20, 0, "storeSwapInStart: Unable to open swapfile: %s\n",
+           path);
+       debug(20, 0, "storeSwapInStart: --> for <URL:%s>\n",
+           e->url);
        storeSetMemStatus(e, NOT_IN_MEMORY);
-       /* Invoke a store abort that should free the destroy_store_mem_obj(e); */
+       /* Invoke a store abort that should free the memory object */
        return -1;
     }
     debug(20, 5, "storeSwapInStart: initialized swap file '%s' for <URL:%s>\n",
-       storeSwapFullPath(e->swap_file_number, NULL), e->url);
-
-    e->mem_obj->data = new_MemObjectData();
+       path, e->url);
 
     storeSetMemStatus(e, SWAPPING_IN);
+    e->mem_obj->data = new_MemObjectData();
     e->mem_obj->swap_offset = 0;
-
     e->mem_obj->e_swap_buf = get_free_8k_page();
 
     /* start swapping daemon */
-    file_read(e->mem_obj->swap_fd,
+    file_read(fd,
        e->mem_obj->e_swap_buf,
        SWAP_BUF,
        e->mem_obj->swap_offset,
@@ -1382,6 +1385,7 @@ void storeComplete(e)
     debug(20, 5, "storeComplete: <URL:%s>\n", e->url);
 
     if (!e->key || e->flag & KEY_CHANGE) {
+       debug(20, 5, "storeComplete: No key, setting RELEASE_REQUEST\n");
        /* Never cache private objects */
        BIT_SET(e->flag, RELEASE_REQUEST);
        BIT_RESET(e->flag, CACHABLE);