]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
merge diff-1.0.12-1.0.16
authorwessels <>
Thu, 19 Sep 1996 03:39:26 +0000 (03:39 +0000)
committerwessels <>
Thu, 19 Sep 1996 03:39:26 +0000 (03:39 +0000)
18 files changed:
CONTRIBUTORS
ChangeLog
configure
src/Makefile.in
src/acl.cc
src/cache_cf.cc
src/cachemgr.cc
src/client_side.cc
src/comm.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/ipcache.cc
src/main.cc
src/neighbors.cc
src/squid.h
src/stmem.cc
src/store.cc

index 452bdc3aa979f1661c27d58f968b81ec4e5d662e..97af9a37faf408fd0c82aa0e1d07d5feb07f1256 100644 (file)
@@ -32,6 +32,7 @@ Special thanks go to people who have volunteered their time, effort, and ideas t
        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
index a2142360ab4edb0123e1be16c3db559342c93ff8..2cade58602bcba007aa5d91e199de71c90cfc334 100644 (file)
--- 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
+         <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.
index 1844cd5ac54070fd6c7f0c61313ec94c9796f06e..7bf77d1cff0ca7c355d0166d08e3167a0e32a7c0 100755 (executable)
--- 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
index b4d217b79b802313f2054d4af1a390dc23ae8bd6..48b8b195fcee2c706a36082748b2471939f77415 100644 (file)
@@ -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 <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 \
index 5b155def6b776880ecd521f5124ef596ad1a5777..f5d7e624bbf147f642a6267943a31d1fced2ee1b 100644 (file)
@@ -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;
index e84e27be0979e21f665716fa8a59829b644cb175..87d3e6c6d1a9b26fc5bca6d549fb8f6bb419a530 100644 (file)
@@ -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();
 }
 
index 7b0ee0ea3ffd6e9e438e5c64a57bba2c11cf862a..cfb0915ff1b905b89a62a983892b350fad80da3c 100644 (file)
@@ -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("<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");
@@ -332,7 +332,7 @@ noargs_html(char *host, int port)
 #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");
@@ -801,11 +801,11 @@ main(int argc, char *argv[])
        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;
index 07df778e6c085e2bdd8ba2d7de8dbf6bcc85cb41..b8f2195fec8d98ae74d8fb24f799a6633816f6be 100644 (file)
@@ -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
 
 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 */
index 3c008bd724938ec06cfc8992825a05399fda864b..0f6687bfe1847088faa5d3aec742fc423fa1b016 100644 (file)
@@ -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;
index 756d8493b176a12dd1df9c0467c05341125388ea..b3839d6d9a8ecc0f06692eb645df1e99666bcdbe 100644 (file)
@@ -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);
index 301afca5c78f7823248ee2e3fe7573c40fe38401..37916c0b1f81e6c44b0f8a18993a9cf1cbcaafff 100644 (file)
@@ -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) {
 
index db2d13fc766a92e7f404853c1efd1e1299346ce4..6a5e29c391d1c17ac003c039c118e9c13cf62994 100644 (file)
@@ -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);
index 13ddb2509dd24c597db87a0def5ed192ca2c2b13..6bc3bc0a3d87b1c8096a6cfc4db15ca4d8a51aae 100644 (file)
@@ -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
index d642971d30cfab71a36f8a0dc65a56f22d97da9d..52416a1123f885e65c9ef0254aff51646765fd8d 100644 (file)
@@ -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()) */
index 12fb473539b3dce7d535032eadf09093b1bebc77..99d23675529c7175de54c8d79e8bf67100de7cfa 100644 (file)
@@ -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);
index b946096fbd51d91f2c7243b9a3bf1fb74b0dea41..0808bee582c520c21de72314564f3dbc409a9302 100644 (file)
@@ -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 <netinet/in_systm.h>
+#endif
 #include <netdb.h>
 #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 */
index f6c68df0253cf6d83018ddd6c93282c9bd1ea6dc..d33e652d9204d2e15edd5475c25c8b1b750d30a8 100644 (file)
@@ -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);
index c1495eb46f6f44993fab512848dcb65b38f65795..37794136e5b7ec690e38f0b7f154b09be5b7f59b 100644 (file)
@@ -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) {