diff -ruN squid-2.6.STABLE19/ChangeLog squid-2.6.STABLE20/ChangeLog --- squid-2.6.STABLE19/ChangeLog 2008-03-18 01:57:20.000000000 +0100 +++ squid-2.6.STABLE20/ChangeLog 2008-04-25 21:49:06.000000000 +0200 @@ -1,3 +1,21 @@ +Changes to squid-2.6.STABLE20 (25 Apr 2008) + + - Bug #2263: Custom log formats fail to log file sizes >2GB properly + on 32-bit platforms + - Fix stripping NT domain in squid_ldap_group + - Bug #2278: Cache-Control: max-stale=0 forwarded wrongly as max-stale + (without delta) + - Bug #2283: Fails to parse chunked encoding using chunk extensions + - Bug #420: Deal properly with empty list HTTP header members + - Windows Server 2008 support + - Bug #1886: tcp_outgoing_address acl doesn't work with indirect + source address (follow-x-forwarded-for) + - Bug #2296: Stuck in 100% CPU when fetching an corrupt peer digest + - Add support for the resolv.conf domain directive, and also + automatically derived default domain + - minimum_icp_query_timeout directive + - Bug #2329: Range header ignored on HIT + Changes to squid-2.6.STABLE19 (19 Mar 2008) - Fix tcp_outgoing_address example config to match its description diff -ruN squid-2.6.STABLE19/configure squid-2.6.STABLE20/configure --- squid-2.6.STABLE19/configure 2008-03-18 02:05:57.000000000 +0100 +++ squid-2.6.STABLE20/configure 2008-04-25 21:49:52.000000000 +0200 @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 1.416.2.25 . +# From configure.in Revision: 1.416.2.26 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for Squid Web Proxy 2.6.STABLE19. +# Generated by GNU Autoconf 2.61 for Squid Web Proxy 2.6.STABLE20. # # Report bugs to . # @@ -575,8 +575,8 @@ # Identity of this package. PACKAGE_NAME='Squid Web Proxy' PACKAGE_TARNAME='squid' -PACKAGE_VERSION='2.6.STABLE19' -PACKAGE_STRING='Squid Web Proxy 2.6.STABLE19' +PACKAGE_VERSION='2.6.STABLE20' +PACKAGE_STRING='Squid Web Proxy 2.6.STABLE20' PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/' ac_default_prefix=/usr/local/squid @@ -1314,7 +1314,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Squid Web Proxy 2.6.STABLE19 to adapt to many kinds of systems. +\`configure' configures Squid Web Proxy 2.6.STABLE20 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1384,7 +1384,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE19:";; + short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE20:";; esac cat <<\_ACEOF @@ -1662,7 +1662,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Squid Web Proxy configure 2.6.STABLE19 +Squid Web Proxy configure 2.6.STABLE20 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1676,7 +1676,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Squid Web Proxy $as_me 2.6.STABLE19, which was +It was created by Squid Web Proxy $as_me 2.6.STABLE20, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2349,7 +2349,7 @@ # Define the identity of the package. PACKAGE='squid' - VERSION='2.6.STABLE19' + VERSION='2.6.STABLE20' cat >>confdefs.h <<_ACEOF @@ -27276,7 +27276,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Squid Web Proxy $as_me 2.6.STABLE19, which was +This file was extended by Squid Web Proxy $as_me 2.6.STABLE20, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -27329,7 +27329,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Squid Web Proxy config.status 2.6.STABLE19 +Squid Web Proxy config.status 2.6.STABLE20 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -ruN squid-2.6.STABLE19/configure.in squid-2.6.STABLE20/configure.in --- squid-2.6.STABLE19/configure.in 2008-03-18 02:05:57.000000000 +0100 +++ squid-2.6.STABLE20/configure.in 2008-04-25 21:49:52.000000000 +0200 @@ -1,16 +1,16 @@ dnl dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.416.2.25 2008/03/18 00:57:20 hno Exp $ +dnl $Id: configure.in,v 1.416.2.26 2008/04/22 15:17:28 hno Exp $ dnl dnl dnl -AC_INIT(Squid Web Proxy, 2.6.STABLE19, http://www.squid-cache.org/bugs/, squid) +AC_INIT(Squid Web Proxy, 2.6.STABLE20, http://www.squid-cache.org/bugs/, squid) AC_PREREQ(2.52) AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE -AC_REVISION($Revision: 1.416.2.25 $)dnl +AC_REVISION($Revision: 1.416.2.26 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE diff -ruN squid-2.6.STABLE19/helpers/external_acl/ldap_group/squid_ldap_group.c squid-2.6.STABLE20/helpers/external_acl/ldap_group/squid_ldap_group.c --- squid-2.6.STABLE19/helpers/external_acl/ldap_group/squid_ldap_group.c 2006-05-22 22:42:04.000000000 +0200 +++ squid-2.6.STABLE20/helpers/external_acl/ldap_group/squid_ldap_group.c 2008-03-18 03:59:15.000000000 +0100 @@ -465,9 +465,9 @@ } rfc1738_unescape(user); if (strip_nt_domain) { - char *u = strchr(user, '\\'); + char *u = strrchr(user, '\\'); if (!u) - u = strchr(user, '/'); + u = strrchr(user, '/'); if (u && u[1]) user = u + 1; } diff -ruN squid-2.6.STABLE19/include/version.h squid-2.6.STABLE20/include/version.h --- squid-2.6.STABLE19/include/version.h 2008-03-18 02:05:57.000000000 +0100 +++ squid-2.6.STABLE20/include/version.h 2008-04-25 21:49:52.000000000 +0200 @@ -9,5 +9,5 @@ */ #ifndef SQUID_RELEASE_TIME -#define SQUID_RELEASE_TIME 1205802352 +#define SQUID_RELEASE_TIME 1209152987 #endif diff -ruN squid-2.6.STABLE19/lib/win32lib.c squid-2.6.STABLE20/lib/win32lib.c --- squid-2.6.STABLE19/lib/win32lib.c 2007-06-03 02:40:31.000000000 +0200 +++ squid-2.6.STABLE20/lib/win32lib.c 2008-04-25 21:44:20.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: win32lib.c,v 1.3.2.1 2007/06/03 00:40:31 hno Exp $ + * $Id: win32lib.c,v 1.3.2.2 2008/04/25 19:44:20 hno Exp $ * * Windows support * AUTHOR: Guido Serassio @@ -97,7 +97,13 @@ size_t getpagesize() { - return 4096; + static DWORD system_pagesize = 0; + if (!system_pagesize) { + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + system_pagesize = system_info.dwPageSize; + } + return system_pagesize; } int64_t @@ -247,7 +253,7 @@ * an in_addr structure. Returns 0 on failure, * and 1 on success. */ -int +int inet_aton(const char *cp, struct in_addr *addr) { if (cp == NULL || addr == NULL) { diff -ruN squid-2.6.STABLE19/RELEASENOTES.html squid-2.6.STABLE20/RELEASENOTES.html --- squid-2.6.STABLE19/RELEASENOTES.html 2008-03-18 02:06:31.000000000 +0100 +++ squid-2.6.STABLE20/RELEASENOTES.html 2008-04-25 21:50:29.000000000 +0200 @@ -7,7 +7,7 @@

Squid 2.6.STABLE19 release notes

-

Squid Developers

$Id: release-2.6.html,v 1.44.2.18 2008/03/18 00:57:21 hno Exp $ +

Squid Developers

$Id: release-2.6.html,v 1.44.2.20 2008/04/25 19:49:06 hno Exp $
This document contains the release notes for version 2.6 of Squid. Squid is a WWW Cache application developed by the Web Caching community. @@ -84,6 +84,9 @@

24. Key changes squid-2.6.STABLE18 to 2.6.STABLE19

+

+

25. Key changes squid-2.6.STABLE19 to 2.6.STABLE20

+

1. Key changes from squid 2.5

@@ -799,5 +802,25 @@

+

25. Key changes squid-2.6.STABLE19 to 2.6.STABLE20

+ +

+

+

+ diff -ruN squid-2.6.STABLE19/src/access_log.c squid-2.6.STABLE20/src/access_log.c --- squid-2.6.STABLE19/src/access_log.c 2007-06-03 02:40:32.000000000 +0200 +++ squid-2.6.STABLE20/src/access_log.c 2008-03-18 03:58:47.000000000 +0100 @@ -1,6 +1,6 @@ /* - * $Id: access_log.c,v 1.95.2.2 2007/06/03 00:40:32 hno Exp $ + * $Id: access_log.c,v 1.95.2.3 2008/03/18 02:58:47 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -442,7 +442,7 @@ for (fmt = lf->format; fmt != NULL; fmt = fmt->next) { /* for each token */ const char *out = NULL; int quote = 0; - long int outint = 0; + squid_off_t outint = 0; int doint = 0; int dofree = 0; switch (fmt->type) { @@ -674,7 +674,7 @@ } if (doint) { - snprintf(tmp, sizeof(tmp), "%0*ld", fmt->zero ? (int) fmt->width : 0, outint); + snprintf(tmp, sizeof(tmp), "%0*" PRINTF_OFF_T, fmt->zero ? (int) fmt->width : 0, outint); out = tmp; } if (out && *out) { diff -ruN squid-2.6.STABLE19/src/cf.data.pre squid-2.6.STABLE20/src/cf.data.pre --- squid-2.6.STABLE19/src/cf.data.pre 2008-03-18 00:34:14.000000000 +0100 +++ squid-2.6.STABLE20/src/cf.data.pre 2008-04-21 04:56:24.000000000 +0200 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.382.2.29 2008/03/17 23:34:14 hno Exp $ +# $Id: cf.data.pre,v 1.382.2.30 2008/04/21 02:56:24 hno Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -4293,6 +4293,22 @@ 'icp_query_timeout' directive. DOC_END +NAME: minimum_icp_query_timeout +COMMENT: (msec) +DEFAULT: 5 +TYPE: int +LOC: Config.Timeout.icp_query_min +DOC_START + Normally the ICP query timeout is determined dynamically. But + sometimes it can lead to very small timeouts, even lower than + the normal latency variance on your link due to traffic. + Use this option to put an lower limit on the dynamic timeout + value. Do NOT use this option to always use a fixed (instead + of a dynamic) timeout value. To set a fixed timeout see the + 'icp_query_timeout' directive. +DOC_END + + COMMENT_START MULTICAST ICP OPTIONS ----------------------------------------------------------------------------- diff -ruN squid-2.6.STABLE19/src/dns_internal.c squid-2.6.STABLE20/src/dns_internal.c --- squid-2.6.STABLE19/src/dns_internal.c 2007-06-23 23:34:09.000000000 +0200 +++ squid-2.6.STABLE20/src/dns_internal.c 2008-04-25 21:44:50.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.61.2.1 2007/06/23 21:34:09 hno Exp $ + * $Id: dns_internal.c,v 1.61.2.3 2008/04/25 19:44:50 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -248,7 +248,7 @@ { FILE *fp; char buf[RESOLV_BUFSZ]; - char *t; + const char *t; fp = fopen(_PATH_RESCONF, "r"); if (fp == NULL) { debug(78, 1) ("%s: %s\n", _PATH_RESCONF, xstrerror()); @@ -267,7 +267,15 @@ continue; debug(78, 1) ("Adding nameserver %s from %s\n", t, _PATH_RESCONF); idnsAddNameserver(t); + } else if (strcasecmp(t, "domain") == 0) { + idnsFreeSearchpath(); + t = strtok(NULL, w_space); + if (NULL == t) + continue; + debug(78, 1) ("Adding domain %s from %s\n", t, _PATH_RESCONF); + idnsAddPathComponent(t); } else if (strcasecmp(t, "search") == 0) { + idnsFreeSearchpath(); while (NULL != t) { t = strtok(NULL, w_space); if (NULL == t) @@ -292,6 +300,12 @@ } } fclose(fp); + + if (npc == 0 && (t = getMyHostname())) { + t = strchr(t, '.'); + if (t) + idnsAddPathComponent(t + 1); + } } #endif @@ -299,7 +313,7 @@ static void idnsParseWIN32SearchList(const char *Separator) { - BYTE *t; + char *t; char *token; HKEY hndKey; @@ -310,23 +324,42 @@ DWORD Size = 0; LONG Result; Result = + RegQueryValueEx(hndKey, "Domain", NULL, &Type, NULL, + &Size); + + if (Result == ERROR_SUCCESS && Size) { + t = (char *) xmalloc(Size); + RegQueryValueEx(hndKey, "Domain", NULL, &Type, (LPBYTE) t, + &Size); + debug(78, 1) ("Adding domain %s from Registry\n", t); + idnsAddPathComponent(t); + xfree(t); + } + Result = RegQueryValueEx(hndKey, "SearchList", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (unsigned char *) xmalloc(Size); - RegQueryValueEx(hndKey, "SearchList", NULL, &Type, t, + RegQueryValueEx(hndKey, "SearchList", NULL, &Type, (LPBYTE) t, &Size); token = strtok((char *) t, Separator); + idnsFreeSearchpath(); while (token) { idnsAddPathComponent(token); debug(78, 1) ("Adding domain %s from Registry\n", token); token = strtok(NULL, Separator); } + xfree(t); } RegCloseKey(hndKey); } + if (npc == 0 && ((const char *) t = getMyHostname())) { + t = strchr(t, '.'); + if (t) + idnsAddPathComponent(t + 1); + } } static void @@ -336,7 +369,6 @@ char *token; HKEY hndKey, hndKey2; - idnsFreeNameservers(); switch (WIN32_OS_version) { case _WIN_OS_WINNT: /* get nameservers from the Windows NT registry */ @@ -360,6 +392,7 @@ token); token = strtok(NULL, ", "); } + xfree(t); } Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); @@ -373,6 +406,7 @@ idnsAddNameserver(token); token = strtok(NULL, ", "); } + xfree(t); } RegCloseKey(hndKey); } @@ -417,6 +451,7 @@ idnsAddNameserver(token); token = strtok(NULL, ", "); } + xfree(t); } Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, @@ -432,6 +467,7 @@ idnsAddNameserver(token); token = strtok(NULL, ", "); } + xfree(t); } RegCloseKey(hndKey2); } @@ -463,6 +499,7 @@ idnsAddNameserver(token); token = strtok(NULL, ", "); } + xfree(t); } RegCloseKey(hndKey); } diff -ruN squid-2.6.STABLE19/src/forward.c squid-2.6.STABLE20/src/forward.c --- squid-2.6.STABLE19/src/forward.c 2007-09-05 23:28:34.000000000 +0200 +++ squid-2.6.STABLE20/src/forward.c 2008-04-02 03:16:29.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.120.2.4 2007/09/05 21:28:34 hno Exp $ + * $Id: forward.c,v 1.120.2.5 2008/04/02 01:16:29 hno Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -424,7 +424,12 @@ aclCheck_t ch; memset(&ch, '\0', sizeof(aclCheck_t)); if (request) { - ch.src_addr = request->client_addr; +#if FOLLOW_X_FORWARDED_FOR + if (Config.onoff.acl_uses_indirect_client) { + ch.src_addr = request->indirect_client_addr; + } else +#endif /* FOLLOW_X_FORWARDED_FOR */ + ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; ch.my_port = request->my_port; ch.request = request; @@ -438,7 +443,12 @@ aclCheck_t ch; memset(&ch, '\0', sizeof(aclCheck_t)); if (request) { - ch.src_addr = request->client_addr; +#if FOLLOW_X_FORWARDED_FOR + if (Config.onoff.acl_uses_indirect_client) { + ch.src_addr = request->indirect_client_addr; + } else +#endif /* FOLLOW_X_FORWARDED_FOR */ + ch.src_addr = request->client_addr; ch.my_addr = request->my_addr; ch.my_port = request->my_port; ch.request = request; diff -ruN squid-2.6.STABLE19/src/http.c squid-2.6.STABLE20/src/http.c --- squid-2.6.STABLE19/src/http.c 2007-11-26 12:04:30.000000000 +0100 +++ squid-2.6.STABLE20/src/http.c 2008-04-02 03:03:47.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.419.2.11 2007/11/26 11:04:30 adrian Exp $ + * $Id: http.c,v 1.419.2.12 2008/04/02 01:03:47 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -671,7 +671,7 @@ badchunk = 1; while (end && (*end == '\r' || *end == ' ' || *end == '\t')) end++; - if (httpState->chunk_size < 0 || !end || (*end != '\n' && *end == ';')) { + if (httpState->chunk_size < 0 || !end || (*end != '\n' && *end != ';')) { debug(11, 0) ("Invalid chunk header '%s'\n", strBuf(httpState->chunkhdr)); comm_close(fd); return; diff -ruN squid-2.6.STABLE19/src/HttpHdrCc.c squid-2.6.STABLE20/src/HttpHdrCc.c --- squid-2.6.STABLE19/src/HttpHdrCc.c 2006-12-31 15:52:51.000000000 +0100 +++ squid-2.6.STABLE20/src/HttpHdrCc.c 2008-03-22 00:00:57.000000000 +0100 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrCc.c,v 1.24 2006/12/31 14:52:51 hno Exp $ + * $Id: HttpHdrCc.c,v 1.24.2.1 2008/03/21 23:00:57 hno Exp $ * * DEBUG: section 65 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -208,7 +208,7 @@ if (flag == CC_S_MAXAGE) packerPrintf(p, "=%d", (int) cc->s_maxage); - if (flag == CC_MAX_STALE && cc->max_stale > 0) + if (flag == CC_MAX_STALE && cc->max_stale >= 0) packerPrintf(p, "=%d", (int) cc->max_stale); pcount++; diff -ruN squid-2.6.STABLE19/src/HttpHdrRange.c squid-2.6.STABLE20/src/HttpHdrRange.c --- squid-2.6.STABLE19/src/HttpHdrRange.c 2008-03-18 00:34:41.000000000 +0100 +++ squid-2.6.STABLE20/src/HttpHdrRange.c 2008-04-25 21:45:19.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrRange.c,v 1.28.2.1 2008/03/17 23:34:41 hno Exp $ + * $Id: HttpHdrRange.c,v 1.28.2.2 2008/04/25 19:45:19 hno Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -242,7 +242,7 @@ if (strNCaseCmp(*str, "bytes=", 6)) return 0; /* skip "bytes="; hack! */ - pos = strBuf(*str) + 5; + pos = strBuf(*str) + 6; /* iterate through comma separated list */ while (strListGetItem(str, ',', &item, &ilen, &pos)) { HttpHdrRangeSpec *spec = httpHdrRangeSpecParseCreate(item, ilen); diff -ruN squid-2.6.STABLE19/src/HttpHeaderTools.c squid-2.6.STABLE20/src/HttpHeaderTools.c --- squid-2.6.STABLE19/src/HttpHeaderTools.c 2007-07-21 23:15:31.000000000 +0200 +++ squid-2.6.STABLE20/src/HttpHeaderTools.c 2008-04-02 03:04:20.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.c,v 1.37.2.2 2007/07/21 21:15:31 hno Exp $ + * $Id: HttpHeaderTools.c,v 1.37.2.3 2008/04/02 01:04:20 hno Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -239,26 +239,24 @@ strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos) { size_t len; - static char delim[2][3] = + static char delim[3][8] = { - {'"', 0, 0}, - {'"', '\\', 0}}; + "\"?,", + "\"\\", + " ?,\t\r\n" + }; int quoted = 0; delim[0][1] = del; + delim[2][1] = del; assert(str && item && pos); - if (*pos) { - if (!**pos) /* end of string */ - return 0; - else - (*pos)++; - } else { + if (!*pos) { *pos = strBuf(*str); if (!*pos) return 0; } + /* skip leading whitespace and delimiters */ + *pos += strspn(*pos, delim[2]); - /* skip leading ws (ltrim) */ - *pos += xcountws(*pos); *item = *pos; /* remember item's start */ /* find next delimiter */ do { diff -ruN squid-2.6.STABLE19/src/neighbors.c squid-2.6.STABLE20/src/neighbors.c --- squid-2.6.STABLE19/src/neighbors.c 2007-08-31 15:49:54.000000000 +0200 +++ squid-2.6.STABLE20/src/neighbors.c 2008-04-21 04:56:24.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.313.2.2 2007/08/31 13:49:54 hno Exp $ + * $Id: neighbors.c,v 1.313.2.3 2008/04/21 02:56:24 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -577,6 +577,9 @@ if (Config.Timeout.icp_query_max) if (*timeout > Config.Timeout.icp_query_max) *timeout = Config.Timeout.icp_query_max; + + if (*timeout < Config.Timeout.icp_query_min) + *timeout = Config.Timeout.icp_query_min; } return peers_pinged; } diff -ruN squid-2.6.STABLE19/src/peer_digest.c squid-2.6.STABLE20/src/peer_digest.c --- squid-2.6.STABLE19/src/peer_digest.c 2006-06-06 00:47:01.000000000 +0200 +++ squid-2.6.STABLE20/src/peer_digest.c 2008-04-21 04:28:41.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.c,v 1.94 2006/06/05 22:47:01 hno Exp $ + * $Id: peer_digest.c,v 1.94.2.1 2008/04/21 02:28:41 hno Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -50,10 +50,10 @@ static STCB peerDigestSwapInHeaders; static STCB peerDigestSwapInCBlock; static STCB peerDigestSwapInMask; -static int peerDigestFetchedEnough(DigestFetchState * fetch, char *buf, ssize_t size, const char *step_name); -static void peerDigestFetchStop(DigestFetchState * fetch, char *buf, const char *reason); -static void peerDigestFetchAbort(DigestFetchState * fetch, char *buf, const char *reason); -static void peerDigestReqFinish(DigestFetchState * fetch, char *buf, int, int, int, const char *reason, int err); +static int peerDigestFetchedEnough(DigestFetchState * fetch, ssize_t size, const char *step_name); +static void peerDigestFetchStop(DigestFetchState * fetch, const char *reason); +static void peerDigestFetchAbort(DigestFetchState * fetch, const char *reason); +static void peerDigestReqFinish(DigestFetchState * fetch, int, int, int, const char *reason, int err); static void peerDigestPDFinish(DigestFetchState * fetch, int pcb_valid, int err); static void peerDigestFetchFinish(DigestFetchState * fetch, int err); static void peerDigestFetchSetStats(DigestFetchState * fetch); @@ -328,9 +328,9 @@ /* push towards peer cache */ debug(72, 3) ("peerDigestRequest: forwarding to fwdStart...\n"); fwdStart(-1, e, req); - cbdataLock(fetch); cbdataLock(fetch->pd); - storeClientCopy(fetch->sc, e, 0, 0, 4096, memAllocate(MEM_4K_BUF), + fetch->buf = memAllocate(MEM_4K_BUF); + storeClientCopy(fetch->sc, e, 0, 0, 4096, fetch->buf, peerDigestFetchReply, fetch); } @@ -342,16 +342,18 @@ PeerDigest *pd = fetch->pd; size_t hdr_size; assert(pd && buf); - assert(!fetch->offset); - if (peerDigestFetchedEnough(fetch, buf, size, "peerDigestFetchReply")) + if (peerDigestFetchedEnough(fetch, size, "peerDigestFetchReply")) return; - if ((hdr_size = headersEnd(buf, size))) { + fetch->buf_used += size; + fetch->offset += size; + + if ((hdr_size = headersEnd(fetch->buf, fetch->buf_used))) { http_status status; HttpReply *reply = fetch->entry->mem_obj->reply; assert(reply); - httpReplyParse(reply, buf, hdr_size); + httpReplyParse(reply, fetch->buf, hdr_size); status = reply->sline.status; debug(72, 3) ("peerDigestFetchReply: %s status: %d, expires: %ld (%+d)\n", strBuf(pd->host), status, @@ -371,8 +373,11 @@ /* get rid of 304 reply */ storeClientUnregister(fetch->sc, fetch->entry, fetch); storeUnlockObject(fetch->entry); + /* And prepare to swap in old entry if needed */ fetch->entry = fetch->old_entry; fetch->old_entry = NULL; + fetch->sc = fetch->old_sc; + fetch->old_sc = NULL; /* preserve request -- we need its size to update counters */ /* requestUnlink(r); */ /* fetch->entry->mem_obj->request = NULL; */ @@ -387,22 +392,25 @@ } } else { /* some kind of a bug */ - peerDigestFetchAbort(fetch, buf, httpStatusLineReason(&reply->sline)); + peerDigestFetchAbort(fetch, httpStatusLineReason(&reply->sline)); return; } /* must have a ready-to-use store entry if we got here */ /* can we stay with the old in-memory digest? */ if (status == HTTP_NOT_MODIFIED && fetch->pd->cd) - peerDigestFetchStop(fetch, buf, "Not modified"); - else + peerDigestFetchStop(fetch, "Not modified"); + else { + fetch->offset = 0; + fetch->buf_used = 0; storeClientCopy(fetch->sc, fetch->entry, /* have to swap in */ - 0, 0, SM_PAGE_SIZE, buf, peerDigestSwapInHeaders, fetch); + 0, 0, SM_PAGE_SIZE, fetch->buf, peerDigestSwapInHeaders, fetch); + } } else { /* need more data, do we have space? */ - if (size >= SM_PAGE_SIZE) - peerDigestFetchAbort(fetch, buf, "reply header too big"); + if (fetch->buf_used >= SM_PAGE_SIZE) + peerDigestFetchAbort(fetch, "reply header too big"); else - storeClientCopy(fetch->sc, fetch->entry, size, 0, SM_PAGE_SIZE, buf, + storeClientCopy(fetch->sc, fetch->entry, fetch->offset, fetch->offset, SM_PAGE_SIZE - fetch->buf_used, fetch->buf + fetch->buf_used, peerDigestFetchReply, fetch); } } @@ -414,30 +422,33 @@ DigestFetchState *fetch = data; size_t hdr_size; - if (peerDigestFetchedEnough(fetch, buf, size, "peerDigestSwapInHeaders")) + if (peerDigestFetchedEnough(fetch, size, "peerDigestSwapInHeaders")) return; - assert(!fetch->offset); - if ((hdr_size = headersEnd(buf, size))) { + fetch->buf_used += size; + fetch->offset += size; + + if ((hdr_size = headersEnd(fetch->buf, fetch->buf_used))) { assert(fetch->entry->mem_obj->reply); if (!fetch->entry->mem_obj->reply->sline.status) - httpReplyParse(fetch->entry->mem_obj->reply, buf, hdr_size); + httpReplyParse(fetch->entry->mem_obj->reply, fetch->buf, hdr_size); if (fetch->entry->mem_obj->reply->sline.status != HTTP_OK) { debug(72, 1) ("peerDigestSwapInHeaders: %s status %d got cached!\n", strBuf(fetch->pd->host), fetch->entry->mem_obj->reply->sline.status); - peerDigestFetchAbort(fetch, buf, "internal status error"); + peerDigestFetchAbort(fetch, "internal status error"); return; } - fetch->offset += hdr_size; - storeClientCopy(fetch->sc, fetch->entry, size, fetch->offset, - SM_PAGE_SIZE, buf, + fetch->offset = hdr_size; + fetch->buf_used = 0; + storeClientCopy(fetch->sc, fetch->entry, fetch->offset, fetch->offset, + SM_PAGE_SIZE, fetch->buf, peerDigestSwapInCBlock, fetch); } else { /* need more data, do we have space? */ - if (size >= SM_PAGE_SIZE) - peerDigestFetchAbort(fetch, buf, "stored header too big"); + if (fetch->buf_used >= SM_PAGE_SIZE) + peerDigestFetchAbort(fetch, "stored header too big"); else - storeClientCopy(fetch->sc, fetch->entry, size, 0, SM_PAGE_SIZE, buf, + storeClientCopy(fetch->sc, fetch->entry, fetch->offset, fetch->offset, SM_PAGE_SIZE - fetch->buf_used, fetch->buf + fetch->buf_used, peerDigestSwapInHeaders, fetch); } } @@ -447,37 +458,40 @@ { DigestFetchState *fetch = data; - if (peerDigestFetchedEnough(fetch, buf, size, "peerDigestSwapInCBlock")) + if (peerDigestFetchedEnough(fetch, size, "peerDigestSwapInCBlock")) return; - if (size >= StoreDigestCBlockSize) { + fetch->buf_used += size; + fetch->offset += size; + + if (fetch->buf_used >= StoreDigestCBlockSize) { PeerDigest *pd = fetch->pd; HttpReply *rep = fetch->entry->mem_obj->reply; - const squid_off_t seen = fetch->offset + size; assert(pd && rep); - if (peerDigestSetCBlock(pd, buf)) { + if (peerDigestSetCBlock(pd, fetch->buf)) { /* XXX: soon we will have variable header size */ - fetch->offset += StoreDigestCBlockSize; + fetch->offset -= fetch->buf_used - StoreDigestCBlockSize; /* switch to CD buffer and fetch digest guts */ - memFree(buf, MEM_4K_BUF); - buf = NULL; + memFree(fetch->buf, MEM_4K_BUF); + fetch->buf = buf = NULL; + fetch->buf_used = 0; assert(pd->cd->mask); storeClientCopy(fetch->sc, fetch->entry, - seen, + fetch->offset, fetch->offset, pd->cd->mask_size, pd->cd->mask, peerDigestSwapInMask, fetch); } else { - peerDigestFetchAbort(fetch, buf, "invalid digest cblock"); + peerDigestFetchAbort(fetch, "invalid digest cblock"); } } else { /* need more data, do we have space? */ - if (size >= SM_PAGE_SIZE) - peerDigestFetchAbort(fetch, buf, "digest cblock too big"); + if (fetch->buf_used >= SM_PAGE_SIZE) + peerDigestFetchAbort(fetch, "digest cblock too big"); else - storeClientCopy(fetch->sc, fetch->entry, size, 0, SM_PAGE_SIZE, buf, + storeClientCopy(fetch->sc, fetch->entry, fetch->offset, fetch->offset, SM_PAGE_SIZE - fetch->buf_used, fetch->buf + fetch->buf_used, peerDigestSwapInCBlock, fetch); } } @@ -489,7 +503,7 @@ PeerDigest *pd; /* NOTE! buf points to the middle of pd->cd->mask! */ - if (peerDigestFetchedEnough(fetch, NULL, size, "peerDigestSwapInMask")) + if (peerDigestFetchedEnough(fetch, size, "peerDigestSwapInMask")) return; pd = fetch->pd; @@ -501,7 +515,7 @@ debug(72, 2) ("peerDigestSwapInMask: Done! Got %" PRINTF_OFF_T ", expected %d\n", fetch->mask_offset, pd->cd->mask_size); assert(fetch->mask_offset == pd->cd->mask_size); - assert(peerDigestFetchedEnough(fetch, NULL, 0, "peerDigestSwapInMask")); + assert(peerDigestFetchedEnough(fetch, 0, "peerDigestSwapInMask")); } else { const size_t buf_sz = pd->cd->mask_size - fetch->mask_offset; assert(buf_sz > 0); @@ -515,7 +529,7 @@ } static int -peerDigestFetchedEnough(DigestFetchState * fetch, char *buf, ssize_t size, const char *step_name) +peerDigestFetchedEnough(DigestFetchState * fetch, ssize_t size, const char *step_name) { PeerDigest *pd = NULL; const char *host = ""; /* peer host */ @@ -558,8 +572,10 @@ if (!reason && !size) { if (!pd->cd) reason = "null digest?!"; + else if (fetch->buf_used) + reason = "premature end of digest header?!"; else if (fetch->mask_offset != pd->cd->mask_size) - reason = "premature end of digest?!"; + reason = "premature end of digest mask?!"; else if (!peerDigestUseful(pd)) reason = "useless digest"; else @@ -570,8 +586,7 @@ const int level = strstr(reason, "?!") ? 1 : 3; debug(72, level) ("%s: peer %s, exiting after '%s'\n", step_name, host, reason); - peerDigestReqFinish(fetch, buf, - fcb_valid, pdcb_valid, pcb_valid, reason, !no_bug); + peerDigestReqFinish(fetch, fcb_valid, pdcb_valid, pcb_valid, reason, !no_bug); } else { /* paranoid check */ assert(fcb_valid && pdcb_valid && pcb_valid); @@ -582,27 +597,27 @@ /* call this when all callback data is valid and fetch must be stopped but * no error has occurred (e.g. we received 304 reply and reuse old digest) */ static void -peerDigestFetchStop(DigestFetchState * fetch, char *buf, const char *reason) +peerDigestFetchStop(DigestFetchState * fetch, const char *reason) { assert(reason); debug(72, 2) ("peerDigestFetchStop: peer %s, reason: %s\n", strBuf(fetch->pd->host), reason); - peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 0); + peerDigestReqFinish(fetch, 1, 1, 1, reason, 0); } /* call this when all callback data is valid but something bad happened */ static void -peerDigestFetchAbort(DigestFetchState * fetch, char *buf, const char *reason) +peerDigestFetchAbort(DigestFetchState * fetch, const char *reason) { assert(reason); debug(72, 2) ("peerDigestFetchAbort: peer %s, reason: %s\n", strBuf(fetch->pd->host), reason); - peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 1); + peerDigestReqFinish(fetch, 1, 1, 1, reason, 1); } /* complete the digest transfer, update stats, unlock/release everything */ static void -peerDigestReqFinish(DigestFetchState * fetch, char *buf, +peerDigestReqFinish(DigestFetchState * fetch, int fcb_valid, int pdcb_valid, int pcb_valid, const char *reason, int err) { @@ -631,8 +646,6 @@ peerDigestPDFinish(fetch, pcb_valid, err); if (fcb_valid) peerDigestFetchFinish(fetch, err); - if (buf) - memFree(buf, MEM_4K_BUF); } @@ -706,7 +719,10 @@ fetch->entry = NULL; fetch->request = NULL; assert(fetch->pd == NULL); - cbdataUnlock(fetch); + if (fetch->buf) { + memFree(fetch->buf, MEM_4K_BUF); + fetch->buf = NULL; + } cbdataFree(fetch); } diff -ruN squid-2.6.STABLE19/src/structs.h squid-2.6.STABLE20/src/structs.h --- squid-2.6.STABLE19/src/structs.h 2007-09-05 23:28:34.000000000 +0200 +++ squid-2.6.STABLE20/src/structs.h 2008-04-21 04:56:24.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.507.2.8 2007/09/05 21:28:34 hno Exp $ + * $Id: structs.h,v 1.507.2.10 2008/04/21 02:56:24 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -460,6 +460,7 @@ time_t deadPeer; int icp_query; /* msec */ int icp_query_max; /* msec */ + int icp_query_min; /* msec */ int mcast_icp_query; /* msec */ #if USE_IDENT time_t ident; @@ -1336,6 +1337,8 @@ int msg; int bytes; } sent, recv; + char *buf; + size_t buf_used; }; /* statistics for cache digests and other hit "predictors" */ diff -ruN squid-2.6.STABLE19/src/win32.c squid-2.6.STABLE20/src/win32.c --- squid-2.6.STABLE19/src/win32.c 2007-08-31 16:06:15.000000000 +0200 +++ squid-2.6.STABLE20/src/win32.c 2008-04-02 03:04:58.000000000 +0200 @@ -1,6 +1,6 @@ /* - * $Id: win32.c,v 1.17.2.1 2007/08/31 14:06:15 hno Exp $ + * $Id: win32.c,v 1.17.2.2 2008/04/02 01:04:58 hno Exp $ * * Windows support * AUTHOR: Guido Serassio @@ -273,7 +273,7 @@ if (osvi.wProductType == VER_NT_WORKSTATION) WIN32_OS_string = xstrdup("Windows Vista"); else - WIN32_OS_string = xstrdup("Windows Server \"Longhorn\""); + WIN32_OS_string = xstrdup("Windows Server 2008"); return _WIN_OS_WINLON; } break;