From: wessels <> Date: Mon, 2 Jun 1997 07:06:09 +0000 (+0000) Subject: - finish moving mem_obj->req_hdr to request->headers. X-Git-Tag: SQUID_3_0_PRE1~4960 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f182d1c5dbec806ec92ab6ef3f8713ba3ec53e8d;p=thirdparty%2Fsquid.git - finish moving mem_obj->req_hdr to request->headers. - Misc debug cleanup - Changed store_rebuilding/store_validating duality. Now store_rebuilding is set until validation finishes. --- diff --git a/src/client_side.cc b/src/client_side.cc index 6a2736a4ad..235dfee94d 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.108 1997/06/01 18:19:51 wessels Exp $ + * $Id: client_side.cc,v 1.109 1997/06/02 01:06:09 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -114,7 +114,7 @@ clientAccessCheck(void *data) clientAccessCheckDone(0, http); return; } - browser = mime_get_header(http->request_hdr, "User-Agent"); + browser = mime_get_header(http->request->headers, "User-Agent"); http->acl_checklist = aclChecklistCreate(Config.accessList.HTTP, http->request, conn->peer.sin_addr, @@ -515,7 +515,7 @@ clientConstructTraceEcho(clientHttpRequest * http) httpBuildRequestHeader(http->request, http->request, NULL, /* entry */ - http->request_hdr, + http->request->headers, NULL, /* in_len */ buf + len, 8192 - len, diff --git a/src/comm.cc b/src/comm.cc index 579790e64c..becef70fca 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.156 1997/06/01 23:22:17 wessels Exp $ + * $Id: comm.cc,v 1.157 1997/06/02 01:06:10 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -393,7 +393,7 @@ commConnectHandle(int fd, void *data) break; default: if (commRetryConnect(fd, connectState)) { - debug(5, 1, "Retrying connection to %s: %s\n", + debug(5, 3, "Retrying connection to %s: %s\n", connectState->host, xstrerror()); connectState->S.sin_addr.s_addr = 0; ipcacheCycleAddr(connectState->host); diff --git a/src/ftp.cc b/src/ftp.cc index 12fc62ee90..b731758ca3 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.114 1997/06/01 18:19:52 wessels Exp $ + * $Id: ftp.cc,v 1.115 1997/06/02 01:06:11 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -555,12 +555,11 @@ ftpParseListing(FtpStateData * ftpState, int len) StoreEntry *e = ftpState->entry; len += ftpState->data.offset; end = buf + len - 1; - debug(0, 0, "buf=\n%s|\n", buf); while (*end != '\r' && *end != '\n' && end > buf) end--; usable = end - buf; if (usable == 0) { - debug(0, 0, "ftpParseListing: didn't find end\n"); + debug(9, 1, "ftpParseListing: didn't find end for %s\n", e->url); return; } line = get_free_4k_page(); @@ -570,7 +569,7 @@ ftpParseListing(FtpStateData * ftpState, int len) if (linelen > 4096) linelen = 4096; xstrncpy(line, s, linelen); - debug(0, 0, "%s\n", line); + debug(9, 7, "%s\n", line); if (!strncmp(line, "total", 5)) continue; t = ftpHtmlifyListEntry(line, ftpState->flags); @@ -877,7 +876,6 @@ ftpConnect(int fd, const ipcache_addrs * ia, void *data) request_t *request = ftpState->request; StoreEntry *entry = ftpState->entry; EBIT_RESET(ftpState->flags, FTP_IP_LOOKUP_PENDING); - debug(0, 0, "ftpConnect\n"); assert(fd == ftpState->ctrl.fd); if (ia == NULL) { debug(9, 4, "ftpConnect: Unknown host: %s\n", request->host); @@ -885,9 +883,8 @@ ftpConnect(int fd, const ipcache_addrs * ia, void *data) comm_close(fd); return; } - debug(0, 0, "ftpConnect: %s is %s\n", request->host, + debug(9, 3, "ftpConnect: %s is %s\n", request->host, inet_ntoa(ia->in_addrs[0])); - debug(0, 0, "ftpConnect: port %d\n", (int) request->port); /* Open connection. */ commSetTimeout(fd, Config.Timeout.connect, ftpTimeout, ftpState); commConnectStart(ftpState->ctrl.fd, @@ -901,7 +898,7 @@ static void ftpConnectDone(int fd, int status, void *data) { FtpStateData *ftpState = data; - debug(0, 0, "ftpConnectDone\n"); + debug(9, 3, "ftpConnectDone\n"); if (status == COMM_ERROR) { squid_error_entry(ftpState->entry, ERR_CONNECT_FAIL, xstrerror()); comm_close(fd); @@ -924,7 +921,7 @@ ftpConnectDone(int fd, int status, void *data) static void ftpWriteCommand(const char *buf, FtpStateData * ftpState) { - debug(0, 0, "ftpWriteCommand: %s\n", buf); + debug(9, 5, "ftpWriteCommand: %s\n", buf); comm_write(ftpState->ctrl.fd, xstrdup(buf), strlen(buf), @@ -943,7 +940,7 @@ ftpWriteCommandCallback(int fd, char *buf, int size, int errflag, void *data) { FtpStateData *ftpState = data; StoreEntry *entry = ftpState->entry; - debug(0, 0, "ftpWriteCommandCallback: wrote %d bytes\n", size); + debug(9, 7, "ftpWriteCommandCallback: wrote %d bytes\n", size); if (errflag) { BIT_RESET(entry->flag, ENTRY_CACHABLE); storeReleaseRequest(entry); @@ -963,7 +960,7 @@ ftpParseControlReply(char *buf, size_t len, int *codep) off_t offset; size_t linelen; int code = -1; - debug(0, 0, "ftpParseControlReply\n"); + debug(9, 5, "ftpParseControlReply\n"); if (*(buf + len - 1) != '\n') return NULL; for (s = buf; s - buf < len; s += strcspn(s, crlf), s += strspn(s, crlf)) { @@ -979,7 +976,7 @@ ftpParseControlReply(char *buf, size_t len, int *codep) list = xcalloc(1, sizeof(wordlist)); list->key = xmalloc(linelen - offset); xstrncpy(list->key, s + offset, linelen - offset); - debug(38, 0, "%p: %s\n", list->key, list->key); + debug(9, 7, "%p: %s\n", list->key, list->key); *tail = list; tail = &list->next; } @@ -998,7 +995,7 @@ ftpReadControlReply(int fd, void *data) char *oldbuf; wordlist **W; int len; - debug(0, 0, "ftpReadControlReply\n"); + debug(9, 5, "ftpReadControlReply\n"); assert(ftpState->ctrl.offset < ftpState->ctrl.size); len = read(fd, ftpState->ctrl.buf + ftpState->ctrl.offset, @@ -1029,7 +1026,7 @@ ftpReadControlReply(int fd, void *data) return; } if (len == 0) { - debug(38, 0, "Read 0 bytes from FTP control socket?\n"); + debug(9, 1, "Read 0 bytes from FTP control socket?\n"); BIT_RESET(entry->flag, ENTRY_CACHABLE); storeReleaseRequest(entry); squid_error_entry(entry, ERR_READ_ERROR, xstrerror()); @@ -1043,7 +1040,7 @@ ftpReadControlReply(int fd, void *data) ftpState->ctrl.message = ftpParseControlReply(ftpState->ctrl.buf, len, &ftpState->ctrl.replycode); if (ftpState->ctrl.message == NULL) { - debug(0, 0, "ftpReadControlReply: partial server reply\n"); + debug(9, 5, "ftpReadControlReply: partial server reply\n"); if (len == ftpState->ctrl.size) { oldbuf = ftpState->ctrl.buf; ftpState->ctrl.buf = xcalloc(ftpState->ctrl.size << 1, 1); @@ -1069,7 +1066,7 @@ static void ftpReadWelcome(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(0, 0, "ftpReadWelcome\n"); + debug(9, 3, "ftpReadWelcome\n"); if (EBIT_TEST(ftpState->flags, FTP_PASV_ONLY)) ftpState->login_att++; if (code == 220) { @@ -1093,7 +1090,7 @@ static void ftpReadUser(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(0, 0, "ftpReadUser\n"); + debug(9, 3, "ftpReadUser\n"); if (code == 230) { ftpReadPass(ftpState); } else if (code == 331) { @@ -1112,7 +1109,7 @@ ftpReadPass(FtpStateData * ftpState) char *t; char *filename; char mode; - debug(0, 0, "ftpReadPass\n"); + debug(9, 3, "ftpReadPass\n"); if (code == 230) { t = strrchr(ftpState->request->urlpath, '/'); filename = t ? t + 1 : ftpState->request->urlpath; @@ -1133,7 +1130,7 @@ ftpReadType(FtpStateData * ftpState) wordlist **T; char *path; char *d; - debug(38, 1, "This is ftpReadType\n"); + debug(9, 3, "This is ftpReadType\n"); if (code == 200) { if (EBIT_TEST(ftpState->flags, FTP_ROOT_DIR)) { ftpSendPasv(ftpState); @@ -1158,9 +1155,9 @@ static void ftpSendCwd(FtpStateData * ftpState) { wordlist *w; - debug(0, 0, "ftpSendCwd\n"); + debug(9, 3, "ftpSendCwd\n"); if ((w = ftpState->pathcomps) == NULL) { - debug(0, 0, "the final component was a directory\n"); + debug(9, 3, "the final component was a directory\n"); EBIT_SET(ftpState->flags, FTP_ISDIR); if (!EBIT_TEST(ftpState->flags, FTP_ROOT_DIR)) strcat(ftpState->title_url, "/"); @@ -1178,7 +1175,7 @@ ftpReadCwd(FtpStateData * ftpState) int code = ftpState->ctrl.replycode; size_t len = 0; wordlist *w; - debug(38, 1, "This is ftpReadCwd\n"); + debug(9, 3, "This is ftpReadCwd\n"); w = ftpState->pathcomps; assert(w != NULL); if (code >= 200 && code < 300) { @@ -1215,7 +1212,7 @@ static void ftpReadMdtm(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(38, 1, "This is ftpReadMdtm\n"); + debug(9, 3, "This is ftpReadMdtm\n"); if (code == 213) { ftpState->mdtm = parse_iso3307_time(ftpState->ctrl.last_message); assert(ftpState->filepath != NULL); @@ -1232,7 +1229,7 @@ static void ftpReadSize(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(38, 1, "This is ftpReadSize\n"); + debug(9, 3, "This is ftpReadSize\n"); if (code == 213) { ftpState->size = atoi(ftpState->ctrl.last_message); ftpSendPasv(ftpState); @@ -1278,36 +1275,36 @@ ftpReadPasv(FtpStateData * ftpState) int fd = ftpState->data.fd; char *buf = ftpState->ctrl.last_message; LOCAL_ARRAY(char, junk, 1024); - debug(38, 1, "This is ftpReadPasv\n"); + debug(9, 3, "This is ftpReadPasv\n"); if (code != 227) { - debug(38, 0, "PASV not supported by remote end\n"); + debug(9, 3, "PASV not supported by remote end\n"); ftpSendPort(ftpState); return; } if (strlen(buf) > 1024) { - debug(38, 0, "Avoiding potential buffer overflow\n"); + debug(9, 1, "Avoiding potential buffer overflow\n"); ftpSendPort(ftpState); return; } /* 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2). */ /* ANSI sez [^0-9] is undefined, it breaks on Watcom cc */ - debug(0, 0, "scanning: %s\n", buf); + debug(9, 5, "scanning: %s\n", buf); n = sscanf(buf, "%[^0123456789]%d,%d,%d,%d,%d,%d", junk, &h1, &h2, &h3, &h4, &p1, &p2); if (n != 7 || p1 < 0 || p2 < 0 || p1 > 255 || p2 > 255) { - debug(38, 0, "Bad 227 reply\n"); - debug(38, 0, "n=%d, p1=%d, p2=%d\n", n, p1, p2); + debug(9, 3, "Bad 227 reply\n"); + debug(9, 3, "n=%d, p1=%d, p2=%d\n", n, p1, p2); ftpSendPort(ftpState); return; } sprintf(junk, "%d.%d.%d.%d", h1, h2, h3, h4); if (!safe_inet_addr(junk, NULL)) { - debug(38, 0, "unsafe address (%s)\n", junk); + debug(9, 1, "unsafe address (%s)\n", junk); ftpSendPort(ftpState); return; } port = ((p1 << 8) + p2); - debug(0, 0, "ftpReadPasv: connecting to %s, port %d\n", junk, port); + debug(9, 5, "ftpReadPasv: connecting to %s, port %d\n", junk, port); commConnectStart(fd, junk, port, ftpPasvCallback, ftpState); } @@ -1315,7 +1312,7 @@ static void ftpPasvCallback(int fd, int status, void *data) { FtpStateData *ftpState = data; - debug(0, 0, "ftpPasvCallback\n"); + debug(9, 3, "ftpPasvCallback\n"); if (status == COMM_ERROR) { squid_error_entry(ftpState->entry, ERR_CONNECT_FAIL, xstrerror()); comm_close(fd); @@ -1327,20 +1324,20 @@ ftpPasvCallback(int fd, int status, void *data) static void ftpSendPort(FtpStateData * ftpState) { - debug(38, 1, "This is ftpSendPort\n"); + debug(9, 3, "This is ftpSendPort\n"); EBIT_RESET(ftpState->flags, FTP_PASV_SUPPORTED); } static void ftpReadPort(FtpStateData * ftpState) { - debug(38, 1, "This is ftpReadPort\n"); + debug(9, 3, "This is ftpReadPort\n"); } static void ftpRestOrList(FtpStateData * ftpState) { - debug(38, 1, "This is ftpRestOrList\n"); + debug(9, 3, "This is ftpRestOrList\n"); if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) { sprintf(cbuf, "LIST\r\n"); ftpWriteCommand(cbuf, ftpState); @@ -1361,7 +1358,7 @@ static void ftpReadRest(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(38, 1, "This is ftpReadRest\n"); + debug(9, 3, "This is ftpReadRest\n"); assert(ftpState->restart_offset > 0); if (code == 350) { assert(ftpState->filepath != NULL); @@ -1369,7 +1366,7 @@ ftpReadRest(FtpStateData * ftpState) ftpWriteCommand(cbuf, ftpState); ftpState->state = SENT_RETR; } else if (code > 0) { - debug(0, 0, "ftpReadRest: REST not supported\n"); + debug(9, 3, "ftpReadRest: REST not supported\n"); EBIT_RESET(ftpState->flags, FTP_REST_SUPPORTED); } else { ftpFail(ftpState); @@ -1380,7 +1377,7 @@ static void ftpReadList(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(38, 1, "This is ftpReadList\n"); + debug(9, 3, "This is ftpReadList\n"); if (code == 150 || code == 125) { ftpAppendSuccessHeader(ftpState); commSetSelect(ftpState->data.fd, @@ -1405,9 +1402,9 @@ static void ftpReadRetr(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(38, 1, "This is ftpReadRetr\n"); + debug(9, 3, "This is ftpReadRetr\n"); if (code >= 100 && code < 200) { - debug(0, 0, "reading data channel\n"); + debug(9, 3, "reading data channel\n"); ftpAppendSuccessHeader(ftpState); commSetSelect(ftpState->data.fd, COMM_SELECT_READ, @@ -1424,9 +1421,9 @@ static void ftpReadTransferDone(FtpStateData * ftpState) { int code = ftpState->ctrl.replycode; - debug(38, 1, "This is ftpReadTransferDone\n"); + debug(9, 3, "This is ftpReadTransferDone\n"); if (code != 226) { - debug(38, 1, "Got code %d after reading data, releasing entry\n"); + debug(9, 1, "Got code %d after reading data, releasing entry\n"); storeReleaseRequest(ftpState->entry); } } @@ -1434,7 +1431,7 @@ ftpReadTransferDone(FtpStateData * ftpState) static void ftpDataTransferDone(FtpStateData * ftpState) { - debug(38, 1, "This is ftpDataTransferDone\n"); + debug(9, 3, "This is ftpDataTransferDone\n"); assert(ftpState->data.fd >= 0); comm_close(ftpState->data.fd); ftpState->data.fd = -1; @@ -1452,7 +1449,7 @@ ftpReadQuit(FtpStateData * ftpState) static void ftpFail(FtpStateData * ftpState) { - debug(0, 0, "ftpFail\n"); + debug(9, 3, "ftpFail\n"); comm_close(ftpState->ctrl.fd); } diff --git a/src/squid.h b/src/squid.h index 2e2bcdca25..07f30df479 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.118 1997/06/01 23:22:27 wessels Exp $ + * $Id: squid.h,v 1.119 1997/06/02 01:06:16 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -358,15 +358,10 @@ extern char ThisCache[]; /* main.c */ #define CONNECT_PORT 443 extern void start_announce _PARAMS((void *unused)); -extern void sslStart _PARAMS((int fd, const char *, request_t *, char *, int *sz)); -extern void waisStart _PARAMS((method_t, StoreEntry *)); +extern void sslStart _PARAMS((int fd, const char *, request_t *, int *sz)); +extern void waisStart _PARAMS((request_t *, StoreEntry *)); extern void storeDirClean _PARAMS((void *unused)); -extern void passStart _PARAMS((int fd, - const char *url, - request_t * request, - char *buf, - int buflen, - int *size_ptr)); +extern void passStart _PARAMS((int, const char *, request_t *, int *)); extern void identStart _PARAMS((int, ConnStateData *, IDCB * callback)); extern int httpAnonAllowed _PARAMS((const char *line)); extern int httpAnonDenied _PARAMS((const char *line)); diff --git a/src/ssl.cc b/src/ssl.cc index 881d833048..416dc7f436 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.52 1997/06/01 23:22:28 wessels Exp $ + * $Id: ssl.cc,v 1.53 1997/06/02 01:06:16 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -36,7 +36,6 @@ typedef struct { char *host; /* either request->host or proxy host */ u_short port; request_t *request; - char *mime_hdr; struct { int fd; int len; @@ -357,7 +356,7 @@ sslConnectDone(int fd, int status, void *data) } void -sslStart(int fd, const char *url, request_t * request, char *mime_hdr, int *size_ptr) +sslStart(int fd, const char *url, request_t * request, int *size_ptr) { /* Create state structure. */ SslStateData *sslState = NULL; @@ -391,7 +390,6 @@ sslStart(int fd, const char *url, request_t * request, char *mime_hdr, int *size sslState = xcalloc(1, sizeof(SslStateData)); sslState->url = xstrdup(url); sslState->request = requestLink(request); - sslState->mime_hdr = mime_hdr; sslState->timeout = Config.Timeout.read; sslState->size_ptr = size_ptr; sslState->client.fd = fd; diff --git a/src/store.cc b/src/store.cc index ae52a391f2..e8ccf239ea 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.247 1997/06/01 23:21:50 wessels Exp $ + * $Id: store.cc,v 1.248 1997/06/02 01:06:17 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -198,6 +198,7 @@ struct storeRebuildState { int linecount; /* # lines parsed from cache logfile */ int clashcount; /* # swapfile clashes avoided */ int dupcount; /* # duplicates purged */ + int need_to_validate; time_t start; time_t stop; char *line_in; @@ -328,9 +329,6 @@ static int store_maintain_buckets; static int scan_revolutions; static struct _bucketOrder *MaintBucketsOrder = NULL; -/* Dirty/Clean rebuild status parameter */ -static int store_validating = 0; - static MemObject * new_MemObject(void) { @@ -571,13 +569,8 @@ storeUnlockObject(StoreEntry * e) if (e->lock_count) return (int) e->lock_count; if (e->store_status == STORE_PENDING) { - if (BIT_TEST(e->flag, ENTRY_DISPATCHED)) { - debug_trap("storeUnlockObject: PENDING and DISPATCHED with 0 locks"); - debug(20, 1, " --> Key '%s'\n", e->key); - e->store_status = STORE_ABORTED; - } else { - BIT_SET(e->flag, RELEASE_REQUEST); - } + assert(!BIT_TEST(e->flag, ENTRY_DISPATCHED)); + BIT_SET(e->flag, RELEASE_REQUEST); } if (storePendingNClients(e) > 0) debug_trap("storeUnlockObject: unlocked entry with pending clients\n"); @@ -1398,6 +1391,7 @@ storeDoRebuildFromDisk(void *data) * newer entry. */ debug(20, 1, "WARNING: newer swaplog entry for fileno %08X\n", sfileno); + assert(newer == 0); /* I'm tempted to remove the swapfile here just to be safe, * but there is a bad race condition in the NOVM version if * the swapfile has recently been opened for writing, but @@ -1453,7 +1447,7 @@ storeCleanup(void *data) if (++bucketnum >= store_buckets) { debug(20, 1, " Completed Validation Procedure\n"); debug(20, 1, " Validated %d Entries\n", validnum); - store_validating = 0; + store_rebuilding = 0; return; } link_ptr = hash_get_bucket(store_table, bucketnum); @@ -1478,11 +1472,10 @@ storeCleanup(void *data) eventAdd("storeCleanup", storeCleanup, NULL, 0); return; } - if ((validnum % 4096) == 0) - debug(20, 1, " %7d Entries Validated so far.\n", validnum); if (!BIT_TEST(e->flag, ENTRY_VALIDATED)) { storeValidate(e, storeCleanupComplete, e); - validnum++; + if ((++validnum & 0xFFF) == 0) + debug(20, 1, " %7d Entries Validated so far.\n", validnum); } xfree(curr->key); xfree(curr); @@ -1569,13 +1562,14 @@ storeRebuiltFromDisk(struct storeRebuildState *data) debug(20, 1, " Took %d seconds (%6.1lf objects/sec).\n", r > 0 ? r : 0, (double) data->objcount / (r > 0 ? r : 1)); debug(20, 1, " store_swap_size = %dk\n", store_swap_size); - store_rebuilding = 0; - safe_free(data->line_in); - safe_free(data); - if (store_validating) { + if (data->need_to_validate) { debug(20, 1, "Beginning Validation Procedure\n"); eventAdd("storeCleanup", storeCleanup, NULL, 0); + } else { + store_rebuilding = 0; } + safe_free(data->line_in); + safe_free(data); } static void @@ -1600,7 +1594,7 @@ storeStartRebuildFromDisk(void) d->next = RB->rebuild_dir; RB->rebuild_dir = d; if (!clean) - store_validating = 1; + RB->need_to_validate = 1; debug(20, 1, "Rebuilding storage in Cache Dir #%d (%s)\n", i, clean ? "CLEAN" : "DIRTY"); } @@ -2198,7 +2192,7 @@ storeClientCopy(StoreEntry * e, static int recurse_detect = 0; assert(seen_offset <= mem->e_current_len); assert(copy_offset >= mem->e_lowest_offset); - assert(recurse_detect == 0); + assert(recurse_detect < 3); /* could == 1 for IMS not modified's */ if ((ci = storeClientListSearch(mem, data)) < 0) fatal_dump("storeClientCopy: Unregistered client"); sc = &mem->clients[ci]; @@ -2213,9 +2207,9 @@ storeClientCopy(StoreEntry * e, return; } sz = memCopy(mem->data, copy_offset, buf, size); - recurse_detect = 1; + recurse_detect++; callback(data, buf, sz); - recurse_detect = 0; + recurse_detect--; /* see if we can get rid of some data if we are in "delete behind" mode . */ if (BIT_TEST(e->flag, DELETE_BEHIND)) storeDeleteBehind(e); @@ -2421,10 +2415,6 @@ storeMaintainSwapSpace(void *unused) } debug(51, rm_obj ? 2 : 9, "Removed %d of %d objects from bucket %d\n", rm_obj, scan_obj, (int) b->bucket); - /* Don't remove stuff if we're still validating - we could remove good - * stuff when we don't want to */ - if (store_validating) - return; /* Scan row of hash table each second and free storage if we're * over the high-water mark */ storeGetSwapSpace(0); @@ -2536,7 +2526,7 @@ storeWriteCleanLogs(void) r > 0 ? r : 0, (double) n / (r > 0 ? r : 1)); /* touch a timestamp file if we're not still validating */ for (dirn = 0; dirn < ncache_dirs; dirn++) { - if (!store_validating) + if (!store_rebuilding) file_close(file_open(cln[dirn], O_WRONLY | O_CREAT | O_TRUNC, NULL, NULL)); safe_free(cur[dirn]); diff --git a/src/tunnel.cc b/src/tunnel.cc index cea5dd37dc..96e2b617ea 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.52 1997/06/01 23:22:28 wessels Exp $ + * $Id: tunnel.cc,v 1.53 1997/06/02 01:06:16 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -36,7 +36,6 @@ typedef struct { char *host; /* either request->host or proxy host */ u_short port; request_t *request; - char *mime_hdr; struct { int fd; int len; @@ -357,7 +356,7 @@ sslConnectDone(int fd, int status, void *data) } void -sslStart(int fd, const char *url, request_t * request, char *mime_hdr, int *size_ptr) +sslStart(int fd, const char *url, request_t * request, int *size_ptr) { /* Create state structure. */ SslStateData *sslState = NULL; @@ -391,7 +390,6 @@ sslStart(int fd, const char *url, request_t * request, char *mime_hdr, int *size sslState = xcalloc(1, sizeof(SslStateData)); sslState->url = xstrdup(url); sslState->request = requestLink(request); - sslState->mime_hdr = mime_hdr; sslState->timeout = Config.Timeout.read; sslState->size_ptr = size_ptr; sslState->client.fd = fd; diff --git a/src/url.cc b/src/url.cc index b9420931e6..1dcbab2046 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.56 1997/05/26 04:05:01 wessels Exp $ + * $Id: url.cc,v 1.57 1997/06/02 01:06:18 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -314,6 +314,7 @@ requestUnlink(request_t * request) if (request->link_count) return; safe_free(request->hierarchy.host); + safe_free(request->headers); put_free_request_t(request); } diff --git a/src/wais.cc b/src/wais.cc index d0d169ef11..5210128235 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.72 1997/06/01 23:22:29 wessels Exp $ + * $Id: wais.cc,v 1.73 1997/06/02 01:06:19 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -295,11 +295,12 @@ waisSendRequest(int fd, void *data) } void -waisStart(method_t method, StoreEntry * entry) +waisStart(request_t *request, StoreEntry * entry) { WaisStateData *waisState = NULL; int fd; char *url = entry->url; + method_t method = request->method; debug(24, 3, "waisStart: \"%s %s\"\n", RequestMethodStr[method], url); if (!Config.Wais.relayHost) { debug(24, 0, "waisStart: Failed because no relay host defined!\n"); @@ -321,7 +322,7 @@ waisStart(method_t method, StoreEntry * entry) waisState->method = method; waisState->relayhost = Config.Wais.relayHost; waisState->relayport = Config.Wais.relayPort; - waisState->request_hdr = entry->mem_obj->request_hdr; + waisState->request_hdr = request->headers; waisState->fd = fd; waisState->entry = entry; xstrncpy(waisState->request, url, MAX_URL);