Jon Thackray <jrmt@uk.gdscorp.com>
John Saunders <johns@rd.scitec.com.au>
Endre Balint Nagy <bne@CareNet.hu>
+ Geoff Keating <Geoff.Keating@anu.edu.au>
Development of this caching software is funded by the National Science
replies.
- Simplified storeGet().
- Removed meta_data.hash_links member.
+ - Includes squid-1.0 changes up to 1.0.16.
Changes to squid-1.1.beta2 (September 16, 1996):
==============================================================================
+Changes to squid-1.0.16 (September 16, 1996):
+
+ - Fixed shadow passwd support (John Saunders).
+ - Added checkFailureRatio() to detect high fail:success ratios
+ and go into ICP "hit only" mode for 5 minutes when the ratio
+ exceeds 1.
+ - Added ip_acl_destroy() to reset 'local_ip' and 'firewall_ip'
+ on HUP signal.
+
+Changes to squid-1.0.15 (September 13, 1996):
+
+ - Fixed stupid bugs from moving icpState->flags to
+ request->flags.
+
+Changes to squid-1.0.14 (September 13, 1996):
+
+ - Added '#if DELAY_HACK' code for Mike Groeneweg
+ <mikeg@scorpion.murdoch.edu.au>.
+ - Fixed debug bug in ttlSet().
+ - Moved icpState->flags to request->flags.
+ - Fixed edgeWouldBePinged() to skip SIBLINGS and NO-CACHE
+ requests.
+ - Fixed bad SET/TEST in httpProcessReplyHeader() (Miguel A.L.
+ Paraz).
+
+Changes to squid-1.0.13 (September 12, 1996):
+
+ - Fixed ftpget parsing PASV reply bug (Carson Gaspar).
+ - Forced include of <netinet/in_systm.h> for NeXT (Holger
+ Hoffstaette).
+ - Promulgate tcp_outgoing_addr to ftpget with -o option (Edward
+ Moy).
+ - add Date: header to Squid-generated Gopher objects (Geoffrey
+ Keating).
+ - cachemgr.cgi HTML fixes (Cord Beermann).
+ - Collapsed some config parsing functions to parseOnOff().
+ - Added config option: memory_pools on|off
+ - Added config option: udp_hit_obj on|off
+ - Added config option: forwarded_for on|off
+ - Copied better stmem.c and stack.c routines from v1.1 code.
+ - Added support for HTTP/1.1 Cache-Controls 'private' and
+ 'no-cache'.
+ - Copied dnsserver "hello/alive" test from v1.1 code.
+
Changes to squid-1.0.12 (September 3, 1996):
- Fixed urlCheckRequest() to allow CONNECT/SSL requests.
-# From configure.in Revision: 1.34
+# From configure.in Revision: 1.35
ac_aux_dir=
for ac_dir in aux $srcdir/aux; do
if test -f $ac_dir/install-sh; then
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.in,v 1.40 1996/09/16 21:50:23 wessels Exp $
+# $Id: Makefile.in,v 1.41 1996/09/18 21:39:26 wessels Exp $
#
# Uncomment and customize the following to suit your needs:
#
AUTH_OPT = # -DUSE_PROXY_AUTH=1
LOG_HDRS_OPT = # -DLOG_FULL_HEADERS=1
ICMP_OPT = # -DUSE_ICMP=1
-DEFINES = $(HOST_OPT) $(AIO_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) $(ICMP_OPT)
+DELAY_HACK = # -DDELAY_HACK=1
+DEFINES = $(HOST_OPT) $(AIO_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) $(ICMP_OPT) \
+ $(DELAY_HACK)
prefix = @prefix@
exec_prefix = @exec_prefix@
mkdir $(localstatedir)/logs; \
fi
+# Michael Lupp <mike@nemesis.saar.de> wants to know about additions
+# to the install target.
install: all install-mkdirs
@for f in $(PROGS); do \
if test -f $(bindir)/$$f; then \
/*
- * $Id: acl.cc,v 1.41 1996/09/17 16:32:31 wessels Exp $
+ * $Id: acl.cc,v 1.42 1996/09/18 21:39:27 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
struct _acl_deny_info_list *DenyInfoList = NULL;
struct _acl_access *HTTPAccessList = NULL;
struct _acl_access *ICPAccessList = NULL;
+#if DELAY_HACK
+struct _acl_access *DelayAccessList = NULL;
+#endif
static struct _acl *AclList = NULL;
static struct _acl **AclListTail = &AclList;
/*
- * $Id: cache_cf.cc,v 1.93 1996/09/18 20:13:02 wessels Exp $
+ * $Id: cache_cf.cc,v 1.94 1996/09/18 21:39:28 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static void parseOnOff __P((int *));
static void parseIntegerValue __P((int *));
static char fatal_str[BUFSIZ];
+
static void configDoConfigure __P((void));
static void configFreeMemory __P((void));
static void configSetFactoryDefaults __P((void));
static void parseVisibleHostnameLine __P((void));
static void parseWAISRelayLine __P((void));
static void parseMinutesLine __P((int *));
+static void ip_acl_destroy __P((ip_acl **));
void
self_destruct(void)
return 0;
}
+static void
+ip_acl_destroy(a)
+ ip_acl **a;
+{
+ ip_acl *b;
+ ip_acl *n;
+ for (b = *a; b; b = n) {
+ n = b->next;
+ safe_free(b);
+ }
+ a = NULL;
+}
ip_access_type
ip_access_check(struct in_addr address, ip_acl * list)
/* Use this #define in all the parse*() functions. Assumes
- * ** char *token is defined
- */
+ * char *token is defined */
#define GetInteger(var) \
token = strtok(NULL, w_space); \
neighbors_cf_acl(host, aclname);
}
-
static void
parseMemLine(void)
{
aclDestroyDenyInfoList(&DenyInfoList);
aclDestroyAccessList(&HTTPAccessList);
aclDestroyAccessList(&ICPAccessList);
+#if DELAY_HACK
+ aclDestroyAccessList(&DelayAccessList);
+#endif
if ((fp = fopen(file_name, "r")) == NULL) {
sprintf(fatal_str, "Unable to open configuration file: %s: %s",
else if (!strcmp(token, "cache_stoplist"))
parseWordlist(&Config.cache_stoplist);
+#if DELAY_HACK
+ else if (!strcmp(token, "delay_access"))
+ aclParseAccessLine(&DelayAccessList);
+#endif
+
else if (!strcmp(token, "gopher"))
parseGopherLine();
else if (!strcmp(token, "ipcache_high"))
parseIntegerValue(&Config.ipcache.high);
+ else if (!strcmp(token, "memory_pools"))
+ parseOnOff(&opt_mem_pools);
+ else if (!strcmp(token, "udp_hit_obj"))
+ parseOnOff(&opt_udp_hit_obj);
+ else if (!strcmp(token, "forwarded_for"))
+ parseOnOff(&opt_forwarded_for);
+
+ /* If unknown, treat as a comment line */
else {
debug(3, 0, "parseConfigFile: line %d unrecognized: '%s'\n",
config_lineno,
safe_free(Config.Announce.host);
safe_free(Config.Announce.file);
safe_free(Config.errHtmlText);
+ safe_free(Config.sslProxy.host);
wordlistDestroy(&Config.cache_dirs);
wordlistDestroy(&Config.hierarchy_stoplist);
wordlistDestroy(&Config.local_domain_list);
wordlistDestroy(&Config.inside_firewall_list);
wordlistDestroy(&Config.dns_testname_list);
- safe_free(Config.sslProxy.host);
+ ip_acl_destroy(&Config.local_ip_list);
+ ip_acl_destroy(&Config.firewall_ip_list);
ttlFreeList();
}
/*
- * $Id: cachemgr.cc,v 1.26 1996/09/17 16:54:02 wessels Exp $
+ * $Id: cachemgr.cc,v 1.27 1996/09/18 21:39:29 wessels Exp $
*
* DEBUG: Section 0 CGI Cache Manager
* AUTHOR: Harvest Derived
printf("<FORM METHOD=\"POST\" ACTION=\"%s?%s:%d\">\n",
script_name, host, port);
printf("<STRONG>Cache Host:</STRONG><INPUT NAME=\"host\" ");
- printf("SIZE=30 VALUE=\"%s\">\n\n", host);
+ printf("SIZE=30 VALUE=\"%s\"><BR>\n", CACHEMGR_HOSTNAME);
printf("<STRONG>Cache Port:</STRONG><INPUT NAME=\"port\" ");
- printf("SIZE=30 VALUE=\"%d\">\n\n", port);
+ printf("SIZE=30 VALUE=\"%d\"><BR>\n", CACHE_HTTP_PORT);
printf("<STRONG>Password :</STRONG><INPUT TYPE=\"password\" ");
- printf("NAME=\"password\" SIZE=30 VALUE=\"\">\n\n");
+ printf("NAME=\"password\" SIZE=30 VALUE=\"\"><BR>\n");
printf("<STRONG>URL :</STRONG><INPUT NAME=\"url\" ");
- printf("SIZE=30 VALUE=\"\">\n\n");
+ printf("SIZE=30 VALUE=\"\"><BR>\n");
printf("<STRONG>Operation :</STRONG>");
printf("<SELECT NAME=\"operation\">\n");
printf("<OPTION SELECTED VALUE=\"info\">Cache Information\n");
#ifdef REMOVE_OBJECT
printf("<OPTION VALUE=\"remove\">Remove Object (URL required)\n");
#endif
- printf("</SELECT>\n\n");
+ printf("</SELECT><BR>\n");
printf("<HR>\n");
printf("<INPUT TYPE=\"submit\"> <INPUT TYPE=\"reset\">\n");
printf("</FORM></PRE>\n");
break;
case STATS_U:
if (hasTables) {
- printf("<table border=1><tr><td><STRONG>Protocol</STRONG><td><STRONG>Count</STRONG><td><STRONG>Max KB</STRONG><td><STRONG>Current KB</STRONG><td><STRONG>Min KB</STRONG><td><STRONG>Hit Ratio</STRONG><td><STRONG>Transfer Rate</STRONG><td><STRONG>References</STRONG><td><STRONG>Transfered KB</STRONG>\n");
+ printf("<table border=1><tr><td><STRONG>Protocol</STRONG><td><STRONG>Object Count</STRONG><td><STRONG>Max KB</STRONG><td><STRONG>Current KB</STRONG><td><STRONG>Min KB</STRONG><td><STRONG>Hit Ratio</STRONG><td><STRONG>Transfer KB/sec</STRONG><td><STRONG>Transfer Count</STRONG><td><STRONG>Transfered KB</STRONG>\n");
in_table = 1;
} else {
- printf("Protocol Count Maximum Current Minimum Hit Trans Transfer Transfered\n");
- printf(" KB KB KB Rate KB/sec Count KB\n");
+ printf("Protocol Object Maximum Current Minimum Hit Trans Transfer Transfered\n");
+ printf(" Count KB KB KB Rate KB/sec Count KB\n");
printf("-------- ------- --------- --------- --------- ---- ------ --------- ----------\n");
}
break;
/*
- * $Id: client_side.cc,v 1.32 1996/09/18 20:13:03 wessels Exp $
+ * $Id: client_side.cc,v 1.33 1996/09/18 21:39:30 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
static void clientRedirectDone __P((void *data, char *result));
static int icpHandleIMSReply __P((int fd, StoreEntry * entry, void *data));
+static void clientLookupDstIPDone __P((int fd, struct hostent *hp, void *data));
+static void clientLookupSrcFQDNDone __P((int fd, char *fqdn, void *data));
-static int
+static void
clientLookupDstIPDone(int fd, struct hostent *hp, void *data)
{
icpStateData *icpState = data;
inet_ntoa(icpState->aclChecklist->dst_addr));
}
clientAccessCheck(icpState, icpState->aclHandler);
- return 1;
+ return;
}
static void
clientLookupIdentDone(void *data)
{
}
-
#endif
#if USE_PROXY_AUTH
#endif /* USE_PROXY_AUTH */
void
-clientAccessCheck(icpStateData * icpState,
- void (*handler) (icpStateData *,
- int))
+clientAccessCheck(icpStateData * icpState, void (*handler) (icpStateData *, int))
{
int answer = 1;
request_t *r = icpState->request;
icpState->aclHandler = handler;
if (httpd_accel_mode && !Config.Accel.withProxy && r->protocol != PROTO_CACHEOBJ) {
/* this cache is an httpd accelerator ONLY */
- if (!BIT_TEST(icpState->flags, REQ_ACCEL))
+ if (!BIT_TEST(icpState->request->flags, REQ_ACCEL))
answer = 0;
} else {
answer = aclCheck(HTTPAccessList, ch);
(PF) icpDetectClientClose,
(void *) icpState);
icpProcessRequest(fd, icpState);
-#if USE_PROXY_AUTH
}
+#if USE_PROXY_AUTH
/* Check the modification time on the file that holds the proxy
* passwords every 'n' seconds, and if it has changed, reload it
*/
xfree(clear_userandpw);
return (sent_user);
-#endif /* USE_PROXY_AUTH */
}
+#endif /* USE_PROXY_AUTH */
int
icpProcessExpired(int fd, icpStateData * icpState)
icpState->old_entry = icpState->entry;
entry = storeCreateEntry(url,
request_hdr,
- icpState->flags,
+ icpState->request->flags,
icpState->method);
/* NOTE, don't call storeLockObject(), storeCreateEntry() does it */
(void *) icpState);
return 0;
}
- if (mem->reply->code == 304 && !BIT_TEST(icpState->flags, REQ_IMS)) {
+ if (mem->reply->code == 304 && !BIT_TEST(icpState->request->flags, REQ_IMS)) {
icpState->log_type = LOG_TCP_EXPIRED_HIT;
/* We initiated the IMS request, the client is not expecting
* 304, so put the good one back */
/*
- * $Id: comm.cc,v 1.74 1996/09/17 16:32:35 wessels Exp $
+ * $Id: comm.cc,v 1.75 1996/09/18 21:39:30 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
fde->lifetime_handler = NULL;
} else if ((func = fde->read_handler) != NULL) {
debug(5, 5, "checkLifetimes: FD %d: Calling read handler\n", fd);
- func(fd, fde->read_data);
- fde->read_handler = NULL;
- } else if ((func = fde->read_handler) != NULL) {
- debug(5, 5, "checkLifetimes: FD %d: Calling read handler\n", fd);
- func(fd, fde->read_data);
- fde->read_handler = NULL;
- } else if ((func = fde->write_handler) != NULL) {
+ func(fd, fd_table[fd].read_data);
+ fd_table[fd].read_handler = NULL;
+ } else if ((func = fd_table[fd].write_handler)) {
debug(5, 5, "checkLifetimes: FD %d: Calling write handler\n", fd);
func(fd, fde->write_data);
fde->write_handler = NULL;
/*
- * $Id: ftp.cc,v 1.58 1996/09/17 02:29:56 wessels Exp $
+ * $Id: ftp.cc,v 1.59 1996/09/18 21:39:31 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
if (data->authenticated) {
strcat(buf, "-a ");
}
+ if (Config.Addrs.tcp_outgoing.s_addr != INADDR_NONE) {
+ sprintf(tbuf, "-o %s ", inet_ntoa(Config.Addrs.tcp_outgoing));
+ strcat(buf, tbuf);
+ }
strcat(buf, "-h "); /* httpify */
strcat(buf, "- "); /* stdout */
strcat(buf, data->request->host);
/*
- * $Id: gopher.cc,v 1.48 1996/09/17 02:29:58 wessels Exp $
+ * $Id: gopher.cc,v 1.49 1996/09/18 21:39:32 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
sprintf(tempMIME, "\
HTTP/1.0 200 OK Gatewaying\r\n\
Server: Squid/%s\r\n\
-MIME-version: 1.0\r\n", version_string);
+Date: %s\r\n\
+MIME-version: 1.0\r\n",
+ version_string, mkrfc850(squid_curtime));
switch (data->type_id) {
/*
- * $Id: http.cc,v 1.77 1996/09/18 20:12:18 wessels Exp $
+ * $Id: http.cc,v 1.78 1996/09/18 21:39:33 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
strncpy(reply->last_modified, t, HTTP_REPLY_FIELD_SZ - 1);
ReplyHeaderStats.lm++;
}
+ } else if (!strncasecmp(t, "Cache-Control:", 14)) {
+ if ((t = strtok(NULL, w_space))) {
+ if (!strncasecmp(t, "private", 7))
+ reply->cache_control |= HTTP_CC_PRIVATE;
+ else if (!strncasecmp(t, "cachable", 8))
+ reply->cache_control |= HTTP_CC_CACHABLE;
+ else if (!strncasecmp(t, "no-cache", 8))
+ reply->cache_control |= HTTP_CC_NOCACHE;
+ }
}
t = strtok(NULL, "\n");
}
case 301: /* Moved Permanently */
case 410: /* Gone */
/* don't cache objects from neighbors w/o LMT, Date, or Expires */
- if (*reply->date)
+ if (BIT_TEST(reply->cache_control, HTTP_CC_PRIVATE))
+ httpMakePrivate(entry);
+ else if (BIT_TEST(reply->cache_control, HTTP_CC_NOCACHE))
+ httpMakePrivate(entry);
+ else if (*reply->date)
httpMakePublic(entry);
else if (*reply->last_modified)
httpMakePublic(entry);
ybuf = get_free_4k_page();
if (entry->mem_obj)
cfd = entry->mem_obj->fd_of_first_client;
- if (cfd < 0) {
- sprintf(ybuf, "%s\r\n", ForwardedBy);
- } else {
+ if (cfd > -1 && opt_forwarded_for) {
sprintf(ybuf, "%s for %s\r\n", ForwardedBy, fd_table[cfd].ipaddr);
+ } else {
+ sprintf(ybuf, "%s\r\n", ForwardedBy);
}
strcat(buf, ybuf);
len += strlen(ybuf);
/*
- * $Id: ipcache.cc,v 1.62 1996/09/17 02:29:59 wessels Exp $
+ * $Id: ipcache.cc,v 1.63 1996/09/18 21:39:36 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
static void ipcache_add __P((char *, ipcache_entry *, struct hostent *, int));
static int ipcacheHasPending __P((ipcache_entry *));
static ipcache_entry *ipcache_get __P((char *));
-static int dummy_handler __P((int, struct hostent * hp, void *));
+static void dummy_handler __P((int, struct hostent * hp, void *));
static int ipcacheExpiredEntry __P((ipcache_entry *));
static void ipcacheAddPending __P((ipcache_entry *, int fd, IPH, void *));
static void ipcacheEnqueue __P((ipcache_entry *));
storeAppendPrintf(sentry, close_bracket);
}
-static int
+static void
dummy_handler(int u1, struct hostent *u2, void *u3)
{
- return 0;
+ return;
}
static int
/*
- * $Id: main.cc,v 1.81 1996/09/18 20:13:04 wessels Exp $
+ * $Id: main.cc,v 1.82 1996/09/18 21:39:37 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
int opt_syslog_enable = 0; /* disabled by default */
int opt_no_ipcache = 0; /* use ipcache by default */
static int opt_send_signal = -1; /* no signal to send */
+int opt_udp_hit_obj = 1;
+int opt_mem_pools = 1;
+int opt_forwarded_for = 1;
int vhost_mode = 0;
volatile int unbuffered_logs = 1; /* debug and hierarchy unbuffered by default */
volatile int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */
/*
- * $Id: neighbors.cc,v 1.55 1996/09/17 02:30:01 wessels Exp $
+ * $Id: neighbors.cc,v 1.56 1996/09/18 21:39:37 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
struct _acl_list *a = NULL;
aclCheck_t checklist;
+ if (e->type == EDGE_SIBLING && BIT_TEST(request->flags, REQ_NOCACHE))
+ return 0;
if (e->domains == NULL && e->acls == NULL)
return do_ping;
do_ping = 0;
if (n == NULL && friends->n_parent < 1)
return NULL;
for (e = friends->edges_head; e; e = e->next) {
- if (edgeWouldBePinged(e, request)) {
- count++;
- if (e->type != EDGE_PARENT) {
- /* we matched a neighbor, not a parent. There
- * can be no single parent */
- if (n == NULL)
- return NULL;
- continue;
- }
- if (p) {
- /* already have a parent, this makes the second,
- * so there can be no single parent */
- if (n == NULL)
- return NULL;
- continue;
- }
- p = e;
+ if (!edgeWouldBePinged(e, request))
+ continue;
+ count++;
+ if (e->type != EDGE_PARENT) {
+ /* we matched a neighbor, not a parent. There
+ * can be no single parent */
+ if (n == NULL)
+ return NULL;
+ continue;
}
+ if (p) {
+ /* already have a parent, this makes the second,
+ * so there can be no single parent */
+ if (n == NULL)
+ return NULL;
+ continue;
+ }
+ p = e;
}
/* Ok, all done checking the edges. If only one parent matched, then
* p will already point to it */
e = friends->edges_head;
debug(15, 5, "neighborsUdpPing: Edge %s\n", e->host);
- /* Don't resolve refreshes through neighbors because we don't resolve
- * misses through neighbors */
- if (entry->flag & REFRESH_REQUEST && e->type == EDGE_SIBLING)
- continue;
-
/* skip any cache where we failed to connect() w/in the last 60s */
if (squid_curtime - e->last_fail_time < 60)
continue;
url,
&echo_hdr,
&e->in_addr,
- entry->flag,
+ proto->request->flags,
ICP_OP_DECHO,
LOG_TAG_NONE,
PROTO_NONE);
url,
&e->header,
&e->in_addr,
- entry->flag,
+ proto->request->flags,
ICP_OP_QUERY,
LOG_TAG_NONE,
PROTO_NONE);
/*
- * $Id: squid.h,v 1.54 1996/09/18 20:13:05 wessels Exp $
+ * $Id: squid.h,v 1.55 1996/09/18 21:39:41 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#endif
#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
#define _SQUID_NETDB_H_
+#ifdef _SQUID_NEXT_
+#include <netinet/in_systm.h>
+#endif
#include <netdb.h>
#endif
#if HAVE_PWD_H
extern char localhost[];
extern struct in_addr any_addr; /* comm.c */
extern struct in_addr no_addr; /* comm.c */
+extern int opt_udp_hit_obj; /* main.c */
+extern int opt_mem_pools; /* main.c */
+extern int opt_forwarded_for; /* main.c */
/* Prototypes and definitions which don't really deserve a seaprate
* include file */
/*
- * $Id: stmem.cc,v 1.23 1996/09/17 02:30:04 wessels Exp $
+ * $Id: stmem.cc,v 1.24 1996/09/18 21:39:41 wessels Exp $
*
* DEBUG: section 19 Memory Primitives
* AUTHOR: Harvest Derived
}
}
-void
-put_free_request_t(void *req)
+void
+put_free_request_t(req)
+ void *req;
{
put_free_thing(&request_pool, req);
}
request_pool.max_pages = 0;
mem_obj_pool.max_pages = 0;
#endif
-
+ if (!opt_mem_pools) {
+ sm_stats.max_pages = 0;
+ disk_stats.max_pages = 0;
+ request_pool.max_pages = 0;
+ mem_obj_pool.max_pages = 0;
+ }
init_stack(&sm_stats.free_page_stack, sm_stats.max_pages);
init_stack(&disk_stats.free_page_stack, disk_stats.max_pages);
init_stack(&request_pool.free_page_stack, request_pool.max_pages);
/*
- * $Id: store.cc,v 1.114 1996/09/18 20:12:25 wessels Exp $
+ * $Id: store.cc,v 1.115 1996/09/18 21:39:42 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
e->method = method;
if (req_hdr)
mem->mime_hdr = xstrdup(req_hdr);
- if (BIT_TEST(flags, REQ_NOCACHE))
- BIT_SET(e->flag, REFRESH_REQUEST);
if (BIT_TEST(flags, REQ_CACHABLE)) {
BIT_SET(e->flag, ENTRY_CACHABLE);
BIT_RESET(e->flag, RELEASE_REQUEST);
storeSetPrivateKey(e);
else
storeSetPublicKey(e);
- if (BIT_TEST(flags, REQ_HTML))
- BIT_SET(e->flag, ENTRY_HTML);
+ BIT_SET(e->flag, ENTRY_HTML);
e->store_status = STORE_PENDING;
storeSetMemStatus(e, NOT_IN_MEMORY);
storeAbort(StoreEntry * e, char *msg)
{
LOCAL_ARRAY(char, mime_hdr, 300);
- LOCAL_ARRAY(char, abort_msg, 2000);
+ char *abort_msg;
MemObject *mem = e->mem_obj;
if (e->store_status != STORE_PENDING) { /* XXX remove later */
squid_curtime,
squid_curtime + Config.negativeTtl);
if (msg) {
- /* This can run off the end here. Be careful */
- if ((int) (strlen(msg) + strlen(mime_hdr) + 50) < 2000) {
- sprintf(abort_msg, "HTTP/1.0 400 Cache Detected Error\r\n%s\r\n\r\n%s", mime_hdr, msg);
- } else {
- debug(20, 0, "storeAbort: WARNING: Must increase msg length!\n");
- }
+ abort_msg = get_free_8k_page();
+ strcpy(abort_msg, "HTTP/1.0 400 Cache Detected Error\r\n");
+ mk_mime_hdr(mime_hdr,
+ "text/html",
+ strlen(msg),
+ (time_t) Config.negativeTtl,
+ squid_curtime);
+ strcat(abort_msg, mime_hdr);
+ strcat(abort_msg, "\r\n\r\n");
+ strncat(abort_msg, msg, 8191 - strlen(abort_msg));
storeAppend(e, abort_msg, strlen(abort_msg));
safe_free(mem->e_abort_msg);
mem->e_abort_msg = xstrdup(abort_msg);
/* Set up object for negative caching */
BIT_SET(e->flag, ABORT_MSG_PENDING);
+ put_free_8k_page(abort_msg);
}
/* We assign an object length here--The only other place we assign the
* object length is in storeComplete() */
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;
+ return -1;
}
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;
+ return -1;
}
}
if (e->method == METHOD_GET) {