--------------------- PatchSet 402 Date: 2000/07/02 10:56:48 Author: hno Branch: hno-devel Tag: (none) Log: Merged various changes from SQUID_2_3, since Duane has the odd habit of working there rather than in the HEAD version when making bug fixes... Members: src/cache_cf.c:1.1.1.3.10.4.2.6->1.1.1.3.10.4.2.7 src/carp.c:1.1.1.1.8.1.2.2->1.1.1.1.8.1.2.3 src/cf.data.pre:1.1.1.3.10.6.2.8->1.1.1.3.10.6.2.9 src/client_side.c:1.1.1.3.10.7.2.11->1.1.1.3.10.7.2.12 src/comm_select.c:1.1.1.3.10.2.2.5->1.1.1.3.10.2.2.6 src/dns_internal.c:1.1.1.1.10.4.2.6->1.1.1.1.10.4.2.7 src/enums.h:1.1.1.3.10.5.2.2->1.1.1.3.10.5.2.3 src/globals.h:1.1.1.3.10.3.2.4->1.1.1.3.10.3.2.5 src/http.c:1.1.1.3.10.4.2.3->1.1.1.3.10.4.2.4 src/store_dir.c:1.1.1.3.10.6.2.6->1.1.1.3.10.6.2.7 src/url.c:1.1.1.3.10.2.2.3->1.1.1.3.10.2.2.4 Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.1.1.3.10.4.2.6 retrieving revision 1.1.1.3.10.4.2.7 diff -u -r1.1.1.3.10.4.2.6 -r1.1.1.3.10.4.2.7 --- squid/src/cache_cf.c 1 Jul 2000 12:20:14 -0000 1.1.1.3.10.4.2.6 +++ squid/src/cache_cf.c 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.4.2.7 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.1.1.3.10.4.2.6 2000/07/01 12:20:14 hno Exp $ + * $Id: cache_cf.c,v 1.1.1.3.10.4.2.7 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -316,8 +316,11 @@ if (Config.errHtmlText == NULL) Config.errHtmlText = xstrdup(null_string); storeConfigure(); - if (Config2.Accel.on && !strcmp(Config.Accel.host, "virtual")) + if (Config2.Accel.on && !strcmp(Config.Accel.host, "virtual")) { vhost_mode = 1; + if (Config.Accel.port == 0) + vport_mode = 1; + } if (Config.Sockaddr.http == NULL) fatal("No http_port specified!"); snprintf(ThisCache, sizeof(ThisCache), "%s:%d (%s)", Index: squid/src/carp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/carp.c,v retrieving revision 1.1.1.1.8.1.2.2 retrieving revision 1.1.1.1.8.1.2.3 diff -u -r1.1.1.1.8.1.2.2 -r1.1.1.1.8.1.2.3 --- squid/src/carp.c 12 Jun 2000 10:26:06 -0000 1.1.1.1.8.1.2.2 +++ squid/src/carp.c 2 Jul 2000 10:56:48 -0000 1.1.1.1.8.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: carp.c,v 1.1.1.1.8.1.2.2 2000/06/12 10:26:06 hno Exp $ + * $Id: carp.c,v 1.1.1.1.8.1.2.3 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 39 Cache Array Routing Protocol * AUTHOR: Eric Stern @@ -85,7 +85,7 @@ peer * carpSelectParent(request_t * request) { -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> ((size(u_long)*8)-(n)))) +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> ((sizeof(u_long)*8)-(n)))) const char *c; peer *p = NULL; peer *tp; Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.1.1.3.10.6.2.8 retrieving revision 1.1.1.3.10.6.2.9 diff -u -r1.1.1.3.10.6.2.8 -r1.1.1.3.10.6.2.9 --- squid/src/cf.data.pre 1 Jul 2000 12:20:14 -0000 1.1.1.3.10.6.2.8 +++ squid/src/cf.data.pre 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.6.2.9 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.1.1.3.10.6.2.8 2000/07/01 12:20:14 hno Exp $ +# $Id: cf.data.pre,v 1.1.1.3.10.6.2.9 2000/07/02 10:56:48 hno Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1973,6 +1973,8 @@ If you want virtual host support then specify the hostname as "virtual". + If you want virtual port support then specify the port as "0". + NOTE: enabling httpd_accel_host disables proxy-caching and ICP. If you want these features enabled also, then set the 'httpd_accel_with_proxy' option. Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.1.1.3.10.7.2.11 retrieving revision 1.1.1.3.10.7.2.12 diff -u -r1.1.1.3.10.7.2.11 -r1.1.1.3.10.7.2.12 --- squid/src/client_side.c 1 Jul 2000 12:20:14 -0000 1.1.1.3.10.7.2.11 +++ squid/src/client_side.c 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.7.2.12 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.1.1.3.10.7.2.11 2000/07/01 12:20:14 hno Exp $ + * $Id: client_side.c,v 1.1.1.3.10.7.2.12 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -921,16 +921,15 @@ static int clientCheckContentLength(request_t * r) { - int has_cont_len = (r->content_length >= 0); switch (r->method) { case METHOD_PUT: case METHOD_POST: /* PUT/POST requires a request entity */ - return has_cont_len; + return (r->content_length >= 0); case METHOD_GET: case METHOD_HEAD: /* We do not want to see a request entity on GET/HEAD requests */ - return !has_cont_len; + return (r->content_length <= 0); default: /* For other types of requests we don't care */ return 1; @@ -3105,6 +3104,8 @@ else if (Config2.Accel.on && *url == '/') { /* prepend the accel prefix */ if (opt_accel_uses_host && (t = mime_get_header(req_hdr, "Host"))) { + int vport = (int) Config.Accel.port; + char *q; /* If a Host: header was specified, use it to build the URL * instead of the one in the Config file. */ /* @@ -3114,16 +3115,25 @@ * refer to www.playboy.com. The 'dst' and/or 'dst_domain' ACL * types should be used to prevent httpd-accelerators * handling requests for non-local servers */ - strtok(t, " :/;@"); + strtok(t, " /;@"); + if ((q = strchr(t, ':'))) { + *q++ = '\0'; + vport = atoi(q); + } url_sz = strlen(url) + 32 + Config.appendDomainLen + strlen(t); http->uri = xcalloc(url_sz, 1); snprintf(http->uri, url_sz, "http://%s:%d%s", - t, (int) Config.Accel.port, url); + t, vport, url); } else if (vhost_mode) { + int vport; /* Put the local socket IP address as the hostname */ url_sz = strlen(url) + 32 + Config.appendDomainLen; http->uri = xcalloc(url_sz, 1); + if (vport_mode) + vport = (int) ntohs(http->conn->me.sin_port); + else + vport = (int) Config.Accel.port; #if IPF_TRANSPARENT natLookup.nl_inport = http->conn->me.sin_port; natLookup.nl_outport = http->conn->peer.sin_port; @@ -3146,18 +3156,15 @@ } else snprintf(http->uri, url_sz, "http://%s:%d%s", inet_ntoa(http->conn->me.sin_addr), - (int) Config.Accel.port, - url); + vport, url); } else snprintf(http->uri, url_sz, "http://%s:%d%s", inet_ntoa(natLookup.nl_realip), - (int) Config.Accel.port, - url); + vport, url); #else snprintf(http->uri, url_sz, "http://%s:%d%s", inet_ntoa(http->conn->me.sin_addr), - (int) Config.Accel.port, - url); + vport, url); #endif debug(33, 5) ("VHOST REWRITE: '%s'\n", http->uri); } else { @@ -3697,6 +3704,11 @@ sockaddr_in_list *s; int fd; for (s = Config.Sockaddr.http; s; s = s->next) { + if (MAXHTTPPORTS == NHttpSockets) { + debug(1, 1) ("WARNING: You have too many 'http_port' lines.\n"); + debug(1, 1) (" The limit is %d\n", MAXHTTPPORTS); + continue; + } enter_suid(); fd = comm_open(SOCK_STREAM, 0, Index: squid/src/comm_select.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm_select.c,v retrieving revision 1.1.1.3.10.2.2.5 retrieving revision 1.1.1.3.10.2.2.6 diff -u -r1.1.1.3.10.2.2.5 -r1.1.1.3.10.2.2.6 --- squid/src/comm_select.c 1 Jul 2000 12:20:14 -0000 1.1.1.3.10.2.2.5 +++ squid/src/comm_select.c 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.2.2.6 @@ -1,6 +1,6 @@ /* - * $Id: comm_select.c,v 1.1.1.3.10.2.2.5 2000/07/01 12:20:14 hno Exp $ + * $Id: comm_select.c,v 1.1.1.3.10.2.2.6 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 5 Socket Functions * @@ -320,9 +320,9 @@ int calldns = 0; static time_t last_timeout = 0; double timeout = current_dtime + (msec / 1000.0); - double start; do { #if !ALARM_UPDATES_TIME + double start; getCurrentTime(); start = current_dtime; #endif Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dns_internal.c,v retrieving revision 1.1.1.1.10.4.2.6 retrieving revision 1.1.1.1.10.4.2.7 diff -u -r1.1.1.1.10.4.2.6 -r1.1.1.1.10.4.2.7 --- squid/src/dns_internal.c 1 Jul 2000 12:20:14 -0000 1.1.1.1.10.4.2.6 +++ squid/src/dns_internal.c 2 Jul 2000 10:56:48 -0000 1.1.1.1.10.4.2.7 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.1.1.1.10.4.2.6 2000/07/01 12:20:14 hno Exp $ + * $Id: dns_internal.c,v 1.1.1.1.10.4.2.7 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -403,6 +403,10 @@ idnsParseNameservers(); if (0 == nns) idnsParseResolvConf(); + if (0 == nns) + fatal("Could not find any nameservers.\n" + " Please check your /etc/resolv.conf file\n" + " or use the 'dns_nameservers' option in squid.conf."); if (!init) { memDataInit(MEM_IDNS_QUERY, "idns_query", sizeof(idns_query), 0); cachemgrRegister("idns", Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.1.1.3.10.5.2.2 retrieving revision 1.1.1.3.10.5.2.3 diff -u -r1.1.1.3.10.5.2.2 -r1.1.1.3.10.5.2.3 --- squid/src/enums.h 1 Jul 2000 12:20:14 -0000 1.1.1.3.10.5.2.2 +++ squid/src/enums.h 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.5.2.3 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.1.1.3.10.5.2.2 2000/07/01 12:20:14 hno Exp $ + * $Id: enums.h,v 1.1.1.3.10.5.2.3 2000/07/02 10:56:48 hno Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -386,6 +386,9 @@ METHOD_MOVE, METHOD_LOCK, METHOD_UNLOCK, + METHOD_BMOVE, + METHOD_BDELETE, + METHOD_BPROPFIND, METHOD_EXT00, METHOD_EXT01, METHOD_EXT02, Index: squid/src/globals.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/globals.h,v retrieving revision 1.1.1.3.10.3.2.4 retrieving revision 1.1.1.3.10.3.2.5 diff -u -r1.1.1.3.10.3.2.4 -r1.1.1.3.10.3.2.5 --- squid/src/globals.h 1 Jul 2000 12:20:14 -0000 1.1.1.3.10.3.2.4 +++ squid/src/globals.h 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.3.2.5 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.1.1.3.10.3.2.4 2000/07/01 12:20:14 hno Exp $ + * $Id: globals.h,v 1.1.1.3.10.3.2.5 2000/07/02 10:56:48 hno Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -99,6 +99,7 @@ extern char *snmp_agentinfo; #endif extern int vhost_mode; /* 0 */ +extern int vport_mode; /* 0 */ extern int n_disk_objects; /* 0 */ extern iostats IOStats; extern struct _acl_deny_info_list *DenyInfoList; /* NULL */ Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.1.1.3.10.4.2.3 retrieving revision 1.1.1.3.10.4.2.4 diff -u -r1.1.1.3.10.4.2.3 -r1.1.1.3.10.4.2.4 --- squid/src/http.c 1 Jul 2000 12:20:15 -0000 1.1.1.3.10.4.2.3 +++ squid/src/http.c 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.4.2.4 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.1.1.3.10.4.2.3 2000/07/01 12:20:15 hno Exp $ + * $Id: http.c,v 1.1.1.3.10.4.2.4 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -188,6 +188,8 @@ case METHOD_PROPPATCH: case METHOD_MKCOL: case METHOD_MOVE: + case METHOD_BMOVE: + case METHOD_BDELETE: /* * Remove any cached GET object if it is beleived that the * object may have changed as a result of other methods Index: squid/src/store_dir.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v retrieving revision 1.1.1.3.10.6.2.6 retrieving revision 1.1.1.3.10.6.2.7 diff -u -r1.1.1.3.10.6.2.6 -r1.1.1.3.10.6.2.7 --- squid/src/store_dir.c 1 Jul 2000 12:20:15 -0000 1.1.1.3.10.6.2.6 +++ squid/src/store_dir.c 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.6.2.7 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.1.1.3.10.6.2.6 2000/07/01 12:20:15 hno Exp $ + * $Id: store_dir.c,v 1.1.1.3.10.6.2.7 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -303,6 +303,8 @@ { SwapDir *SD = &Config.cacheSwap.swapDirs[dirn]; assert(0 <= dirn && dirn < Config.cacheSwap.n_configured); + if (SD->cur_size >= SD->max_size) + return; SD->max_size = SD->cur_size; debug(20, 1) ("WARNING: Shrinking cache_dir #%d to %d KB\n", dirn, SD->cur_size); Index: squid/src/url.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/url.c,v retrieving revision 1.1.1.3.10.2.2.3 retrieving revision 1.1.1.3.10.2.2.4 diff -u -r1.1.1.3.10.2.2.3 -r1.1.1.3.10.2.2.4 --- squid/src/url.c 1 Jul 2000 12:20:15 -0000 1.1.1.3.10.2.2.3 +++ squid/src/url.c 2 Jul 2000 10:56:48 -0000 1.1.1.3.10.2.2.4 @@ -1,6 +1,6 @@ /* - * $Id: url.c,v 1.1.1.3.10.2.2.3 2000/07/01 12:20:15 hno Exp $ + * $Id: url.c,v 1.1.1.3.10.2.2.4 2000/07/02 10:56:48 hno Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -54,6 +54,9 @@ "MOVE", "LOCK", "UNLOCK", + "BMOVE", + "BDELETE", + "BPROPFIND", "%EXT00", "%EXT01", "%EXT02",