-/* $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 <stdio.h>
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);
}
} 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);
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);
} 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);
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;
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;
}
/* 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;
}
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;
}
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 {
-/* $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 <errno.h>
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)
StoreEntry *entry = NULL;
entry = data->entry;
debug(4, "gopherLifeTimeExpire: FD %d: <URL:%s>\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)
}
} 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;
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) {
} 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);
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)
/* 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;
}
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;
}
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;
}
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 {
-/* $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 <sys/errno.h>
#define HTTP_PORT 80
#define HTTP_DELETE_GAP (64*1024)
+#define READBUFSIZ 4096
extern int errno;
extern char *dns_error_message;
entry = data->entry;
debug(4, "httpReadReplyTimeout: FD %d: <URL:%s>\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) {
entry = data->entry;
debug(4, "httpLifeTimeExpire: FD %d: <URL:%s>\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;
int fd;
HttpData *data;
{
- static char buf[4096];
+ static char buf[READBUFSIZ];
int len;
int clen;
int off;
}
} 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))) {
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);
} 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 {
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;
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;
}
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;
}
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;
}
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;
/* 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;
}
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;
}
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;
}
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 {
-/* $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:
int fd_unused;
StoreEntry *entry;
{
- cached_error(entry, ERR_DISK_IO, xstrerror());
+ cached_error_entry(entry, ERR_DISK_IO, xstrerror());
return 0;
}
-/* $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
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);
entry = data->entry;
debug(4, "waisLifeTimeExpire: FD %d: <URL:%s>\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);
}
} 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;
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);
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 {
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;
}
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;
}
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;
}
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 {