From: wessels <> Date: Thu, 19 Sep 1996 03:39:26 +0000 (+0000) Subject: merge diff-1.0.12-1.0.16 X-Git-Tag: SQUID_3_0_PRE1~5767 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=caebbe002aa9aeb5cdf2f2f17dd52c42c88dda5b;p=thirdparty%2Fsquid.git merge diff-1.0.12-1.0.16 --- diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 452bdc3aa9..97af9a37fa 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -32,6 +32,7 @@ Special thanks go to people who have volunteered their time, effort, and ideas t Jon Thackray John Saunders Endre Balint Nagy + Geoff Keating Development of this caching software is funded by the National Science diff --git a/ChangeLog b/ChangeLog index a2142360ab..2cade58602 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ Changes to squid-1.1.beta3 (): 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): @@ -292,6 +293,50 @@ Changes to squid-1.1.alpha2: ============================================================================== +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 + . + - 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 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. diff --git a/configure b/configure index 1844cd5ac5..7bf77d1cff 100755 --- a/configure +++ b/configure @@ -517,7 +517,7 @@ fi -# 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 diff --git a/src/Makefile.in b/src/Makefile.in index b4d217b79b..48b8b195fc 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # 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: # @@ -11,7 +11,9 @@ AIO_LIBS = # @AIO_LIBS@ 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@ @@ -134,6 +136,8 @@ install-mkdirs: mkdir $(localstatedir)/logs; \ fi +# Michael Lupp wants to know about additions +# to the install target. install: all install-mkdirs @for f in $(PROGS); do \ if test -f $(bindir)/$$f; then \ diff --git a/src/acl.cc b/src/acl.cc index 5b155def6b..f5d7e624bb 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -37,6 +37,9 @@ char *AclMatchedName = NULL; 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; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index e84e27be09..87d3e6c6d1 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -212,6 +212,7 @@ static char *safe_xstrdup __P((char *p)); 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)); @@ -252,6 +253,7 @@ static void parseTTLPattern __P((int icase, int force)); 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) @@ -273,6 +275,18 @@ ip_acl_match(struct in_addr c, ip_acl * a) 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) @@ -435,8 +449,7 @@ intlistDestroy(intlist ** 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); \ @@ -506,7 +519,6 @@ parseHostAclLine(void) neighbors_cf_acl(host, aclname); } - static void parseMemLine(void) { @@ -1056,6 +1068,9 @@ parseConfigFile(char *file_name) 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", @@ -1159,6 +1174,11 @@ parseConfigFile(char *file_name) 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(); @@ -1329,6 +1349,14 @@ parseConfigFile(char *file_name) 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, @@ -1427,12 +1455,14 @@ configFreeMemory(void) 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(); } diff --git a/src/cachemgr.cc b/src/cachemgr.cc index 7b0ee0ea3f..cfb0915ff1 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -301,13 +301,13 @@ noargs_html(char *host, int port) printf("
\n", script_name, host, port); printf("Cache Host:\n\n", host); + printf("SIZE=30 VALUE=\"%s\">
\n", CACHEMGR_HOSTNAME); printf("Cache Port:\n\n", port); + printf("SIZE=30 VALUE=\"%d\">
\n", CACHE_HTTP_PORT); printf("Password :\n\n"); + printf("NAME=\"password\" SIZE=30 VALUE=\"\">
\n"); printf("URL :\n\n"); + printf("SIZE=30 VALUE=\"\">
\n"); printf("Operation :"); printf("\n\n"); + printf("
\n"); printf("
\n"); printf(" \n"); printf("
\n"); @@ -801,11 +801,11 @@ main(int argc, char *argv[]) break; case STATS_U: if (hasTables) { - printf("
ProtocolCountMax KBCurrent KBMin KBHit RatioTransfer RateReferencesTransfered KB\n"); + printf("
ProtocolObject CountMax KBCurrent KBMin KBHit RatioTransfer KB/secTransfer CountTransfered KB\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; diff --git a/src/client_side.cc b/src/client_side.cc index 07df778e6c..b8f2195fec 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -33,9 +33,11 @@ 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; @@ -50,7 +52,7 @@ clientLookupDstIPDone(int fd, struct hostent *hp, void *data) inet_ntoa(icpState->aclChecklist->dst_addr)); } clientAccessCheck(icpState, icpState->aclHandler); - return 1; + return; } static void @@ -70,7 +72,6 @@ static void clientLookupIdentDone(void *data) { } - #endif #if USE_PROXY_AUTH @@ -101,9 +102,7 @@ clientProxyAuthCheck(icpStateData * icpState) #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; @@ -135,7 +134,7 @@ clientAccessCheck(icpStateData * icpState, 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); @@ -216,9 +215,9 @@ clientRedirectDone(void *data, char *result) (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 */ @@ -354,8 +353,8 @@ proxyAuthenticate(char *headers) xfree(clear_userandpw); return (sent_user); -#endif /* USE_PROXY_AUTH */ } +#endif /* USE_PROXY_AUTH */ int icpProcessExpired(int fd, icpStateData * icpState) @@ -369,7 +368,7 @@ 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 */ @@ -417,7 +416,7 @@ icpHandleIMSReply(int fd, StoreEntry * entry, void *data) (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 */ diff --git a/src/comm.cc b/src/comm.cc index 3c008bd724..0f6687bfe1 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -1156,13 +1156,9 @@ checkLifetimes(void) 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; diff --git a/src/ftp.cc b/src/ftp.cc index 756d8493b1..b3839d6d9a 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -508,6 +508,10 @@ ftpSendRequest(int fd, FtpData * data) 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); diff --git a/src/gopher.cc b/src/gopher.cc index 301afca5c7..37916c0b1f 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -254,7 +254,9 @@ gopherMimeCreate(GopherStateData * data) 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) { diff --git a/src/http.cc b/src/http.cc index db2d13fc76..6a5e29c391 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -260,6 +260,15 @@ httpParseHeaders(char *buf, struct _http_reply *reply) 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"); } @@ -325,7 +334,11 @@ httpProcessReplyHeader(HttpStateData * httpState, char *buf, int size) 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); @@ -595,10 +608,10 @@ httpSendRequest(int fd, HttpStateData * httpState) 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); diff --git a/src/ipcache.cc b/src/ipcache.cc index 13ddb2509d..6bc3bc0a3d 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -148,7 +148,7 @@ static void ipcache_call_pending __P((ipcache_entry *)); 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 *)); @@ -941,10 +941,10 @@ stat_ipcache_get(StoreEntry * sentry) storeAppendPrintf(sentry, close_bracket); } -static int +static void dummy_handler(int u1, struct hostent *u2, void *u3) { - return 0; + return; } static int diff --git a/src/main.cc b/src/main.cc index d642971d30..52416a1123 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -119,6 +119,9 @@ int opt_zap_disk_store = 0; 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()) */ diff --git a/src/neighbors.cc b/src/neighbors.cc index 12fb473539..99d2367552 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -175,6 +175,8 @@ edgeWouldBePinged(edge * e, request_t * request) 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; @@ -203,24 +205,24 @@ getSingleParent(request_t * request, int *n) 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 */ @@ -429,11 +431,6 @@ neighborsUdpPing(protodispatch_data * proto) 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; @@ -460,7 +457,7 @@ neighborsUdpPing(protodispatch_data * proto) url, &echo_hdr, &e->in_addr, - entry->flag, + proto->request->flags, ICP_OP_DECHO, LOG_TAG_NONE, PROTO_NONE); @@ -470,7 +467,7 @@ neighborsUdpPing(protodispatch_data * proto) url, &e->header, &e->in_addr, - entry->flag, + proto->request->flags, ICP_OP_QUERY, LOG_TAG_NONE, PROTO_NONE); diff --git a/src/squid.h b/src/squid.h index b946096fbd..0808bee582 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $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 * @@ -66,6 +66,9 @@ #endif #if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */ #define _SQUID_NETDB_H_ +#ifdef _SQUID_NEXT_ +#include +#endif #include #endif #if HAVE_PWD_H @@ -282,6 +285,9 @@ extern struct in_addr local_addr; /* main.c */ 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 */ diff --git a/src/stmem.cc b/src/stmem.cc index f6c68df025..d33e652d92 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -376,8 +376,9 @@ put_free_thing(stmem_stats * thing, void *p) } } -void -put_free_request_t(void *req) +void +put_free_request_t(req) + void *req; { put_free_thing(&request_pool, req); } @@ -430,7 +431,12 @@ stmemInit(void) 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); diff --git a/src/store.cc b/src/store.cc index c1495eb46f..37794136e5 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -739,8 +739,6 @@ storeCreateEntry(char *url, char *req_hdr, int flags, method_t method) 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); @@ -756,8 +754,7 @@ storeCreateEntry(char *url, char *req_hdr, int flags, method_t method) 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); @@ -1692,7 +1689,7 @@ void 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 */ @@ -1727,17 +1724,22 @@ storeAbort(StoreEntry * e, char *msg) 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() */ @@ -2135,7 +2137,7 @@ storeRelease(StoreEntry * e) 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) { @@ -2144,7 +2146,7 @@ storeRelease(StoreEntry * 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) {