diff -u -r -N squid-3.0.STABLE12/ChangeLog squid-3.0.STABLE13/ChangeLog
--- squid-3.0.STABLE12/ChangeLog	2009-01-21 14:59:00.000000000 +1300
+++ squid-3.0.STABLE13/ChangeLog	2009-02-03 14:36:11.000000000 +1300
@@ -1,3 +1,10 @@
+Changes to squid-3.0.STABLE13 (03 Feb 2009):
+
+	- Fix several issues in request parsing
+	- Fix memory leak from logformat parsing
+	- Fix various ESI build errors
+	- ... and some documentation updates
+
 Changes to squid-3.0.STABLE12 (21 Jan 2009):
 
 	- Bug 2533: Solaris (sparc) 64-bit build breaks with gcc/g++
diff -u -r -N squid-3.0.STABLE12/configure squid-3.0.STABLE13/configure
--- squid-3.0.STABLE12/configure	2009-01-21 14:59:10.000000000 +1300
+++ squid-3.0.STABLE13/configure	2009-02-03 14:36:23.000000000 +1300
@@ -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.STABLE12.
+# Generated by GNU Autoconf 2.62 for Squid Web Proxy 3.0.STABLE13.
 #
 # 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.STABLE12'
-PACKAGE_STRING='Squid Web Proxy 3.0.STABLE12'
+PACKAGE_VERSION='3.0.STABLE13'
+PACKAGE_STRING='Squid Web Proxy 3.0.STABLE13'
 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.STABLE12 to adapt to many kinds of systems.
+\`configure' configures Squid Web Proxy 3.0.STABLE13 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.STABLE12:";;
+     short | recursive ) echo "Configuration of Squid Web Proxy 3.0.STABLE13:";;
    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.STABLE12
+Squid Web Proxy configure 3.0.STABLE13
 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.STABLE12, which was
+It was created by Squid Web Proxy $as_me 3.0.STABLE13, 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.STABLE12'
+ VERSION='3.0.STABLE13'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -47866,7 +47866,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.STABLE12, which was
+This file was extended by Squid Web Proxy $as_me 3.0.STABLE13, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -47919,7 +47919,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-Squid Web Proxy config.status 3.0.STABLE12
+Squid Web Proxy config.status 3.0.STABLE13
 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.STABLE12/configure.in squid-3.0.STABLE13/configure.in
--- squid-3.0.STABLE12/configure.in	2009-01-21 14:59:10.000000000 +1300
+++ squid-3.0.STABLE13/configure.in	2009-02-03 14:36:23.000000000 +1300
@@ -2,7 +2,7 @@
 dnl  Configuration input file for Squid
 dnl
 dnl
-AC_INIT(Squid Web Proxy, 3.0.STABLE12, http://www.squid-cache.org/bugs/, squid)
+AC_INIT(Squid Web Proxy, 3.0.STABLE13, http://www.squid-cache.org/bugs/, squid)
 AC_PREREQ(2.52)
 AM_CONFIG_HEADER(include/autoconf.h)
 AC_CONFIG_AUX_DIR(cfgaux)
diff -u -r -N squid-3.0.STABLE12/include/heap.h squid-3.0.STABLE13/include/heap.h
--- squid-3.0.STABLE12/include/heap.h	2009-01-21 14:59:07.000000000 +1300
+++ squid-3.0.STABLE13/include/heap.h	2009-02-03 14:36:20.000000000 +1300
@@ -51,7 +51,7 @@
  * the current aging factor for the heap.
  */
 typedef unsigned long heap_mutex_t;
-typedef void *heap_t;
+typedef void * heap_t;
 typedef double heap_key;
 typedef heap_key heap_key_func(heap_t, heap_key);
 
@@ -103,7 +103,7 @@
  * should be done with this data structure (especially modifying it!)  The
  * heap does not assume ownership of the data passed to it.
  */
-SQUIDCEXTERN heap_node *heap_insert(heap *, heap_t dat);
+SQUIDCEXTERN heap_node *heap_insert(heap *hp, heap_t dat);
 
 /*
  * Delete a node out of a heap.  Returns the heap data from the deleted
diff -u -r -N squid-3.0.STABLE12/include/version.h squid-3.0.STABLE13/include/version.h
--- squid-3.0.STABLE12/include/version.h	2009-01-21 14:59:10.000000000 +1300
+++ squid-3.0.STABLE13/include/version.h	2009-02-03 14:36:23.000000000 +1300
@@ -9,5 +9,5 @@
  */
 
 #ifndef SQUID_RELEASE_TIME
-#define SQUID_RELEASE_TIME 1232503139
+#define SQUID_RELEASE_TIME 1233624970
 #endif
diff -u -r -N squid-3.0.STABLE12/lib/heap.c squid-3.0.STABLE13/lib/heap.c
--- squid-3.0.STABLE12/lib/heap.c	2009-01-21 14:59:07.000000000 +1300
+++ squid-3.0.STABLE13/lib/heap.c	2009-02-03 14:36:20.000000000 +1300
@@ -53,7 +53,6 @@
 #include <stdio.h>
 #endif
 
-#include "heap.h"
 #include "util.h"
 
 /*
diff -u -r -N squid-3.0.STABLE12/lib/libTrie/configure squid-3.0.STABLE13/lib/libTrie/configure
--- squid-3.0.STABLE12/lib/libTrie/configure	2009-01-21 14:59:07.000000000 +1300
+++ squid-3.0.STABLE13/lib/libTrie/configure	2009-02-03 14:36:20.000000000 +1300
@@ -731,6 +731,7 @@
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_optimizations
 enable_inline
 enable_dependency_tracking
 enable_maintainer_mode
@@ -1373,14 +1374,21 @@
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-inline        Don't compile trivial methods as inline. Squid
-                             is coded with much of the code able to be inlined.<                             Inlining is good for production builds, but not
-                             good for development. During development, use
-                             --disable-inline to reduce compilation times and
-                             allow incremental builds to be quick. For
-                             production builds, or load tests, use
-                             --enable-inline to have squid make all trivial
-                             methods inlinable by the compiler.
+  --disable-optimizations Don't compile Squid with compiler optimizations
+                          enabled. Optimization is good for production builds,
+                          but not good for debugging. During development, use
+                          --disable-optimizations to reduce compilation times
+                          and allow easier debugging. This option implicitly
+                          also enabled --disable-inline
+  --disable-inline        Don't compile trivial methods as inline. Squid is
+                          coded with much of the code able to be inlined.
+                          Inlining is good for production builds, but not good
+                          for development. During development, use
+                          --disable-inline to reduce compilation times and
+                          allow incremental builds to be quick. For production
+                          builds, or load tests, use --enable-inline to have
+                          squid make all trivial methods inlinable by the
+                          compiler.
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --enable-maintainer-mode  enable make rules and dependencies not useful
@@ -1880,11 +1888,25 @@
 
 
 SquidInline="yes"
+
+# Check whether --enable-optimizations was given.
+if test "${enable_optimizations+set}" = set; then
+  enableval=$enable_optimizations;  if test "$enableval" = "no" ; then
+        { $as_echo "$as_me:$LINENO: Disabling compiler optimizations (-O flag)" >&5
+$as_echo "$as_me: Disabling compiler optimizations (-O flag)" >&6;}
+        CFLAGS="`echo $CFLAGS | sed -e 's/-O[0-9]*//'`"
+        CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[0-9]*//'`"
+        SquidInline="no"
+  fi
+
+fi
+
+
 # Check whether --enable-inline was given.
 if test "${enable_inline+set}" = set; then
   enableval=$enable_inline;  if test "$enableval" = "no" ; then
-       SquidInline="no"
-     fi
+     SquidInline="no"
+   fi
 
 fi
 
@@ -1901,6 +1923,8 @@
 _ACEOF
 
 else
+    { $as_echo "$as_me:$LINENO: Inlining optimization disabled" >&5
+$as_echo "$as_me: Inlining optimization disabled" >&6;}
 
 cat >>confdefs.h <<\_ACEOF
 #define _SQUID_INLINE_ /**/
@@ -1908,6 +1932,7 @@
 
 fi
 
+
 # Checks for programs.
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff -u -r -N squid-3.0.STABLE12/lib/libTrie/configure.in squid-3.0.STABLE13/lib/libTrie/configure.in
--- squid-3.0.STABLE12/lib/libTrie/configure.in	2009-01-21 14:59:07.000000000 +1300
+++ squid-3.0.STABLE13/lib/libTrie/configure.in	2009-02-03 14:36:20.000000000 +1300
@@ -5,27 +5,48 @@
 AC_CONFIG_AUX_DIR(cfgaux)
 
 SquidInline="yes"
+
+AC_ARG_ENABLE(optimizations,
+  AC_HELP_STRING([--disable-optimizations],
+                 [Don't compile Squid with compiler optimizations enabled.
+                  Optimization is good for production builds, but not
+                  good for debugging. During development, use
+                  --disable-optimizations to reduce compilation times
+                  and allow easier debugging. This option implicitly
+                  also enabled --disable-inline]),
+[ if test "$enableval" = "no" ; then
+        AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
+        CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
+        CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
+        SquidInline="no"
+  fi
+])
+
 AC_ARG_ENABLE(inline,
-                          [  --disable-inline        Don't compile trivial methods as inline. Squid
-                             is coded with much of the code able to be inlined.<                             Inlining is good for production builds, but not
-                             good for development. During development, use
-                             --disable-inline to reduce compilation times and
-                             allow incremental builds to be quick. For
-                             production builds, or load tests, use
-                             --enable-inline to have squid make all trivial
-                             methods inlinable by the compiler.],
-   [ if test "$enableval" = "no" ; then
-       SquidInline="no"
-     fi
-  ])
+  AC_HELP_STRING([--disable-inline],
+                 [Don't compile trivial methods as inline. Squid
+                  is coded with much of the code able to be inlined.
+                  Inlining is good for production builds, but not
+                  good for development. During development, use
+                  --disable-inline to reduce compilation times and
+                  allow incremental builds to be quick. For
+                  production builds, or load tests, use
+                  --enable-inline to have squid make all trivial
+                  methods inlinable by the compiler.]),
+[ if test "$enableval" = "no" ; then
+     SquidInline="no"
+   fi
+])
 
 if test "$SquidInline" = "yes" ; then
-  AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
-  AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
+    AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
+    AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
 else
-  AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
+    AC_MSG_NOTICE([Inlining optimization disabled])
+    AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
 fi
 
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
diff -u -r -N squid-3.0.STABLE12/lib/libTrie/include/Trie.h squid-3.0.STABLE13/lib/libTrie/include/Trie.h
--- squid-3.0.STABLE12/lib/libTrie/include/Trie.h	2009-01-21 14:59:07.000000000 +1300
+++ squid-3.0.STABLE13/lib/libTrie/include/Trie.h	2009-02-03 14:36:20.000000000 +1300
@@ -82,8 +82,7 @@
     * present or cannot be added.
     */
 
-    bool add
-        (char const *, size_t, void *);
+    bool add(char const *, size_t, void *);
 
 private:
     TrieNode *head;
diff -u -r -N squid-3.0.STABLE12/lib/libTrie/src/Trie.cc squid-3.0.STABLE13/lib/libTrie/src/Trie.cc
--- squid-3.0.STABLE12/lib/libTrie/src/Trie.cc	2009-01-21 14:59:07.000000000 +1300
+++ squid-3.0.STABLE13/lib/libTrie/src/Trie.cc	2009-02-03 14:36:21.000000000 +1300
@@ -24,6 +24,10 @@
 #include "TrieNode.h"
 #include "TrieCharTransform.h"
 
+#ifndef _USE_INLINE_
+#include "Trie.cci"
+#endif
+
 Trie::Trie (TrieCharTransform *aTransform) : head (0) , transform (aTransform)
 {}
 
@@ -76,7 +80,3 @@
     return ((Trie *)aTrie)->add
            (aString, theLength, privatedata);
 }
-
-#ifndef _USE_INLINE_
-#include "Trie.cci"
-#endif
diff -u -r -N squid-3.0.STABLE12/RELEASENOTES.html squid-3.0.STABLE13/RELEASENOTES.html
--- squid-3.0.STABLE12/RELEASENOTES.html	2009-01-21 15:00:19.000000000 +1300
+++ squid-3.0.STABLE13/RELEASENOTES.html	2009-02-03 14:37:18.000000000 +1300
@@ -1,11 +1,11 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <HTML>
 <HEAD>
- <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
- <TITLE>Squid 3.0.STABLE12 release notes</TITLE>
+ <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.50">
+ <TITLE>Squid 3.0.STABLE13 release notes</TITLE>
 </HEAD>
 <BODY>
-<H1>Squid 3.0.STABLE12 release notes</H1>
+<H1>Squid 3.0.STABLE13 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.STABLE12.</P>
+<P>The Squid Team are pleased to announce the release of Squid-3.0.STABLE13.</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>
diff -u -r -N squid-3.0.STABLE12/src/cache_cf.cc squid-3.0.STABLE13/src/cache_cf.cc
--- squid-3.0.STABLE12/src/cache_cf.cc	2009-01-21 14:59:09.000000000 +1300
+++ squid-3.0.STABLE13/src/cache_cf.cc	2009-02-03 14:36:22.000000000 +1300
@@ -3362,6 +3362,7 @@
     while (*definitions) {
         logformat *format = *definitions;
         *definitions = format->next;
+        safe_free(format->name);
         accessLogFreeLogFormat(&format->format);
         xfree(format);
     }
diff -u -r -N squid-3.0.STABLE12/src/cf.data.pre squid-3.0.STABLE13/src/cf.data.pre
--- squid-3.0.STABLE12/src/cf.data.pre	2009-01-21 14:59:09.000000000 +1300
+++ squid-3.0.STABLE13/src/cf.data.pre	2009-02-03 14:36:22.000000000 +1300
@@ -3215,7 +3215,7 @@
 	By default, Squid will immediately close client connections when
 	read(2) returns "no more data to read."
 
-	Change this option to 'off' and Squid will keep open connections
+	Change this option to 'on' and Squid will keep open connections
 	until a read(2) or write(2) on the socket returns an error.
 	This may show some benefits for reverse proxies. But if not
 	it is recommended to leave OFF.
diff -u -r -N squid-3.0.STABLE12/src/HttpMsg.cc squid-3.0.STABLE13/src/HttpMsg.cc
--- squid-3.0.STABLE12/src/HttpMsg.cc	2009-01-21 14:59:08.000000000 +1300
+++ squid-3.0.STABLE13/src/HttpMsg.cc	2009-02-03 14:36:21.000000000 +1300
@@ -463,7 +463,7 @@
 {
 	int i = 0;
 	int retcode = 0;
-	int maj = -1, min = -1;
+	unsigned int maj = 0, min = 0;
 	int last_whitespace = -1, line_end = -1;
 
         debugs(74, 5, "httpParserParseReqLine: parsing " << hmsg->buf);
@@ -568,10 +568,14 @@
 
 			/* next should be 1 or more digits */
 			maj = 0;
-			for (; i < hmsg->req_end && (isdigit(hmsg->buf[i])); i++) {
+			for (; i < hmsg->req_end && (isdigit(hmsg->buf[i])) && maj < 65536; i++) {
 				maj = maj * 10;
 				maj = maj + (hmsg->buf[i]) - '0';
 			}
+                        if (maj >= 65536) {
+                            retcode = -1;
+                            goto finish;
+                        }
 			if (i >= hmsg->req_end) {
 				retcode = 0;
 				goto finish;
@@ -590,10 +594,14 @@
 			/* next should be one or more digits */
 			i++;
 			min = 0;
-			for (; i < hmsg->req_end && (isdigit(hmsg->buf[i])); i++) {
+			for (; i < hmsg->req_end && (isdigit(hmsg->buf[i])) && min < 65536; i++) {
 				min = min * 10;
 				min = min + (hmsg->buf[i]) - '0';
 			}
+                        if (min >= 65536) {
+                            retcode = -1;
+                            goto finish;
+                        }
 
 			/* Find whitespace, end of version */
 			hmsg->v_end = i;
@@ -605,8 +613,6 @@
 	 * Rightio - we have all the schtuff. Return true; we've got enough.
 	 */
 	retcode = 1;
-	assert(maj != -1);
-	assert(min != -1);
 
 finish:
 	hmsg->v_maj = maj;
diff -u -r -N squid-3.0.STABLE12/src/Makefile.am squid-3.0.STABLE13/src/Makefile.am
--- squid-3.0.STABLE12/src/Makefile.am	2009-01-21 14:59:08.000000000 +1300
+++ squid-3.0.STABLE13/src/Makefile.am	2009-02-03 14:36:22.000000000 +1300
@@ -887,7 +887,6 @@
 ufsdump_LDADD = \
 	libsquid.la \
 	libauth.la \
-	-L../lib \
 	@XTRA_OBJS@ \
 	@REPL_OBJS@ \
 	@STORE_OBJS@ \
@@ -897,7 +896,7 @@
 	@SNMPLIB@ \
 	@ICAP_LIBS@ \
 	@SSLLIB@ \
-	-lmiscutil \
+	-L$(top_builddir)/lib -lmiscutil \
 	@XTRA_LIBS@ \
 	@EPOLL_LIBS@ \
 	@MINGW_LIBS@ 
diff -u -r -N squid-3.0.STABLE12/src/Makefile.in squid-3.0.STABLE13/src/Makefile.in
--- squid-3.0.STABLE12/src/Makefile.in	2009-01-21 14:59:08.000000000 +1300
+++ squid-3.0.STABLE13/src/Makefile.in	2009-02-03 14:36:22.000000000 +1300
@@ -2530,7 +2530,6 @@
 ufsdump_LDADD = \
 	libsquid.la \
 	libauth.la \
-	-L../lib \
 	@XTRA_OBJS@ \
 	@REPL_OBJS@ \
 	@STORE_OBJS@ \
@@ -2540,7 +2539,7 @@
 	@SNMPLIB@ \
 	@ICAP_LIBS@ \
 	@SSLLIB@ \
-	-lmiscutil \
+	-L$(top_builddir)/lib -lmiscutil \
 	@XTRA_LIBS@ \
 	@EPOLL_LIBS@ \
 	@MINGW_LIBS@ 
