diff -u -r -N squid-3.0.STABLE13/ChangeLog squid-3.0.STABLE14/ChangeLog
--- squid-3.0.STABLE13/ChangeLog	2009-02-03 14:36:11.000000000 +1300
+++ squid-3.0.STABLE14/ChangeLog	2009-04-11 20:35:26.000000000 +1200
@@ -1,3 +1,23 @@
+Changes to squid-3.0.STABLE14 (11 Apr 2009):
+
+	- Regression Fix: HTTP/0.9 in accelerator mode
+	- Bug 1232: cache_dir parameter limited to only 63 entries
+	- Bug 1868: support HTTP 207 status
+	- Bug 2518: assertion failure on restart/reconfigure
+	- Bug 2588: coredump in rDNS lookup
+	- Bug 2595: Out of bounds memory write in squid_kerb_auth
+	- Bug 2599: Idempotent start
+	- Bug 2605: Prevent setsid() on helpers in daemon mode
+	- Fix external_acl_type option parsing
+	- Fix delay pools counters on FTP
+	- Fix several issues with ident (some remain)
+	- Fix performance issues with persistent connections
+	- Fix performance issues with delay pools
+	- Fix forwarding of OPTIONS requests
+	- Add support for HTTP 1.1 Content-Disposition header
+	- Add support for Windows 7, Windows Server 2008 R2 and later
+	- ... and many small documentation updates
+
 Changes to squid-3.0.STABLE13 (03 Feb 2009):
 
 	- Fix several issues in request parsing
diff -u -r -N squid-3.0.STABLE13/configure squid-3.0.STABLE14/configure
--- squid-3.0.STABLE13/configure	2009-02-03 14:36:23.000000000 +1300
+++ squid-3.0.STABLE14/configure	2009-04-11 20:35:42.000000000 +1200
@@ -1,7 +1,7 @@
 #! /bin/sh
 # From configure.in Revision: 1.488.2.3 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62 for Squid Web Proxy 3.0.STABLE13.
+# Generated by GNU Autoconf 2.62 for Squid Web Proxy 3.0.STABLE14.
 #
 # Report bugs to <http://www.squid-cache.org/bugs/>.
 #
@@ -751,8 +751,8 @@
 # Identity of this package.
 PACKAGE_NAME='Squid Web Proxy'
 PACKAGE_TARNAME='squid'
-PACKAGE_VERSION='3.0.STABLE13'
-PACKAGE_STRING='Squid Web Proxy 3.0.STABLE13'
+PACKAGE_VERSION='3.0.STABLE14'
+PACKAGE_STRING='Squid Web Proxy 3.0.STABLE14'
 PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/'
 
 ac_unique_file="src/main.cc"
@@ -1661,7 +1661,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 3.0.STABLE13 to adapt to many kinds of systems.
+\`configure' configures Squid Web Proxy 3.0.STABLE14 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1731,7 +1731,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Squid Web Proxy 3.0.STABLE13:";;
+     short | recursive ) echo "Configuration of Squid Web Proxy 3.0.STABLE14:";;
    esac
   cat <<\_ACEOF
 
@@ -2043,7 +2043,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Squid Web Proxy configure 3.0.STABLE13
+Squid Web Proxy configure 3.0.STABLE14
 generated by GNU Autoconf 2.62
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -2057,7 +2057,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 3.0.STABLE13, which was
+It was created by Squid Web Proxy $as_me 3.0.STABLE14, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   $ $0 $@
@@ -2755,7 +2755,7 @@
 
 # Define the identity of the package.
  PACKAGE='squid'
- VERSION='3.0.STABLE13'
+ VERSION='3.0.STABLE14'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -25024,8 +25024,6 @@
 
 
 
-
-
 for ac_header in \
 	arpa/inet.h \
 	arpa/nameser.h \
@@ -25104,8 +25102,6 @@
 	stdint.h \
 	inttypes.h \
 	grp.h \
-	nss_common.h \
-	nss.h \
 	db.h \
 	db_185.h \
 	sys/capability.h
@@ -47866,7 +47862,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 3.0.STABLE13, which was
+This file was extended by Squid Web Proxy $as_me 3.0.STABLE14, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -47919,7 +47915,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-Squid Web Proxy config.status 3.0.STABLE13
+Squid Web Proxy config.status 3.0.STABLE14
 configured by $0, generated by GNU Autoconf 2.62,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -u -r -N squid-3.0.STABLE13/configure.in squid-3.0.STABLE14/configure.in
--- squid-3.0.STABLE13/configure.in	2009-02-03 14:36:23.000000000 +1300
+++ squid-3.0.STABLE14/configure.in	2009-04-11 20:35:42.000000000 +1200
@@ -1,8 +1,7 @@
-
 dnl  Configuration input file for Squid
 dnl
 dnl
-AC_INIT(Squid Web Proxy, 3.0.STABLE13, http://www.squid-cache.org/bugs/, squid)
+AC_INIT(Squid Web Proxy, 3.0.STABLE14, http://www.squid-cache.org/bugs/, squid)
 AC_PREREQ(2.52)
 AM_CONFIG_HEADER(include/autoconf.h)
 AC_CONFIG_AUX_DIR(cfgaux)
@@ -1940,8 +1939,6 @@
 	stdint.h \
 	inttypes.h \
 	grp.h \
-	nss_common.h \
-	nss.h \
 	db.h \
 	db_185.h \
 	sys/capability.h
diff -u -r -N squid-3.0.STABLE13/helpers/basic_auth/LDAP/squid_ldap_auth.c squid-3.0.STABLE14/helpers/basic_auth/LDAP/squid_ldap_auth.c
--- squid-3.0.STABLE13/helpers/basic_auth/LDAP/squid_ldap_auth.c	2009-02-03 14:36:16.000000000 +1300
+++ squid-3.0.STABLE14/helpers/basic_auth/LDAP/squid_ldap_auth.c	2009-04-11 20:35:32.000000000 +1200
@@ -544,6 +544,7 @@
 	fprintf(stderr, "\t-v 2|3\t\t\tLDAP version\n");
 	fprintf(stderr, "\t-Z\t\t\tTLS encrypt the LDAP connection, requires LDAP version 3\n");
 #endif
+	fprintf(stderr, "\t-d\t\t\tenable debug mode\n");
 	fprintf(stderr, "\n");
 	fprintf(stderr, "\tIf no search filter is specified, then the dn <userattr>=user,basedn\n\twill be used (same as specifying a search filter of '<userattr>=',\n\tbut quicker as as there is no need to search for the user DN)\n\n");
 	fprintf(stderr, "\tIf you need to bind as a user to perform searches then use the\n\t-D binddn -w bindpasswd or -D binddn -W secretfile options\n\n");
diff -u -r -N squid-3.0.STABLE13/helpers/external_acl/ldap_group/squid_ldap_group.c squid-3.0.STABLE14/helpers/external_acl/ldap_group/squid_ldap_group.c
--- squid-3.0.STABLE13/helpers/external_acl/ldap_group/squid_ldap_group.c	2009-02-03 14:36:16.000000000 +1300
+++ squid-3.0.STABLE14/helpers/external_acl/ldap_group/squid_ldap_group.c	2009-04-11 20:35:34.000000000 +1200
@@ -431,6 +431,7 @@
 	fprintf(stderr, "\t-g\t\t\tfirst query parameter is base DN extension\n\t\t\t\tfor this query\n");
 	fprintf(stderr, "\t-S\t\t\tStrip NT domain from usernames\n");
 	fprintf(stderr, "\t-K\t\t\tStrip Kerberos realm from usernames\n");
+	fprintf(stderr, "\t-d\t\t\tenable debug mode\n");
 	fprintf(stderr, "\n");
 	fprintf(stderr, "\tIf you need to bind as a user to perform searches then use the\n\t-D binddn -w bindpasswd or -D binddn -W secretfile options\n\n");
 	exit(1);
diff -u -r -N squid-3.0.STABLE13/helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c squid-3.0.STABLE14/helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c
--- squid-3.0.STABLE13/helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c	2009-02-03 14:36:19.000000000 +1300
+++ squid-3.0.STABLE14/helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c	2009-04-11 20:35:37.000000000 +1200
@@ -115,7 +115,7 @@
   }
 
   freeaddrinfo(hres);
-  hostname[MAXHOSTNAMELEN]='\0';
+  hostname[MAXHOSTNAMELEN-1]='\0';
   return(strdup(hostname));
 }
 
diff -u -r -N squid-3.0.STABLE13/include/autoconf.h.in squid-3.0.STABLE14/include/autoconf.h.in
--- squid-3.0.STABLE13/include/autoconf.h.in	2009-02-03 14:36:20.000000000 +1300
+++ squid-3.0.STABLE14/include/autoconf.h.in	2009-04-11 20:35:37.000000000 +1200
@@ -393,12 +393,6 @@
 /* Define to 1 if you have the <net/pfvar.h> header file. */
 #undef HAVE_NET_PFVAR_H
 
-/* Define to 1 if you have the <nss_common.h> header file. */
-#undef HAVE_NSS_COMMON_H
-
-/* Define to 1 if you have the <nss.h> header file. */
-#undef HAVE_NSS_H
-
 /* off_t is defined by the system headers */
 #undef HAVE_OFF_T
 
diff -u -r -N squid-3.0.STABLE13/include/snmp_error.h squid-3.0.STABLE14/include/snmp_error.h
--- squid-3.0.STABLE13/include/snmp_error.h	2009-02-03 14:36:20.000000000 +1300
+++ squid-3.0.STABLE14/include/snmp_error.h	2009-04-11 20:35:37.000000000 +1200
@@ -44,6 +44,7 @@
 #define SNMP_ERR_WRONGTYPE           (0x7)
 #define SNMP_ERR_WRONGLENGTH         (0x8)
 #define SNMP_ERR_WRONGENCODING       (0x9)
+/* 0x0A - 0x0F undefined */
 #define SNMP_ERR_WRONGVALUE          (0x10)
 #define SNMP_ERR_NOCREATION          (0x11)
 #define SNMP_ERR_INCONSISTENTVALUE   (0x12)
diff -u -r -N squid-3.0.STABLE13/include/version.h squid-3.0.STABLE14/include/version.h
--- squid-3.0.STABLE13/include/version.h	2009-02-03 14:36:23.000000000 +1300
+++ squid-3.0.STABLE14/include/version.h	2009-04-11 20:35:42.000000000 +1200
@@ -9,5 +9,5 @@
  */
 
 #ifndef SQUID_RELEASE_TIME
-#define SQUID_RELEASE_TIME 1233624970
+#define SQUID_RELEASE_TIME 1239438925
 #endif
diff -u -r -N squid-3.0.STABLE13/lib/rfc2617.c squid-3.0.STABLE14/lib/rfc2617.c
--- squid-3.0.STABLE13/lib/rfc2617.c	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/lib/rfc2617.c	2009-04-11 20:35:38.000000000 +1200
@@ -94,6 +94,11 @@
 	else
 	    Bin[i / 2] |= n;
     }
+/* FIXME: Coverity detects the below as dead code.
+  Why? :: right here i == 32 
+    which means the first step of the for loop makes i==16
+    and cannot be < HASHLEN (which is also 16)
+*/
     for (i = i / 2; i < HASHLEN; i++) {
 	Bin[i] = '\0';
     }
diff -u -r -N squid-3.0.STABLE13/RELEASENOTES.html squid-3.0.STABLE14/RELEASENOTES.html
--- squid-3.0.STABLE13/RELEASENOTES.html	2009-02-03 14:37:18.000000000 +1300
+++ squid-3.0.STABLE14/RELEASENOTES.html	2009-04-11 20:36:35.000000000 +1200
@@ -1,11 +1,11 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <HTML>
 <HEAD>
- <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.50">
- <TITLE>Squid 3.0.STABLE13 release notes</TITLE>
+ <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
+ <TITLE>Squid 3.0.STABLE14 release notes</TITLE>
 </HEAD>
 <BODY>
-<H1>Squid 3.0.STABLE13 release notes</H1>
+<H1>Squid 3.0.STABLE14 release notes</H1>
 
 <H2>Squid Developers</H2>
 <HR>
@@ -15,7 +15,7 @@
 <HR>
 <H2><A NAME="s1">1. Notice</A></H2>
 
-<P>The Squid Team are pleased to announce the release of Squid-3.0.STABLE13.</P>
+<P>The Squid Team are pleased to announce the release of Squid-3.0.STABLE14.</P>
 <P>This new release is available for download from 
 <A HREF="http://www.squid-cache.org/Versions/v3/3.0/">http://www.squid-cache.org/Versions/v3/3.0/</A> or the 
 <A HREF="http://www.squid-cache.org/Mirrors/http-mirrors.html">mirrors</A>.</P>
@@ -227,6 +227,7 @@
 <LI>When Squid runs in command line mode, the launching user account must have administrative privilege on the system</LI>
 <LI>"Start parameters" in the Windows 2000/XP/2003 Service applet cannot be used</LI>
 <LI>Building with MinGW, when the configure option --enable-truncate is used, Squid cannot run on Windows NT, only Windows 2000 and later are supported</LI>
+<LI>On Windows Vista and later, User Account Control (UAC) must be disabled before running service installation</LI>
 </UL>
 </P>
 </DL>
@@ -713,10 +714,9 @@
 <P>Common options <EM>no-store</EM>, replaces the older <EM>read-only</EM> option</P>
 
 <DT><B>auth_param</B><DD>
-<P>Removed Basic auth option
+<P>Removed Basic auth options:
 <PRE>
     blankpasswor, not yet ported to squid-3.
-    auth_param basic concurrency 0
         
 </PRE>
 </P>
@@ -847,7 +847,7 @@
 This is useful for class 4 Delay Pools in Squid 3.x</P>
 
 <DT><B>half_closed_clients</B><DD>
-<P>New defaut vaue of OFF</P>
+<P>New default value of OFF</P>
 
 </DL>
 </P>
diff -u -r -N squid-3.0.STABLE13/snmplib/snmp_error.c squid-3.0.STABLE14/snmplib/snmp_error.c
--- squid-3.0.STABLE13/snmplib/snmp_error.c	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/snmplib/snmp_error.c	2009-04-11 20:35:39.000000000 +1200
@@ -33,8 +33,8 @@
 #include "snmp_error.h"
 
 
-static const char *error_string[19] =
-{
+static const char *error_string[25] = {
+    /* 0x00 - 0x05 */
     "No Error",
     "Response message would have been too large.",
     "There is no such variable name in this MIB.",
@@ -42,11 +42,21 @@
     "This variable is read only",
     "A general failure occured",
 
-  /* SNMPv2 Errors */
+    /* 0x06 - 0x09 */
     "NOACCESS",
     "WRONGTYPE",
     "WRONGLENGTH",
     "WRONGENCODING",
+
+    /* 0x0A - 0x0F */
+    "UNDEFINED",
+    "UNDEFINED",
+    "UNDEFINED",
+    "UNDEFINED",
+    "UNDEFINED",
+    "UNDEFINED",
+
+    /* 0x10 - 0x18 */
     "WRONGVALUE",
     "NOCREATION",
     "INCONSISTENTVALUE",
diff -u -r -N squid-3.0.STABLE13/src/ACLExtUser.h squid-3.0.STABLE14/src/ACLExtUser.h
--- squid-3.0.STABLE13/src/ACLExtUser.h	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/ACLExtUser.h	2009-04-11 20:35:39.000000000 +1200
@@ -33,8 +33,9 @@
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
-#ifndef SQUID_ACLIDENT_H
-#define SQUID_ACLIDENT_H
+#ifndef SQUID_EXTUSER_H
+#define SQUID_EXTUSER_H
+
 #include "ACL.h"
 #include "ACLChecklist.h"
 #include "ACLData.h"
@@ -69,4 +70,4 @@
 
 MEMPROXY_CLASS_INLINE(ACLExtUser)
 
-#endif /* SQUID_ACLIDENT_H */
+#endif /* SQUID_EXTUSER_H */
diff -u -r -N squid-3.0.STABLE13/src/AsyncEngine.h squid-3.0.STABLE14/src/AsyncEngine.h
--- squid-3.0.STABLE13/src/AsyncEngine.h	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/AsyncEngine.h	2009-04-11 20:35:39.000000000 +1200
@@ -57,7 +57,7 @@
          */
         EVENT_IDLE = -1,
         /* some error has occured in this engine */
-        EVENT_ERROR = -2,
+        EVENT_ERROR = -2
     };
 
     virtual ~AsyncEngine() {}
diff -u -r -N squid-3.0.STABLE13/src/auth/basic/auth_basic.cc squid-3.0.STABLE14/src/auth/basic/auth_basic.cc
--- squid-3.0.STABLE13/src/auth/basic/auth_basic.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/auth/basic/auth_basic.cc	2009-04-11 20:35:40.000000000 +1200
@@ -143,9 +143,8 @@
 AuthBasicUserRequest::authenticated() const
 {
     BasicUser const *basic_auth = dynamic_cast<BasicUser const *>(user());
-    assert (basic_auth != NULL);
 
-    if (basic_auth->authenticated())
+    if (basic_auth && basic_auth->authenticated())
         return 1;
 
     return 0;
@@ -334,7 +333,7 @@
 
         parse_wordlist(&authenticate);
 
-        requirePathnameExists("authparam basic program", authenticate->key);
+        requirePathnameExists("auth_param basic program", authenticate->key);
     } else if (strcasecmp(param_str, "children") == 0) {
         parse_int(&authenticateChildren);
     } else if (strcasecmp(param_str, "concurrency") == 0) {
diff -u -r -N squid-3.0.STABLE13/src/auth/digest/auth_digest.cc squid-3.0.STABLE14/src/auth/digest/auth_digest.cc
--- squid-3.0.STABLE13/src/auth/digest/auth_digest.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/auth/digest/auth_digest.cc	2009-04-11 20:35:40.000000000 +1200
@@ -933,7 +933,7 @@
 
         parse_wordlist(&authenticate);
 
-        requirePathnameExists("authparam digest program", authenticate->key);
+        requirePathnameExists("auth_param digest program", authenticate->key);
     } else if (strcasecmp(param_str, "children") == 0) {
         parse_int(&authenticateChildren);
     } else if (strcasecmp(param_str, "realm") == 0) {
diff -u -r -N squid-3.0.STABLE13/src/auth/negotiate/auth_negotiate.cc squid-3.0.STABLE14/src/auth/negotiate/auth_negotiate.cc
--- squid-3.0.STABLE13/src/auth/negotiate/auth_negotiate.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/auth/negotiate/auth_negotiate.cc	2009-04-11 20:35:40.000000000 +1200
@@ -147,7 +147,7 @@
 
         parse_wordlist(&authenticate);
 
-        requirePathnameExists("authparam negotiate program", authenticate->key);
+        requirePathnameExists("auth_param negotiate program", authenticate->key);
     } else if (strcasecmp(param_str, "children") == 0) {
         parse_int(&authenticateChildren);
     } else if (strcasecmp(param_str, "keep_alive") == 0) {
diff -u -r -N squid-3.0.STABLE13/src/auth/ntlm/auth_ntlm.cc squid-3.0.STABLE14/src/auth/ntlm/auth_ntlm.cc
--- squid-3.0.STABLE13/src/auth/ntlm/auth_ntlm.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/auth/ntlm/auth_ntlm.cc	2009-04-11 20:35:40.000000000 +1200
@@ -141,7 +141,7 @@
 
         parse_wordlist(&authenticate);
 
-        requirePathnameExists("authparam ntlm program", authenticate->key);
+        requirePathnameExists("auth_param ntlm program", authenticate->key);
     } else if (strcasecmp(param_str, "children") == 0) {
         parse_int(&authenticateChildren);
     } else if (strcasecmp(param_str, "keep_alive") == 0) {
diff -u -r -N squid-3.0.STABLE13/src/cache_cf.cc squid-3.0.STABLE14/src/cache_cf.cc
--- squid-3.0.STABLE13/src/cache_cf.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/cache_cf.cc	2009-04-11 20:35:40.000000000 +1200
@@ -873,7 +873,7 @@
     if (!strncasecmp(unit, B_GBYTES_STR, strlen(B_GBYTES_STR)))
         return 1 << 30;
 
-    debugs(3, 1, "parseBytesUnits: unknown bytes unit '" << unit << "'");
+    debugs(3, DBG_CRITICAL, "WARNING: Unknown bytes unit '" << unit << "'");
 
     return 0;
 }
@@ -1483,8 +1483,7 @@
     for (i = 0; i < swap->n_configured; i++) {
         assert (swap->swapDirs[i].getRaw());
 
-        if ((strcasecmp(path_str, dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw())->path)
-            ) == 0) {
+        if ((strcasecmp(path_str, dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw())->path)) == 0) {
             /* this is specific to on-fs Stores. The right
              * way to handle this is probably to have a mapping 
              * from paths to stores, and have on-fs stores
@@ -1509,7 +1508,13 @@
     }
 
     /* new cache_dir */
-    assert(swap->n_configured < 63);	/* 7 bits, signed */
+    if(swap->n_configured > 63) {
+        /* 7 bits, signed */
+        debugs(3, DBG_CRITICAL, "WARNING: There is a fixed maximum of 63 cache_dir entries Squid can handle.");
+        debugs(3, DBG_CRITICAL, "WARNING: '" << path_str << "' is one to many.");
+        self_destruct();
+        return;
+    }
 
     allocate_new_swapdir(swap);
 
diff -u -r -N squid-3.0.STABLE13/src/cbdata.h squid-3.0.STABLE14/src/cbdata.h
--- squid-3.0.STABLE13/src/cbdata.h	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/cbdata.h	2009-04-11 20:35:40.000000000 +1200
@@ -44,7 +44,7 @@
  * are added runtime
  */
 typedef enum {
-    CBDATA_UNKNOWN = 0,
+    CBDATA_UNKNOWN = 0
 } cbdata_type;
 
 extern void cbdataRegisterWithCacheManager(CacheManager & manager);
diff -u -r -N squid-3.0.STABLE13/src/cf.data.pre squid-3.0.STABLE14/src/cf.data.pre
--- squid-3.0.STABLE13/src/cf.data.pre	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/cf.data.pre	2009-04-11 20:35:40.000000000 +1200
@@ -405,8 +405,8 @@
 	  %USER_CERTCHAIN SSL User certificate chain in PEM format
 	  %USER_CERT_xx	SSL User certificate subject attribute xx
 	  %USER_CA_xx	SSL User certificate issuer attribute xx
-	  %{Header}	HTTP request header
-	  %{Hdr:member}	HTTP request header list member
+	  %{Header}	HTTP request header "Header"
+	  %{Hdr:member}	HTTP request header "Hdr" list member "member"
 	  %{Hdr:;member}
 	  		HTTP request header list member using ; as
 	  		list separator. ; can be any non-alphanumeric
@@ -2895,8 +2895,9 @@
 	when requested by a HTTP/1.0 client. This option
 	enables Squid to ignore such expiry times until
 	HTTP/1.1 is fully implemented.
-	WARNING: This may eventually cause some varying
-	objects not intended for caching to get cached.
+
+	WARNING: If turned on this may eventually cause some
+	varying objects not intended for caching to get cached.
 DOC_END
 
 NAME: extension_methods
diff -u -r -N squid-3.0.STABLE13/src/client_side.cc squid-3.0.STABLE14/src/client_side.cc
--- squid-3.0.STABLE13/src/client_side.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/client_side.cc	2009-04-11 20:35:41.000000000 +1200
@@ -2190,13 +2190,13 @@
     /* compile headers */
     /* we should skip request line! */
     /* XXX should actually know the damned buffer size here */
-    if (!request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) {
+    if (http_ver.major >= 1 && !request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) {
         clientStreamNode *node = context->getClientReplyContext();
         debugs(33, 5, "Failed to parse request headers:\n" << HttpParserHdrBuf(hp));
         clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
         assert (repContext);
         repContext->setReplyToError(
-            ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri,
+            ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, http->uri,
             &conn->peer.sin_addr, NULL, NULL, NULL);
         assert(context->http->out.offset == 0);
         context->pullData();
diff -u -r -N squid-3.0.STABLE13/src/client_side_reply.cc squid-3.0.STABLE14/src/client_side_reply.cc
--- squid-3.0.STABLE13/src/client_side_reply.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/client_side_reply.cc	2009-04-11 20:35:41.000000000 +1200
@@ -1498,6 +1498,8 @@
         return;
     }
 
+    /* TODO: handle OPTIONS request on max_forwards == 0 as well */
+
     if (context->http->request->method == METHOD_TRACE) {
         if (context->http->request->max_forwards == 0) {
             context->traceReply(aNode);
diff -u -r -N squid-3.0.STABLE13/src/client_side_request.cc squid-3.0.STABLE14/src/client_side_request.cc
--- squid-3.0.STABLE13/src/client_side_request.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/client_side_request.cc	2009-04-11 20:35:41.000000000 +1200
@@ -745,8 +745,8 @@
     }
 
 #endif
-    if (request->method == METHOD_TRACE) {
-        request->max_forwards = req_hdr->getInt(HDR_MAX_FORWARDS);
+    if (request->method == METHOD_TRACE || request->method == METHOD_OPTIONS) {
+        request->max_forwards = req_hdr->getInt64(HDR_MAX_FORWARDS);
     }
 
     request->flags.cachable = http->request->cacheable();
diff -u -r -N squid-3.0.STABLE13/src/comm.cc squid-3.0.STABLE14/src/comm.cc
--- squid-3.0.STABLE13/src/comm.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/comm.cc	2009-04-11 20:35:41.000000000 +1200
@@ -1513,7 +1513,8 @@
     if (F->flags.closing)
         return;
 
-    if (shutting_down && (!F->flags.open || F->type == FD_FILE))
+    /* XXX: is this obsolete behind F->closing() ? */
+    if ( (shutting_down || reconfiguring) && (!F->flags.open || F->type == FD_FILE))
         return;
 
     assert(F->flags.open);
@@ -2495,6 +2496,7 @@
     reads = deferredReads;
     deferredReads = ListContainer<DeferredRead>();
 
+    // XXX: For fairness this SHOULD randomize the order
     while (!reads.empty()) {
         DeferredRead aRead = popHead(reads);
         kickARead(aRead);
diff -u -r -N squid-3.0.STABLE13/src/DelayPool.cc squid-3.0.STABLE14/src/DelayPool.cc
--- squid-3.0.STABLE13/src/DelayPool.cc	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/DelayPool.cc	2009-04-11 20:35:39.000000000 +1200
@@ -115,11 +115,7 @@
 void
 CompositePoolNode::kickReads()
 {
-    /* we only start one, because delay pools may have **many** attached connections,
-     * and kicking them all off would be chaotic.
-     * This may need to be reviewed.
-     */
-    deferredReads.kickReads(1);
+    deferredReads.kickReads(-1);
 }
 
 #endif
diff -u -r -N squid-3.0.STABLE13/src/dns_internal.cc squid-3.0.STABLE14/src/dns_internal.cc
--- squid-3.0.STABLE13/src/dns_internal.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/dns_internal.cc	2009-04-11 20:35:41.000000000 +1200
@@ -485,6 +485,8 @@
     case _WIN_OS_WINNET:
 
     case _WIN_OS_WINLON:
+
+    case _WIN_OS_WIN7:
         /* get nameservers from the Windows 2000 registry */
         /* search all interfaces for DNS server addresses */
 
diff -u -r -N squid-3.0.STABLE13/src/enums.h squid-3.0.STABLE14/src/enums.h
--- squid-3.0.STABLE13/src/enums.h	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/enums.h	2009-04-11 20:35:41.000000000 +1200
@@ -545,7 +545,8 @@
     _WIN_OS_WIN2K,
     _WIN_OS_WINXP,
     _WIN_OS_WINNET,
-    _WIN_OS_WINLON
+    _WIN_OS_WINLON,
+    _WIN_OS_WIN7
 };
 
 #endif
diff -u -r -N squid-3.0.STABLE13/src/external_acl.cc squid-3.0.STABLE14/src/external_acl.cc
--- squid-3.0.STABLE13/src/external_acl.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/external_acl.cc	2009-04-11 20:35:41.000000000 +1200
@@ -357,10 +357,10 @@
             format->type = _external_acl_format::EXT_ACL_USER_CERT_RAW;
         else if (strcmp(token, "%USER_CERTCHAIN") == 0)
             format->type = _external_acl_format::EXT_ACL_USER_CERTCHAIN_RAW;
-        else if (strncmp(token, "%USER_CERT_", 11)) {
+        else if (strncmp(token, "%USER_CERT_", 11) == 0) {
             format->type = _external_acl_format::EXT_ACL_USER_CERT;
             format->header = xstrdup(token + 11);
-        } else if (strncmp(token, "%CA_CERT_", 11)) {
+        } else if (strncmp(token, "%CA_CERT_", 11) == 0) {
             format->type = _external_acl_format::EXT_ACL_USER_CERT;
             format->header = xstrdup(token + 11);
         }
diff -u -r -N squid-3.0.STABLE13/src/forward.cc squid-3.0.STABLE14/src/forward.cc
--- squid-3.0.STABLE13/src/forward.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/forward.cc	2009-04-11 20:35:41.000000000 +1200
@@ -767,7 +767,6 @@
     FwdServer *fs = servers;
     const char *host;
     unsigned short port;
-    const char *domain = NULL;
     int ctimeout;
     int ftimeout = Config.Timeout.forward - (squid_curtime - start_t);
 #if LINUX_TPROXY
@@ -784,16 +783,9 @@
     debugs(17, 3, "fwdConnectStart: " << url);
 
     if (fs->_peer) {
-        host = fs->_peer->host;
-        port = fs->_peer->http_port;
         ctimeout = fs->_peer->connect_timeout > 0 ? fs->_peer->connect_timeout
                    : Config.Timeout.peer_connect;
-
-        if (fs->_peer->options.originserver)
-            domain = request->host;
     } else {
-        host = request->host;
-        port = request->port;
         ctimeout = Config.Timeout.connect;
     }
 
@@ -809,7 +801,16 @@
     if (ftimeout < ctimeout)
         ctimeout = ftimeout;
 
-    fd = fwdPconnPool->pop(host, port, domain, client_addr, checkRetriable());
+    if(fs->_peer) {
+        host = fs->_peer->host;
+        port = fs->_peer->http_port;
+        fd = fwdPconnPool->pop(fs->_peer->name, fs->_peer->http_port, request->host, client_addr, checkRetriable());
+    }
+    else {
+        host = request->host;
+        port = request->port;
+        fd = fwdPconnPool->pop(host, port, NULL, client_addr, checkRetriable());
+    }
     if (fd >= 0) {
         debugs(17, 3, "fwdConnectStart: reusing pconn FD " << fd);
         server_fd = fd;
@@ -1137,11 +1138,24 @@
     /* NOTREACHED */
 }
 
+/**
+ * Decide where details need to be gathered to correctly describe a persistent connection.
+ * What is needed:
+ * \item  host name of server at other end of this link (either peer or requested host)
+ * \item  port to which we connected the other end of this link (for peer or request)
+ * \item  domain for which the connection is supposed to be used
+ * \item  address of the client for which we made the connection
+ */
 void
-
-FwdState::pconnPush(int fd, const char *host, int port, const char *domain, struct IN_ADDR *client_addr)
+FwdState::pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, struct in_addr *client_addr)
 {
-    fwdPconnPool->push(fd, host, port, domain, client_addr);
+    if (_peer) {
+        fwdPconnPool->push(fd, _peer->name, _peer->http_port, domain, client_addr);
+    } else {
+        /* small performance improvement, using NULL for domain instead of listing it twice */
+        /* although this will leave a gap open for url-rewritten domains to share a link */
+        fwdPconnPool->push(fd, req->host, req->port, NULL, client_addr);
+    }
 }
 
 void
diff -u -r -N squid-3.0.STABLE13/src/forward.h squid-3.0.STABLE14/src/forward.h
--- squid-3.0.STABLE13/src/forward.h	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/forward.h	2009-04-11 20:35:41.000000000 +1200
@@ -5,6 +5,7 @@
 
 class CacheManager;
 class ErrorState;
+class HttpRequest;
 
 #include "comm.h"
 
@@ -44,7 +45,7 @@
     bool checkRetry();
     bool checkRetriable();
     void dispatch();
-    void pconnPush(int fd, const char *host, int port, const char *domain, struct IN_ADDR *client_addr);
+    void pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, struct in_addr *client_addr);
 
     bool dontRetry() { return flags.dont_retry; }
 
diff -u -r -N squid-3.0.STABLE13/src/fqdncache.cc squid-3.0.STABLE14/src/fqdncache.cc
--- squid-3.0.STABLE13/src/fqdncache.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/fqdncache.cc	2009-04-11 20:35:41.000000000 +1200
@@ -548,9 +548,12 @@
 {
     char *name = inet_ntoa(addr);
     fqdncache_entry *f = NULL;
+    struct in_addr ip;
+
+    if(!name) {
+        return NULL;
+    }
 
-    struct IN_ADDR ip;
-    assert(name);
     FqdncacheStats.requests++;
     f = fqdncache_get(name);
 
diff -u -r -N squid-3.0.STABLE13/src/ftp.cc squid-3.0.STABLE14/src/ftp.cc
--- squid-3.0.STABLE13/src/ftp.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/ftp.cc	2009-04-11 20:35:41.000000000 +1200
@@ -1237,34 +1237,18 @@
 
     assert(fd == data.fd);
 
-#if DELAY_POOLS
-
-    DelayId delayId = entry->mem_obj->mostBytesAllowed();
-
-#endif
-
     if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
         abortTransaction("entry aborted during dataRead");
         return;
     }
 
     if (errflag == COMM_OK && len > 0) {
-#if DELAY_POOLS
-        delayId.bytesIn(len);
-#endif
-
-    }
-
-
-    if (errflag == COMM_OK && len > 0) {
         debugs(9,5,HERE << "appended " << len << " bytes to readBuf");
         data.readBuf->appended(len);
 #if DELAY_POOLS
-
         DelayId delayId = entry->mem_obj->mostBytesAllowed();
         delayId.bytesIn(len);
 #endif
-
         IOStats.Ftp.reads++;
 
         for (j = len - 1, bin = 0; j; bin++)
diff -u -r -N squid-3.0.STABLE13/src/htcp.cc squid-3.0.STABLE14/src/htcp.cc
--- squid-3.0.STABLE13/src/htcp.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/htcp.cc	2009-04-11 20:35:41.000000000 +1200
@@ -902,19 +902,20 @@
         stuff.S.uri = spec->uri;
         stuff.S.version = spec->version;
         stuff.S.req_hdrs = spec->req_hdrs;
-        hdr.putInt(HDR_AGE,
-                   e->timestamp <= squid_curtime ?
-                   squid_curtime - e->timestamp : 0);
+        if(e)
+            hdr.putInt(HDR_AGE, (e->timestamp <= squid_curtime ? (squid_curtime - e->timestamp) : 0) );
+        else
+            hdr.putInt(HDR_AGE, 0);
         hdr.packInto(&p);
         stuff.D.resp_hdrs = xstrdup(mb.buf);
         debugs(31, 3, "htcpTstReply: resp_hdrs = {" << stuff.D.resp_hdrs << "}");
         mb.reset();
         hdr.reset();
 
-        if (e->expires > -1)
+        if (e && e->expires > -1)
             hdr.putTime(HDR_EXPIRES, e->expires);
 
-        if (e->lastmod > -1)
+        if (e && e->lastmod > -1)
             hdr.putTime(HDR_LAST_MODIFIED, e->lastmod);
 
         hdr.packInto(&p);
diff -u -r -N squid-3.0.STABLE13/src/http.cc squid-3.0.STABLE14/src/http.cc
--- squid-3.0.STABLE13/src/http.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/http.cc	2009-04-11 20:35:41.000000000 +1200
@@ -1167,6 +1167,7 @@
 
             comm_remove_close_handler(fd, httpStateFree, this);
             fwd->unregister(fd);
+
 #if LINUX_TPROXY
 
             if (orig_request->flags.tproxy)
@@ -1174,14 +1175,7 @@
 
 #endif
 
-            if (_peer) {
-                if (_peer->options.originserver)
-                    fwd->pconnPush(fd, _peer->name, orig_request->port, orig_request->host, client_addr);
-                else
-                    fwd->pconnPush(fd, _peer->name, _peer->http_port, NULL, client_addr);
-            } else {
-                fwd->pconnPush(fd, request->host, request->port, NULL, client_addr);
-            }
+            fwd->pconnPush(fd, _peer, request, orig_request->host, client_addr);
 
             fd = -1;
 
@@ -1590,11 +1584,12 @@
         break;
 
     case HDR_MAX_FORWARDS:
-        if (orig_request->method == METHOD_TRACE) {
-            const int hops = e->getInt();
+        /* pass only on TRACE or OPTIONS requests */
+        if (orig_request->method == METHOD_TRACE || orig_request->method == METHOD_OPTIONS) {
+            const int64_t hops = e->getInt64();
 
             if (hops > 0)
-                hdr_out->putInt(HDR_MAX_FORWARDS, hops - 1);
+                hdr_out->putInt64(HDR_MAX_FORWARDS, hops - 1);
         }
 
         break;
diff -u -r -N squid-3.0.STABLE13/src/HttpHeader.cc squid-3.0.STABLE14/src/HttpHeader.cc
--- squid-3.0.STABLE13/src/HttpHeader.cc	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/HttpHeader.cc	2009-04-11 20:35:40.000000000 +1200
@@ -84,6 +84,7 @@
         {"Cache-Control", HDR_CACHE_CONTROL, ftPCc},
         {"Connection", HDR_CONNECTION, ftStr},
         {"Content-Base", HDR_CONTENT_BASE, ftStr},
+    {"Content-Disposition", HDR_CONTENT_DISPOSITION, ftStr},  /* for now */
         {"Content-Encoding", HDR_CONTENT_ENCODING, ftStr},
         {"Content-Language", HDR_CONTENT_LANGUAGE, ftStr},
         {"Content-Length", HDR_CONTENT_LENGTH, ftInt64},
diff -u -r -N squid-3.0.STABLE13/src/HttpHeader.h squid-3.0.STABLE14/src/HttpHeader.h
--- squid-3.0.STABLE13/src/HttpHeader.h	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/HttpHeader.h	2009-04-11 20:35:40.000000000 +1200
@@ -58,6 +58,7 @@
     HDR_CACHE_CONTROL,
     HDR_CONNECTION,
     HDR_CONTENT_BASE,
+    HDR_CONTENT_DISPOSITION,
     HDR_CONTENT_ENCODING,
     HDR_CONTENT_LANGUAGE,
     HDR_CONTENT_LENGTH,
diff -u -r -N squid-3.0.STABLE13/src/HttpRequest.cc squid-3.0.STABLE14/src/HttpRequest.cc
--- squid-3.0.STABLE13/src/HttpRequest.cc	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/HttpRequest.cc	2009-04-11 20:35:40.000000000 +1200
@@ -267,7 +267,7 @@
            header.len + 2;
 }
 
-/*
+/**
  * Returns true if HTTP allows us to pass this header on.  Does not
  * check anonymizer (aka header_access) configuration.
  */
diff -u -r -N squid-3.0.STABLE13/src/HttpRequest.h squid-3.0.STABLE14/src/HttpRequest.h
--- squid-3.0.STABLE13/src/HttpRequest.h	2009-02-03 14:36:21.000000000 +1300
+++ squid-3.0.STABLE14/src/HttpRequest.h	2009-04-11 20:35:40.000000000 +1200
@@ -96,7 +96,7 @@
 
     int imslen;
 
-    int max_forwards;
+    int64_t max_forwards;
 
     /* these in_addr's could probably be sockaddr_in's */
 
diff -u -r -N squid-3.0.STABLE13/src/HttpStatusLine.cc squid-3.0.STABLE14/src/HttpStatusLine.cc
--- squid-3.0.STABLE13/src/HttpStatusLine.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/HttpStatusLine.cc	2009-04-11 20:35:40.000000000 +1200
@@ -167,6 +167,10 @@
         p = "Partial Content";
         break;
 
+    case HTTP_MULTI_STATUS:
+        p = "Multi-Status";
+        break;
+
     case HTTP_MULTIPLE_CHOICES:
         p = "Multiple Choices";
         break;
diff -u -r -N squid-3.0.STABLE13/src/ipc.cc squid-3.0.STABLE14/src/ipc.cc
--- squid-3.0.STABLE13/src/ipc.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/ipc.cc	2009-04-11 20:35:41.000000000 +1200
@@ -381,13 +381,9 @@
     for (x = 3; x < SQUID_MAXFD; x++)
         close(x);
 
-    if (opt_no_daemon) {
-        squid_signal(SIGINT, SIG_IGN, SA_RESETHAND);
-        squid_signal(SIGHUP, SIG_IGN, SA_RESETHAND);
-    }
-
 #if HAVE_SETSID
-    setsid();
+    if (opt_no_daemon)
+	setsid();
 #endif
 
     execvp(prog, (char *const *) args);
diff -u -r -N squid-3.0.STABLE13/src/logfile.cc squid-3.0.STABLE14/src/logfile.cc
--- squid-3.0.STABLE13/src/logfile.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/logfile.cc	2009-04-11 20:35:41.000000000 +1200
@@ -102,19 +102,16 @@
 
         if (path[6] != '\0') {
             path += 7;
-            char* delim = strchr(path, '.');
-
-	    if (!delim)
-		delim = strchr(path, '|');
-
-            if (delim != NULL)
-                *delim = '\0';
-
-            lf->syslog_priority = syslog_ntoa(path);
-
-            if (delim != NULL)
-                lf->syslog_priority |= syslog_ntoa(delim+1);
-
+	    char *priority = xstrdup(path);
+	    char *facility = (char *) strchr(priority, '.');
+	    if (!facility)
+		facility = (char *) strchr(priority, '|');
+	    if (facility) {
+		*facility++ = '\0';
+		lf->syslog_priority |= syslog_ntoa(facility);
+	    }
+	    lf->syslog_priority |= syslog_ntoa(priority);
+	    xfree(priority);
             if (0 == (lf->syslog_priority & PRIORITY_MASK))
                 lf->syslog_priority |= LOG_INFO;
         }
diff -u -r -N squid-3.0.STABLE13/src/main.cc squid-3.0.STABLE14/src/main.cc
--- squid-3.0.STABLE13/src/main.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/main.cc	2009-04-11 20:35:41.000000000 +1200
@@ -1218,7 +1218,7 @@
     setUmask(Config.umask);
     if (-1 == opt_send_signal)
         if (checkRunningPid())
-            exit(1);
+            exit(0);
 
 #if TEST_ACCESS
 
@@ -1384,8 +1384,13 @@
             exit(1);
         }
     } else {
-        fprintf(stderr, "%s: ERROR: No running copy\n", appname);
-        exit(1);
+        if (opt_send_signal != SIGTERM) {
+            fprintf(stderr, "%s: ERROR: No running copy\n", appname);
+            exit(1);
+        } else {
+            fprintf(stderr, "%s: No running copy\n", appname);
+            exit(0);
+        }
     }
 
     /* signal successfully sent */
diff -u -r -N squid-3.0.STABLE13/src/pconn.cc squid-3.0.STABLE14/src/pconn.cc
--- squid-3.0.STABLE13/src/pconn.cc	2009-02-03 14:36:23.000000000 +1300
+++ squid-3.0.STABLE14/src/pconn.cc	2009-04-11 20:35:41.000000000 +1200
@@ -1,6 +1,5 @@
-
 /*
- * $Id: pconn.cc,v 1.53.4.1 2008/02/24 12:06:41 amosjeffries Exp $
+ * $Id$
  *
  * DEBUG: section 48    Persistent Connections
  * AUTHOR: Duane Wessels
@@ -178,17 +177,18 @@
 
 PconnPool::key(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address)
 {
-    LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 2 + 10);
+    LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 3 + 10);
 
     if (domain && client_address)
-        snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d-%s/%s", host, (int) port, inet_ntoa(*client_address), domain);
+        snprintf(buf, SQUIDHOSTNAMELEN * 3 + 10, "%s:%d-%s/%s", host, (int) port, inet_ntoa(*client_address), domain);
     else if (domain && (!client_address))
-        snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d/%s", host, (int) port, domain);
+        snprintf(buf, SQUIDHOSTNAMELEN * 3 + 10, "%s:%d/%s", host, (int) port, domain);
     else if ((!domain) && client_address)
-        snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d-%s", host, (int) port, inet_ntoa(*client_address));
+        snprintf(buf, SQUIDHOSTNAMELEN * 3 + 10, "%s:%d-%s", host, (int) port, inet_ntoa(*client_address));
     else
-        snprintf(buf, SQUIDHOSTNAMELEN * 2 + 10, "%s:%d", host, (int) port);
+        snprintf(buf, SQUIDHOSTNAMELEN * 3 + 10, "%s:%d", host, (int) port);
 
+    debugs(48,6,"PconnPool::key(" << host << "," << port << "," << domain << "," << inet_ntoa(*client_address) << "is {" << buf << "}" );
     return buf;
 }
 
@@ -212,6 +212,19 @@
     }
 }
 
+void
+PconnPool::dumpHash(StoreEntry *e)
+{
+    int i;
+    hash_link *walker = NULL;
+    hash_table *hid = table;
+    hash_first(hid);
+
+    for (i = 0, walker = hid->next; walker; walker = hash_next(hid)) {
+        storeAppendPrintf(e, "\t item %5d: %s\n", i++, (char *)(walker->key));
+    }
+}
+
 /* ========== PconnPool PUBLIC FUNCTIONS ============================================ */
 
 PconnPool::PconnPool(const char *aDescr) : table(NULL), descr(aDescr)
@@ -222,15 +235,19 @@
     for (i = 0; i < PCONN_HIST_SZ; i++)
         hist[i] = 0;
 
-    PconnModule::GetInstance()->add
-    (this);
+    PconnModule::GetInstance()->add(this);
+}
+
+PconnPool::~PconnPool()
+{
+    descr = NULL;
+    hashFreeMemory(table);
 }
 
 void
 
 PconnPool::push(int fd, const char *host, u_short port, const char *domain, struct IN_ADDR *client_address)
 {
-
     IdleConnList *list;
     const char *aKey;
     LOCAL_ARRAY(char, desc, FD_DESC_SZ);
@@ -243,6 +260,7 @@
     } else if (shutting_down)
     {
         comm_close(fd);
+        debugs(48, 3, "PconnPool::push: Squid is shutting down. Refusing to do anything");
         return;
     }
 
@@ -253,8 +271,10 @@
     if (list == NULL)
     {
         list = new IdleConnList(aKey, this);
-        debugs(48, 3, "pconnNew: adding " << hashKeyStr(&list->hash));
+        debugs(48, 3, "PconnPool::push: new IdleConnList for {" << hashKeyStr(&list->hash) << "}" );
         hash_join(table, &list->hash);
+    } else {
+        debugs(48, 3, "PconnPool::push: found IdleConnList for {" << hashKeyStr(&list->hash) << "}" );
     }
 
     list->push(fd);
@@ -265,7 +285,7 @@
     debugs(48, 3, "PconnPool::push: pushed FD " << fd << " for " << aKey);
 }
 
-/*
+/**
  * Return a pconn fd for host:port if available and retriable.
  * Otherwise, return -1.
  *
@@ -274,15 +294,17 @@
  * transactions create persistent connections but are not retriable.
  */
 int
-
-PconnPool::pop(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address, bool isRetriable)
+PconnPool::pop(const char *host, u_short port, const char *domain, struct in_addr *client_address, bool isRetriable)
 {
-    IdleConnList *list;
     const char * aKey = key(host, port, domain, client_address);
-    list = (IdleConnList *)hash_lookup(table, aKey);
 
-    if (list == NULL)
+    IdleConnList *list = (IdleConnList *)hash_lookup(table, aKey);
+    if (list == NULL) {
+        debugs(48, 3, "PconnPool::pop: lookup for key {" << aKey << "} failed.");
         return -1;
+    } else { 
+        debugs(48, 3, "PconnPool::pop: found " << hashKeyStr(&list->hash) << (isRetriable?"(to use)":"(to kill)") );
+    }
 
     int fd = list->findUseableFD(); // search from the end. skip pending reads.
 
@@ -361,7 +383,10 @@
     int i;
 
     for (i = 0; i < poolCount; i++) {
+        storeAppendPrintf(e, "\n Pool %d Stats\n", i);
         (*(pools+i))->dumpHist(e);
+        storeAppendPrintf(e, "\n Pool %d Hash Table\n",i);
+        (*(pools+i))->dumpHash(e);
     }
 }
 
diff -u -r -N squid-3.0.STABLE13/src/pconn.h squid-3.0.STABLE14/src/pconn.h
--- squid-3.0.STABLE13/src/pconn.h	2009-02-03 14:36:23.000000000 +1300
+++ squid-3.0.STABLE14/src/pconn.h	2009-04-11 20:35:41.000000000 +1200
@@ -46,12 +46,14 @@
 
 public:
     PconnPool(const char *);
+    ~PconnPool();
 
     void moduleInit();
     void push(int fd, const char *host, u_short port, const char *domain, struct IN_ADDR *client_address);
     int pop(const char *host, u_short port, const char *domain, struct IN_ADDR *client_address, bool retriable);
     void count(int uses);
     void dumpHist(StoreEntry *e);
+    void dumpHash(StoreEntry *e);
     void unlinkList(IdleConnList *list) const;
 
 private:
diff -u -r -N squid-3.0.STABLE13/src/Store.h squid-3.0.STABLE14/src/Store.h
--- squid-3.0.STABLE13/src/Store.h	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/Store.h	2009-04-11 20:35:40.000000000 +1200
@@ -253,12 +253,10 @@
     virtual void diskFull();
     /* Retrieve a store entry from the store */
 
-    virtual StoreEntry * get
-        (const cache_key *) = 0;
+    virtual StoreEntry * get(const cache_key *) = 0;
 
-    /* TODO: imeplement the async version */
-    virtual void get
-        (String const key , STOREGETCLIENT callback, void *cbdata) = 0;
+    /* TODO: implement the async version */
+    virtual void get(String const key , STOREGETCLIENT callback, void *cbdata) = 0;
 
     /* prepare the store for use. The store need not be usable immediately,
      * it should respond to readable() and writable() with true as soon
diff -u -r -N squid-3.0.STABLE13/src/win32.cc squid-3.0.STABLE14/src/win32.cc
--- squid-3.0.STABLE13/src/win32.cc	2009-02-03 14:36:23.000000000 +1300
+++ squid-3.0.STABLE14/src/win32.cc	2009-04-11 20:35:42.000000000 +1200
@@ -110,10 +110,8 @@
 {
 #if HAVE_WIN32_PSAPI
 
-    if ((WIN32_OS_version == _WIN_OS_WINNT) || (WIN32_OS_version == _WIN_OS_WIN2K)
-            || (WIN32_OS_version == _WIN_OS_WINXP) || (WIN32_OS_version == _WIN_OS_WINNET))
-    {
-        /* On Windows NT/2000 call PSAPI.DLL for process Memory */
+    if (WIN32_OS_version >= _WIN_OS_WINNT) {
+        /* On Windows NT and later call PSAPI.DLL for process Memory */
         /* informations -- Guido Serassio                       */
         HANDLE hProcess;
         PROCESS_MEMORY_COUNTERS pmc;
diff -u -r -N squid-3.0.STABLE13/src/WinSvc.cc squid-3.0.STABLE14/src/WinSvc.cc
--- squid-3.0.STABLE13/src/WinSvc.cc	2009-02-03 14:36:22.000000000 +1300
+++ squid-3.0.STABLE14/src/WinSvc.cc	2009-04-11 20:35:40.000000000 +1200
@@ -347,7 +347,21 @@
 		WIN32_OS_string = xstrdup("Windows Server 2008");
 	    return _WIN_OS_WINLON;
 	}
-	break;
+	if ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion == 1)) {
+	    if (osvi.wProductType == VER_NT_WORKSTATION)
+		WIN32_OS_string = xstrdup("Windows 7");
+	    else
+		WIN32_OS_string = xstrdup("Windows Server 2008 R2");
+	    return _WIN_OS_WIN7;
+	}
+	if (((osvi.dwMajorVersion > 6)) || ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion > 1))) {
+	    if (osvi.wProductType == VER_NT_WORKSTATION)
+		WIN32_OS_string = xstrdup("Unknown Windows version, assuming Windows 7 capabilities");
+	    else
+		WIN32_OS_string = xstrdup("Unknown Windows version, assuming Windows Server 2008 R2 capabilities");
+	    return _WIN_OS_WIN7;
+	}
+        break;
     case VER_PLATFORM_WIN32_WINDOWS:
 	if ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion == 0)) {
 	    WIN32_OS_string = xstrdup("Windows 95");
