From: wessels <> Date: Wed, 3 Apr 1996 04:50:22 +0000 (+0000) Subject: Enhanced access logging. Now log HTTP reply code and elapsed X-Git-Tag: SQUID_3_0_PRE1~6303 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc07a0e476b4d40cbeb6faf3b0671b1a4bd82aa0;p=thirdparty%2Fsquid.git Enhanced access logging. Now log HTTP reply code and elapsed time in msec. In icpSendMoreData we parse the object for a HTTP reply code if necesary. --- diff --git a/src/errorpage.cc b/src/errorpage.cc index 5005c4fcbb..810f68b6e4 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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; } diff --git a/src/http.cc b/src/http.cc index 956b8b9b67..c181b0e16e 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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; } } diff --git a/src/stat.cc b/src/stat.cc index 487205c516..c6e5b067d4 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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); diff --git a/src/store.cc b/src/store.cc index 4b2c39b8ad..3b5cabe025 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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: ? \n", e->swap_file_number, e->url); + debug(20, 0, "storeSwapInStart: ? \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\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 \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 \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: \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);