never get saved to disk.
- Merged some parsing routines into parseWordlist().
- Fixed icpHandleIMSReply() bug when HTTP reply headers
received in multiple reads.
- Changed all ipcache_nbgethostbyname() handler functions
to be void.
- Fixed bug when storeLockObject() fails for UDP_HIT_OBJ
replies.
- Simplified storeGet().
- Removed meta_data.hash_links member.
/*
- * $Id: cache_cf.cc,v 1.91 1996/09/17 16:32:32 wessels Exp $
+ * $Id: cache_cf.cc,v 1.92 1996/09/18 20:12:16 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static void parseCacheAnnounceLine __P((void));
static void parseCacheHostLine __P((void));
static void parseDebugOptionsLine __P((void));
-static void parseDirLine __P((void));
static void parseDnsProgramLine __P((void));
-static void parseDnsTestnameLine __P((void));
static void parseEffectiveUserLine __P((void));
static void parseErrHtmlLine __P((void));
static void parseFtpLine __P((void));
static void parseFtpProgramLine __P((void));
static void parseFtpUserLine __P((void));
static void parseGopherLine __P((void));
-static void parseHierarchyStoplistLine __P((void));
+static void parseWordlist __P((wordlist **));
static void parseHostAclLine __P((void));
static void parseHostDomainLine __P((void));
static void parseHotVmFactorLine __P((void));
static void parseHttpdAccelLine __P((void));
static void parseIPLine __P((ip_acl ** list));
static void parseIcpPortLine __P((void));
-static void parseInsideFirewallLine __P((void));
static void parseLocalDomainFile __P((char *fname));
static void parseLocalDomainLine __P((void));
static void parseLogLine __P((void));
Config.adminEmail = xstrdup(token);
}
-static void
-parseDirLine(void)
-{
- char *token;
-
- token = strtok(NULL, w_space);
- if (token == NULL)
- self_destruct();
- wordlistAdd(&Config.cache_dirs, token);
-}
-
#if USE_PROXY_AUTH
static void
parseProxyAuthLine(void)
}
static void
-parseHierarchyStoplistLine(void)
+parseWordlist(wordlist **list)
{
char *token;
while ((token = strtok(NULL, w_space)))
- wordlistAdd(&Config.hierarchy_stoplist, token);
+ wordlistAdd(list, token);
}
static void
}
}
-static void
-parseInsideFirewallLine(void)
-{
- char *token;
- while ((token = strtok(NULL, w_space))) {
- wordlistAdd(&Config.inside_firewall_list, token);
- }
-}
-
-static void
-parseDnsTestnameLine(void)
-{
- char *token;
- while ((token = strtok(NULL, w_space))) {
- wordlistAdd(&Config.dns_testname_list, token);
- }
-}
-
static void
parseHttpPortLine(void)
{
parseIntegerValue(&Config.neighborTimeout);
else if (!strcmp(token, "cache_dir"))
- parseDirLine();
+ parseWordlist(&Config.cache_dirs);
else if (!strcmp(token, "cache_log"))
parseLogLine();
aclParseAccessLine(&ICPAccessList);
else if (!strcmp(token, "hierarchy_stoplist"))
- parseHierarchyStoplistLine();
+ parseWordlist(&Config.hierarchy_stoplist);
+
+ else if (!strcmp(token, "cache_stoplist"))
+ parseWordlist(&Config.cache_stoplist);
else if (!strcmp(token, "gopher"))
parseGopherLine();
parseIcpPortLine();
else if (!strcmp(token, "inside_firewall"))
- parseInsideFirewallLine();
+ parseWordlist(&Config.inside_firewall_list);
else if (!strcmp(token, "dns_testnames"))
- parseDnsTestnameLine();
+ parseWordlist(&Config.dns_testname_list);
else if (!strcmp(token, "single_parent_bypass"))
parseOnOff(&Config.singleParentBypass);
/*
- * $Id: client_side.cc,v 1.30 1996/09/17 16:32:34 wessels Exp $
+ * $Id: client_side.cc,v 1.31 1996/09/18 20:12:17 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
{
icpStateData *icpState = data;
MemObject *mem = entry->mem_obj;
- LOCAL_ARRAY(char, hbuf, 8192);
+ char *hbuf;
int len;
int unlink_request = 0;
debug(33, 3, "icpHandleIMSReply: FD %d '%s'\n", fd, entry->url);
400);
return 0;
}
+ if (mem->reply->code == 0) {
+ debug(33,0,"icpHandleIMSReply: Incomplete headers for '%s'\n",
+ entry->url);
+ storeRegister(entry,
+ fd,
+ (PIF) icpHandleIMSReply,
+ (void *) icpState);
+ return 0;
+ }
if (mem->reply->code == 304 && !BIT_TEST(icpState->flags, REQ_IMS)) {
icpState->log_type = LOG_TCP_EXPIRED_HIT;
/* We initiated the IMS request, the client is not expecting
/* Extend the TTL
* XXX race condition here. Assumes old_entry has been swapped
* in by the time this 304 reply arrives. */
+ hbuf = get_free_8k_page();
storeClientCopy(entry, 0, 8191, hbuf, &len, fd);
if (!mime_headers_end(hbuf))
fatal_dump("icpHandleIMSReply: failed to load headers, lost race");
httpParseHeaders(hbuf, entry->mem_obj->reply);
+ put_free_8k_page(hbuf);
ttlSet(entry);
if (unlink_request) {
requestUnlink(entry->mem_obj->request);
/*
- * $Id: http.cc,v 1.76 1996/09/16 21:11:08 wessels Exp $
+ * $Id: http.cc,v 1.77 1996/09/18 20:12:18 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
static void httpSendComplete __P((int fd, char *, int, int, void *));
static void httpSendRequest __P((int fd, HttpStateData *));
static void httpConnInProgress __P((int fd, HttpStateData *));
-static int httpConnect __P((int fd, struct hostent *, void *));
+static void httpConnect __P((int fd, struct hostent *, void *));
static int
httpStateFree(int fd, HttpStateData * httpState)
if (hdr_len > 4 && strncmp(httpState->reply_hdr, "HTTP/", 5)) {
debug(11, 3, "httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", entry->key);
httpState->reply_hdr_state += 2;
+ entry->mem_obj->reply->code = 555;
return;
}
- /* Find the end of the headers */
- t = mime_headers_end(httpState->reply_hdr);
- if (!t)
- /* XXX: Here we could check for buffer overflow... */
+ if ((t = mime_headers_end(httpState->reply_hdr)) == NULL)
return; /* headers not complete */
- /* Cut after end of headers */
*t = '\0';
reply = entry->mem_obj->reply;
reply->hdr_sz = t - httpState->reply_hdr;
comm_add_close_handler(sock,
(PF) httpStateFree,
(void *) httpState);
-
request->method = entry->method;
strncpy(request->host, e->host, SQUIDHOSTNAMELEN);
request->port = e->http_port;
strncpy(request->urlpath, url, MAX_URL);
ipcache_nbgethostbyname(request->host,
sock,
- (IPH) httpConnect,
+ httpConnect,
httpState);
return COMM_OK;
}
-static int
+static void
httpConnect(int fd, struct hostent *hp, void *data)
{
HttpStateData *httpState = data;
debug(11, 4, "httpConnect: Unknown host: %s\n", request->host);
squid_error_entry(entry, ERR_DNS_FAIL, dns_error_message);
comm_close(fd);
- return COMM_ERROR;
+ return;
}
/* Open connection. */
if ((status = comm_connect(fd, request->host, request->port))) {
e->last_fail_time = squid_curtime;
e->neighbor_up = 0;
}
- return COMM_ERROR;
+ return;
} else {
debug(11, 5, "proxyhttpStart: FD %d: EINPROGRESS.\n", fd);
comm_set_select_handler(fd, COMM_SELECT_LIFETIME,
(PF) httpLifetimeExpire, (void *) httpState);
comm_set_select_handler(fd, COMM_SELECT_WRITE,
(PF) httpConnInProgress, (void *) httpState);
- return COMM_OK;
+ return;
}
}
/* Install connection complete handler. */
(PF) httpLifetimeExpire, (void *) httpState);
comm_set_select_handler(fd, COMM_SELECT_WRITE,
(PF) httpSendRequest, (void *) httpState);
- return COMM_OK;
}
int
sock,
httpConnect,
httpState);
-
return COMM_OK;
}
/*
- * $Id: squid.h,v 1.52 1996/09/17 16:54:05 wessels Exp $
+ * $Id: squid.h,v 1.53 1996/09/18 20:12:22 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#include "redirect.h"
#include "client_side.h"
#include "icmp.h"
+#include "net_db.h"
#if !HAVE_TEMPNAM
#include "tempnam.h"
/*
- * $Id: ssl.cc,v 1.16 1996/09/16 21:11:15 wessels Exp $
+ * $Id: ssl.cc,v 1.17 1996/09/18 20:12:22 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
static void sslWriteClient __P((int fd, SslStateData * sslState));
static void sslConnected __P((int fd, SslStateData * sslState));
static void sslProxyConnected __P((int fd, SslStateData * sslState));
-static int sslConnect __P((int fd, struct hostent *, SslStateData *));
+static void sslConnect __P((int fd, struct hostent *, void *));
static void sslConnInProgress __P((int fd, SslStateData * sslState));
static void sslErrorComplete __P((int, char *, int, int, void *));
static void sslClose __P((SslStateData * sslState));
return;
}
-static int
-sslConnect(int fd, struct hostent *hp, SslStateData * sslState)
+static void
+sslConnect(int fd, struct hostent *hp, void *data)
{
+ SslStateData *sslState = data;
request_t *request = sslState->request;
int status;
char *buf = NULL;
sslErrorComplete,
(void *) sslState,
xfree);
- return COMM_ERROR;
+ return;
}
debug(26, 5, "sslConnect: client=%d server=%d\n",
sslState->client.fd,
sslErrorComplete,
(void *) sslState,
xfree);
- return COMM_ERROR;
+ return;
} else {
debug(26, 5, "sslConnect: conn %d EINPROGRESS\n", fd);
/* The connection is in progress, install ssl handler */
COMM_SELECT_WRITE,
(PF) sslConnInProgress,
(void *) sslState);
- return COMM_OK;
+ return;
}
}
if (opt_no_ipcache)
sslProxyConnected(sslState->server.fd, sslState);
else
sslConnected(sslState->server.fd, sslState);
- return COMM_OK;
}
int
(void *) sslState);
ipcache_nbgethostbyname(sslState->host,
sslState->server.fd,
- (IPH) sslConnect,
+ sslConnect,
sslState);
return COMM_OK;
}
/*
- * $Id: stat.cc,v 1.72 1996/09/17 16:32:46 wessels Exp $
+ * $Id: stat.cc,v 1.73 1996/09/18 20:12:23 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
meta_data.store_entries * sizeof(StoreEntry) +
meta_data.ipcache_count * sizeof(ipcache_entry) +
meta_data.fqdncache_count * sizeof(fqdncache_entry) +
- meta_data.hash_links * sizeof(hash_link) +
+ hash_links_allocated * sizeof(hash_link) +
sm_stats.total_pages_allocated * sm_stats.page_size +
disk_stats.total_pages_allocated * disk_stats.page_size +
request_pool.total_pages_allocated * request_pool.page_size +
storeAppendPrintf(sentry, "{\t%-25.25s %7d x %4d bytes = %6d KB}\n",
"Hash link",
- meta_data.hash_links = hash_links_allocated,
+ hash_links_allocated,
(int) sizeof(hash_link),
- (int) (meta_data.hash_links * sizeof(hash_link) >> 10));
+ (int) (hash_links_allocated * sizeof(hash_link) >> 10));
storeAppendPrintf(sentry, "{\t%-25.25s = %6d KB}\n",
"URL strings",
/*
- * $Id: store.cc,v 1.113 1996/09/17 02:30:05 wessels Exp $
+ * $Id: store.cc,v 1.114 1996/09/18 20:12:25 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
StoreEntry *
storeGet(char *url)
{
- hash_link *hptr = NULL;
-
debug(20, 3, "storeGet: looking up %s\n", url);
-
- if ((hptr = hash_lookup(store_table, url)) != NULL)
- return (StoreEntry *) hptr;
- return NULL;
+ return (StoreEntry *) hash_lookup(store_table, url);
}
unsigned int
debug(20, 0, "storeRelease: Not Found: '%s'\n", e->key);
debug(20, 0, "Dump of Entry 'e':\n %s\n", storeToString(e));
debug_trap("storeRelease: Invalid Entry");
+ return;
}
result = (StoreEntry *) hptr;
if (result != e) {
debug(20, 0, "Dump of Entry 'e':\n%s", storeToString(e));
debug(20, 0, "Dump of Entry 'result':\n%s", storeToString(result));
debug_trap("storeRelease: Duplicate Entry");
+ return;
}
}
if (e->method == METHOD_GET) {
/*
- * $Id: tunnel.cc,v 1.16 1996/09/16 21:11:15 wessels Exp $
+ * $Id: tunnel.cc,v 1.17 1996/09/18 20:12:22 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
static void sslWriteClient __P((int fd, SslStateData * sslState));
static void sslConnected __P((int fd, SslStateData * sslState));
static void sslProxyConnected __P((int fd, SslStateData * sslState));
-static int sslConnect __P((int fd, struct hostent *, SslStateData *));
+static void sslConnect __P((int fd, struct hostent *, void *));
static void sslConnInProgress __P((int fd, SslStateData * sslState));
static void sslErrorComplete __P((int, char *, int, int, void *));
static void sslClose __P((SslStateData * sslState));
return;
}
-static int
-sslConnect(int fd, struct hostent *hp, SslStateData * sslState)
+static void
+sslConnect(int fd, struct hostent *hp, void *data)
{
+ SslStateData *sslState = data;
request_t *request = sslState->request;
int status;
char *buf = NULL;
sslErrorComplete,
(void *) sslState,
xfree);
- return COMM_ERROR;
+ return;
}
debug(26, 5, "sslConnect: client=%d server=%d\n",
sslState->client.fd,
sslErrorComplete,
(void *) sslState,
xfree);
- return COMM_ERROR;
+ return;
} else {
debug(26, 5, "sslConnect: conn %d EINPROGRESS\n", fd);
/* The connection is in progress, install ssl handler */
COMM_SELECT_WRITE,
(PF) sslConnInProgress,
(void *) sslState);
- return COMM_OK;
+ return;
}
}
if (opt_no_ipcache)
sslProxyConnected(sslState->server.fd, sslState);
else
sslConnected(sslState->server.fd, sslState);
- return COMM_OK;
}
int
(void *) sslState);
ipcache_nbgethostbyname(sslState->host,
sslState->server.fd,
- (IPH) sslConnect,
+ sslConnect,
sslState);
return COMM_OK;
}
/*
- * $Id: wais.cc,v 1.42 1996/09/16 21:11:17 wessels Exp $
+ * $Id: wais.cc,v 1.43 1996/09/18 20:12:25 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
static void waisSendComplete __P((int, char *, int, int, void *));
static void waisSendRequest __P((int, WaisStateData *));
static void waisConnInProgress __P((int, WaisStateData *));
-static int waisConnect __P((int, struct hostent *, WaisStateData *));
+static void waisConnect __P((int, struct hostent *, void *));
static int
waisStateFree(int fd, WaisStateData * waisState)
(void *) waisState);
ipcache_nbgethostbyname(waisState->relayhost,
waisState->fd,
- (IPH) waisConnect,
+ waisConnect,
waisState);
return COMM_OK;
}
-static int
-waisConnect(int fd, struct hostent *hp, WaisStateData * waisState)
+static void
+waisConnect(int fd, struct hostent *hp, void *data)
{
int status;
+ WaisStateData *waisState = data;
char *host = waisState->relayhost;
u_short port = waisState->relayport;
if (!ipcache_gethostbyname(waisState->relayhost, 0)) {
debug(24, 4, "waisstart: Unknown host: %s\n", waisState->relayhost);
squid_error_entry(waisState->entry, ERR_DNS_FAIL, dns_error_message);
comm_close(waisState->fd);
- return COMM_ERROR;
+ return;
}
/* Open connection. */
if ((status = comm_connect(fd, host, port))) {
if (status != EINPROGRESS) {
squid_error_entry(waisState->entry, ERR_CONNECT_FAIL, xstrerror());
comm_close(fd);
- return COMM_ERROR;
+ return;
} else {
debug(24, 5, "waisStart: FD %d EINPROGRESS\n", fd);
comm_set_select_handler(fd,
COMM_SELECT_WRITE,
(PF) waisConnInProgress,
(void *) waisState);
- return COMM_OK;
+ return;
}
}
/* Install connection complete handler. */
COMM_SELECT_WRITE,
(PF) waisSendRequest,
(void *) waisState);
- return COMM_OK;
}