From: wessels <> Date: Tue, 26 Mar 1996 02:05:49 +0000 (+0000) Subject: use new fixed-args cached_error_entry() X-Git-Tag: SQUID_3_0_PRE1~6396 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b367f261f5896f5bb7a10692932015a3f62323b3;p=thirdparty%2Fsquid.git use new fixed-args cached_error_entry() --- diff --git a/src/ftp.cc b/src/ftp.cc index 7f0649665b..b39ff74caf 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,4 +1,4 @@ -/* $Id: ftp.cc,v 1.8 1996/03/23 00:02:14 wessels Exp $ */ +/* $Id: ftp.cc,v 1.9 1996/03/25 19:05:49 wessels Exp $ */ #include "config.h" #include @@ -143,7 +143,7 @@ void ftpLifetimeExpire(fd, data) data->icp_page_ptr = NULL; } safe_free(data->icp_rwd_ptr); - cached_error(entry, ERR_LIFETIME_EXP); + cached_error_entry(entry, ERR_LIFETIME_EXP, NULL); /* ftp_close_pipe(data->ftp_fd, data->cpid); */ comm_close(fd); safe_free(data); @@ -185,7 +185,7 @@ int ftpReadReply(fd, data) } } else { /* we can terminate connection right now */ - cached_error(entry, ERR_NO_CLIENTS_BIG_OBJ); + cached_error_entry(entry, ERR_NO_CLIENTS_BIG_OBJ, NULL); /* ftp_close_pipe(data->ftp_fd, data->cpid); */ comm_close(fd); safe_free(data); @@ -198,7 +198,7 @@ int ftpReadReply(fd, data) if (len < 0 || ((len == 0) && (entry->mem_obj->e_current_len == 0))) { if (len < 0) debug(1, "ftpReadReply - error reading: %s\n", xstrerror()); - cached_error(entry, ERR_READ_ERROR); + cached_error_entry(entry, ERR_READ_ERROR, NULL); /* ftp_close_pipe(data->ftp_fd, data->cpid); */ comm_close(fd); safe_free(data); @@ -235,7 +235,7 @@ int ftpReadReply(fd, data) } else if (entry->flag & CLIENT_ABORT_REQUEST) { /* append the last bit of info we get */ storeAppend(entry, buf, len); - cached_error(entry, ERR_CLIENT_ABORT); + cached_error_entry(entry, ERR_CLIENT_ABORT, NULL); /* ftp_close_pipe(data->ftp_fd, data->cpid); */ comm_close(fd); safe_free(data); @@ -275,7 +275,7 @@ void ftpSendComplete(fd, buf, size, errflag, data) data->icp_rwd_ptr = NULL; /* Don't double free in lifetimeexpire */ if (errflag) { - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); comm_close(fd); safe_free(data); return; @@ -400,7 +400,7 @@ void ftpConnInProgress(fd, data) break; /* cool, we're connected */ default: comm_close(fd); - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); return; } @@ -428,7 +428,7 @@ int ftpStart(unusedfd, url, entry) /* Parse url. */ if (ftp_url_parser(url, data)) { - cached_error(entry, ERR_INVALID_URL); + cached_error_entry(entry, ERR_INVALID_URL, NULL); safe_free(data); return COMM_ERROR; } @@ -437,7 +437,7 @@ int ftpStart(unusedfd, url, entry) data->ftp_fd = comm_open(COMM_NONBLOCKING, 0, 0, url); if (data->ftp_fd == COMM_ERROR) { - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); return COMM_ERROR; } @@ -447,7 +447,7 @@ int ftpStart(unusedfd, url, entry) if ((status = comm_connect(data->ftp_fd, "localhost", 3131))) { if (status != EINPROGRESS) { comm_close(data->ftp_fd); - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); return COMM_ERROR; } else { diff --git a/src/gopher.cc b/src/gopher.cc index ec3a37908f..b9e4f6d197 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,4 +1,4 @@ -/* $Id: gopher.cc,v 1.5 1996/03/23 00:03:01 wessels Exp $ */ +/* $Id: gopher.cc,v 1.6 1996/03/25 19:05:49 wessels Exp $ */ #include "config.h" #include @@ -583,7 +583,7 @@ int gopherReadReplyTimeout(fd, data) StoreEntry *entry = NULL; entry = data->entry; debug(4, "GopherReadReplyTimeout: Timeout on %d\n url: %s\n", fd, entry->url); - cached_error(entry, ERR_READ_TIMEOUT); + cached_error_entry(entry, ERR_READ_TIMEOUT, NULL); if (data->icp_page_ptr) put_free_4k_page(data->icp_page_ptr); if (data->icp_rwd_ptr) @@ -601,7 +601,7 @@ void gopherLifetimeExpire(fd, data) StoreEntry *entry = NULL; entry = data->entry; debug(4, "gopherLifeTimeExpire: FD %d: \n", fd, entry->url); - cached_error(entry, ERR_LIFETIME_EXP); + cached_error_entry(entry, ERR_LIFETIME_EXP, NULL); if (data->icp_page_ptr) put_free_4k_page(data->icp_page_ptr); if (data->icp_rwd_ptr) @@ -664,7 +664,7 @@ int gopherReadReply(fd, data) } } else { /* we can terminate connection right now */ - cached_error(entry, ERR_NO_CLIENTS_BIG_OBJ); + cached_error_entry(entry, ERR_NO_CLIENTS_BIG_OBJ, NULL); comm_close(fd); freeGopherData(data); return 0; @@ -677,7 +677,7 @@ int gopherReadReply(fd, data) if (len < 0 || ((len == 0) && (entry->mem_obj->e_current_len == 0))) { debug(1, "gopherReadReply - error reading: %s\n", xstrerror()); - cached_error(entry, ERR_READ_ERROR); + cached_error_entry(entry, ERR_READ_ERROR, xstrerror()); comm_close(fd); freeGopherData(data); } else if (len == 0) { @@ -713,7 +713,7 @@ int gopherReadReply(fd, data) } else { storeAppend(entry, buf, len); } - cached_error(entry, ERR_CLIENT_ABORT); + cached_error_entry(entry, ERR_CLIENT_ABORT, NULL); if (data->conversion != NORMAL) gopherEndHTML(data); BIT_RESET(entry->flag, DELAY_SENDING); @@ -747,7 +747,7 @@ int gopherSendComplete(fd, buf, size, errflag, data) debug(5, "gopherSendComplete - fd: %d size: %d errflag: %d\n", fd, size, errflag); if (errflag) { - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); comm_close(fd); freeGopherData(data); if (buf) @@ -860,7 +860,7 @@ int gopherStart(unusedfd, url, entry) /* Parse url. */ if (gopher_url_parser(url, data->host, &data->port, &data->type_id, data->request)) { - cached_error(entry, ERR_INVALID_URL); + cached_error_entry(entry, ERR_INVALID_URL, NULL); freeGopherData(data); return COMM_ERROR; } @@ -868,7 +868,7 @@ int gopherStart(unusedfd, url, entry) sock = comm_open(COMM_NONBLOCKING, 0, 0, url); if (sock == COMM_ERROR) { debug(4, "gopherStart: Failed because we're out of sockets.\n"); - cached_error(entry, ERR_NO_FDS); + cached_error_entry(entry, ERR_NO_FDS, xstrerror()); freeGopherData(data); return COMM_ERROR; } @@ -878,7 +878,7 @@ int gopherStart(unusedfd, url, entry) if (!ipcache_gethostbyname(data->host)) { debug(4, "gopherStart: Called without IP entry in ipcache. OR lookup failed.\n"); comm_close(sock); - cached_error(entry, ERR_DNS_FAIL, dns_error_message); + cached_error_entry(entry, ERR_DNS_FAIL, dns_error_message); freeGopherData(data); return COMM_ERROR; } @@ -908,7 +908,7 @@ int gopherStart(unusedfd, url, entry) if ((status = comm_connect(sock, data->host, data->port)) != 0) { if (status != EINPROGRESS) { comm_close(sock); - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); freeGopherData(data); return COMM_ERROR; } else { diff --git a/src/http.cc b/src/http.cc index 70a0b1369d..7b1979aebc 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,4 +1,4 @@ -/* $Id: http.cc,v 1.6 1996/03/23 00:03:02 wessels Exp $ */ +/* $Id: http.cc,v 1.7 1996/03/25 19:05:50 wessels Exp $ */ #include "config.h" #include @@ -20,6 +20,7 @@ #define HTTP_PORT 80 #define HTTP_DELETE_GAP (64*1024) +#define READBUFSIZ 4096 extern int errno; extern char *dns_error_message; @@ -108,7 +109,7 @@ void httpReadReplyTimeout(fd, data) entry = data->entry; debug(4, "httpReadReplyTimeout: FD %d: \n", fd, entry->url); - cached_error(entry, ERR_READ_TIMEOUT); + cached_error_entry(entry, ERR_READ_TIMEOUT, NULL); if (data->icp_rwd_ptr) safe_free(data->icp_rwd_ptr); if (data->icp_page_ptr) { @@ -130,7 +131,7 @@ void httpLifetimeExpire(fd, data) entry = data->entry; debug(4, "httpLifeTimeExpire: FD %d: \n", fd, entry->url); - cached_error(entry, ERR_LIFETIME_EXP); + cached_error_entry(entry, ERR_LIFETIME_EXP, NULL); if (data->icp_page_ptr) { put_free_8k_page(data->icp_page_ptr); data->icp_page_ptr = NULL; @@ -150,7 +151,7 @@ void httpReadReply(fd, data) int fd; HttpData *data; { - static char buf[4096]; + static char buf[READBUFSIZ]; int len; int clen; int off; @@ -193,13 +194,13 @@ void httpReadReply(fd, data) } } else { /* we can terminate connection right now */ - cached_error(entry, ERR_NO_CLIENTS_BIG_OBJ); + cached_error_entry(entry, ERR_NO_CLIENTS_BIG_OBJ, NULL); comm_close(fd); safe_free(data); return; } } - len = read(fd, buf, 4096); + len = read(fd, buf, READBUFSIZ); debug(5, "httpReadReply: FD %d: len %d.\n", fd, len); if (len < 0 || ((len == 0) && (entry->mem_obj->e_current_len == 0))) { @@ -215,7 +216,7 @@ void httpReadReply(fd, data) storeAppend(entry, tmp_error_buf, strlen(tmp_error_buf)); storeComplete(entry); } else { - cached_error(entry, ERR_READ_ERROR); + cached_error_entry(entry, ERR_READ_ERROR, xstrerror()); } comm_close(fd); safe_free(data); @@ -240,7 +241,7 @@ void httpReadReply(fd, data) } else if (entry->flag & CLIENT_ABORT_REQUEST) { /* append the last bit of info we get */ storeAppend(entry, buf, len); - cached_error(entry, ERR_CLIENT_ABORT); + cached_error_entry(entry, ERR_CLIENT_ABORT, NULL); comm_close(fd); safe_free(data); } else { @@ -275,7 +276,7 @@ void httpSendComplete(fd, buf, size, errflag, data) data->icp_rwd_ptr = NULL; /* Don't double free in lifetimeexpire */ if (errflag) { - cached_error(entry, ERR_CONNECT_FAIL); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); comm_close(fd); safe_free(data); return; @@ -382,7 +383,7 @@ void httpConnInProgress(fd, data) break; /* cool, we're connected */ default: comm_close(fd); - cached_error(entry, ERR_CONNECT_FAIL); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); return; } @@ -421,7 +422,7 @@ int proxyhttpStart(e, url, entry) sock = comm_open(COMM_NONBLOCKING, 0, 0, url); if (sock == COMM_ERROR) { debug(4, "proxyhttpStart: Failed because we're out of sockets.\n"); - cached_error(entry, ERR_NO_FDS); + cached_error_entry(entry, ERR_NO_FDS, xstrerror()); safe_free(data); return COMM_ERROR; } @@ -431,7 +432,7 @@ int proxyhttpStart(e, url, entry) if (!ipcache_gethostbyname(data->host)) { debug(4, "proxyhttpstart: Called without IP entry in ipcache. OR lookup failed.\n"); comm_close(sock); - cached_error(entry, ERR_DNS_FAIL, dns_error_message); + cached_error_entry(entry, ERR_DNS_FAIL, dns_error_message); safe_free(data); return COMM_ERROR; } @@ -439,7 +440,7 @@ int proxyhttpStart(e, url, entry) if ((status = comm_connect(sock, data->host, data->port))) { if (status != EINPROGRESS) { comm_close(sock); - cached_error(entry, ERR_CONNECT_FAIL); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); e->last_fail_time = cached_curtime; e->neighbor_up = 0; @@ -484,7 +485,7 @@ int httpStart(unusedfd, url, type, mime_hdr, entry) /* Parse url. */ if (http_url_parser(url, data->host, &data->port, data->request)) { - cached_error(entry, ERR_INVALID_URL); + cached_error_entry(entry, ERR_INVALID_URL, NULL); safe_free(data); return COMM_ERROR; } @@ -492,7 +493,7 @@ int httpStart(unusedfd, url, type, mime_hdr, entry) sock = comm_open(COMM_NONBLOCKING, 0, 0, url); if (sock == COMM_ERROR) { debug(4, "httpStart: Failed because we're out of sockets.\n"); - cached_error(entry, ERR_NO_FDS); + cached_error_entry(entry, ERR_NO_FDS, xstrerror()); safe_free(data); return COMM_ERROR; } @@ -502,7 +503,7 @@ int httpStart(unusedfd, url, type, mime_hdr, entry) if (!ipcache_gethostbyname(data->host)) { debug(4, "httpstart: Called without IP entry in ipcache. OR lookup failed.\n"); comm_close(sock); - cached_error(entry, ERR_DNS_FAIL, dns_error_message); + cached_error_entry(entry, ERR_DNS_FAIL, dns_error_message); safe_free(data); return COMM_ERROR; } @@ -510,7 +511,7 @@ int httpStart(unusedfd, url, type, mime_hdr, entry) if ((status = comm_connect(sock, data->host, data->port))) { if (status != EINPROGRESS) { comm_close(sock); - cached_error(entry, ERR_CONNECT_FAIL); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); return COMM_ERROR; } else { diff --git a/src/store.cc b/src/store.cc index 065befbcbf..afca85c03f 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,5 +1,5 @@ -/* $Id: store.cc,v 1.6 1996/03/23 00:03:04 wessels Exp $ */ +/* $Id: store.cc,v 1.7 1996/03/25 19:05:52 wessels Exp $ */ /* * Here is a summary of the routines which change mem_status and swap_status: @@ -2553,7 +2553,7 @@ int swapInError(fd_unused, entry) int fd_unused; StoreEntry *entry; { - cached_error(entry, ERR_DISK_IO, xstrerror()); + cached_error_entry(entry, ERR_DISK_IO, xstrerror()); return 0; } diff --git a/src/wais.cc b/src/wais.cc index f2915ce257..8b261e0bc4 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,4 +1,4 @@ -/* $Id: wais.cc,v 1.6 1996/03/23 00:03:05 wessels Exp $ */ +/* $Id: wais.cc,v 1.7 1996/03/25 19:05:52 wessels Exp $ */ #include "config.h" #if USE_WAIS_RELAY @@ -55,7 +55,7 @@ void waisReadReplyTimeout(fd, data) entry = data->entry; debug(4, "waisReadReplyTimeout: Timeout on %d\n url: %s\n", fd, entry->url); - cached_error(entry, ERR_READ_TIMEOUT); + cached_error_entry(entry, ERR_READ_TIMEOUT); comm_set_select_handler(fd, COMM_SELECT_READ, 0, 0); comm_close(fd); safe_free(data); @@ -70,7 +70,7 @@ void waisLifetimeExpire(fd, data) entry = data->entry; debug(4, "waisLifeTimeExpire: FD %d: \n", fd, entry->url); - cached_error(entry, ERR_LIFETIME_EXP); + cached_error_entry(entry, ERR_LIFETIME_EXP); comm_set_select_handler(fd, COMM_SELECT_READ | COMM_SELECT_WRITE, 0, 0); comm_close(fd); safe_free(data); @@ -108,7 +108,7 @@ void waisReadReply(fd, data) } } else { /* we can terminate connection right now */ - cached_error(entry, ERR_NO_CLIENTS_BIG_OBJ); + cached_error_entry(entry, ERR_NO_CLIENTS_BIG_OBJ); comm_close(fd); safe_free(data); return; @@ -129,7 +129,7 @@ void waisReadReply(fd, data) storeAppend(entry, tmp_error_buf, strlen(tmp_error_buf)); storeComplete(entry); } else { - cached_error(entry, ERR_READ_ERROR); + cached_error_entry(entry, ERR_READ_ERROR); } comm_close(fd); safe_free(data); @@ -171,7 +171,7 @@ void waisSendComplete(fd, buf, size, errflag, data) debug(5, "waisSendComplete - fd: %d size: %d errflag: %d\n", fd, size, errflag); if (errflag) { - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); comm_close(fd); safe_free(data); } else { @@ -230,7 +230,7 @@ int waisStart(unusedfd, url, type, mime_hdr, entry) if (!getWaisRelayHost()) { debug(0, "waisStart: Failed because no relay host defined!\n"); - cached_error(entry, ERR_NO_RELAY); + cached_error_entry(entry, ERR_NO_RELAY); safe_free(data); return COMM_ERROR; } @@ -243,7 +243,7 @@ int waisStart(unusedfd, url, type, mime_hdr, entry) sock = comm_open(COMM_NONBLOCKING, 0, 0, url); if (sock == COMM_ERROR) { debug(4, "waisStart: Failed because we're out of sockets.\n"); - cached_error(entry, ERR_NO_FDS); + cached_error_entry(entry, ERR_NO_FDS); safe_free(data); return COMM_ERROR; } @@ -253,7 +253,7 @@ int waisStart(unusedfd, url, type, mime_hdr, entry) if (!ipcache_gethostbyname(data->host)) { debug(4, "waisstart: Called without IP entry in ipcache. OR lookup failed.\n"); comm_close(sock); - cached_error(entry, ERR_DNS_FAIL, dns_error_message); + cached_error_entry(entry, ERR_DNS_FAIL, dns_error_message); safe_free(data); return COMM_ERROR; } @@ -261,7 +261,7 @@ int waisStart(unusedfd, url, type, mime_hdr, entry) if ((status = comm_connect(sock, data->host, data->port))) { if (status != EINPROGRESS) { comm_close(sock); - cached_error(entry, ERR_CONNECT_FAIL, xstrerror()); + cached_error_entry(entry, ERR_CONNECT_FAIL, xstrerror()); safe_free(data); return COMM_ERROR; } else {