diff -ruN squid-2.6.STABLE4/ChangeLog squid-2.6.STABLE5/ChangeLog
--- squid-2.6.STABLE4/ChangeLog	Fri Sep 22 05:10:14 2006
+++ squid-2.6.STABLE5/ChangeLog	Fri Nov  3 06:16:21 2006
@@ -1,4 +1,34 @@
-Changes to squid-2.6.STABLE4 (Sep 22 2006)
+Changes to squid-2.6.STABLE5 (Now 3 2006)
+
+	- Bug #1776: 2.6.STABLE4 aufs fails to compile if coss isn't enabled
+	- COSS improvements and cleanups
+	- SNMP linking issue resolved, enabling SNMP support to be build in all platforms
+	- Bug #1784: access_log syslog results in blanks syslog lines between every entry
+	- Bug #1719: Incorrect error message on invalid cache_peer specifications
+	- Bug #1785: Memory leak in handling of negatively cached objects
+	- Bug #1780: Incorrect Vary processing in combination with collapsed_forwarding
+	- Bug #1782: Memory leak in ncsa_auth on password changes
+	- Suppress some annoying coss startup messages raising the debug level to 2.
+	- Clarify the external_acl_helper concurrency= change.
+	- aioDone() could be called twice from aufs and from coss (when using AIOPS) during shutdown.
+	- Bug #1794: Accept 00:00-24:00 as a valid time specification even if redundand and the same as 00:00-23:59
+	- Bug #1795: Theoretical memory leak in storeSetPublicKey
+	- Removing port 563 from the default SSL_ports and Safe_ports ACLs
+	- Bug #1724: Automatically enable Linux Netfilter support with --enable-linux-tproxy.
+	- Bug #1800: squid -k reconfigure crash when using req/rep_header acls
+	- Clarify the select/poll/kqueue/epoll configure --enable/disable options
+	- Bug #1779: Delay pools fairness when multiple connections compete for bandwidth
+	- Bug #1802: Crash on exit in certain conditions where cache.log is not writeable
+	- Bug #1796: Assertion error HttpHeader.c:914: "str"
+	- Bug #1790: Crash on wccp2 + mask assignement + standard wccp service
+	- Silence harmless gcc compile warning.
+	- Clean up poll memory on shutdown
+	- Ported select, poll and win32 to new comm event framework
+	- Windows port: Correctly identify Windows Vista and Windows Server Longhorn
+	- Added a basic comm_select_simple comm loop only requiring minimal POSIX compliance.
+	- Safeguard from kb_t counter overflows on 32-bit platforms
+
+Changes to squid-2.6.STABLE4 (Sep 23 2006)
 
 	- Bug #1736: Missing Italian translation of ERR_TOO_BIG error page
 	- Windows port enhancement: added native exception handler with signal emulation
diff -ruN squid-2.6.STABLE4/Makefile.in squid-2.6.STABLE5/Makefile.in
--- squid-2.6.STABLE4/Makefile.in	Fri Sep 22 03:09:34 2006
+++ squid-2.6.STABLE5/Makefile.in	Sun Oct 29 19:21:09 2006
@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 #
-# $Id: Makefile.in,v 1.48 2006/09/22 09:09:34 hno Exp $
+# $Id: Makefile.in,v 1.50 2006/10/30 02:21:09 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -120,7 +120,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -204,6 +203,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/RELEASENOTES.html squid-2.6.STABLE5/RELEASENOTES.html
--- squid-2.6.STABLE4/RELEASENOTES.html	Sat Sep 23 11:50:05 2006
+++ squid-2.6.STABLE5/RELEASENOTES.html	Fri Nov  3 06:20:46 2006
@@ -7,7 +7,7 @@
 <BODY>
 <H1>Squid 2.6 release notes</H1>
 
-<H2>Squid Developers</H2>$Id: release-2.6.html,v 1.35 2006/09/22 11:10:14 hno Exp $
+<H2>Squid Developers</H2>$Id: release-2.6.html,v 1.36 2006/11/03 13:16:22 hno Exp $
 <HR>
 <EM>This document contains the release notes for version 2.6 of Squid.
 Squid is a WWW Cache application developed by the Web Caching community.</EM>
@@ -39,6 +39,9 @@
 <P>
 <H2><A NAME="toc9">9.</A> <A HREF="#s9">Key changes squid-2.6.STABLE3 to 2.6.STABLE4</A></H2>
 
+<P>
+<H2><A NAME="toc10">10.</A> <A HREF="#s10">Key changes squid-2.6.STABLE4 to 2.6.STABLE5</A></H2>
+
 
 <HR>
 <H2><A NAME="s1">1.</A> <A HREF="#toc1">Key changes from squid 2.5</A></H2>
@@ -165,10 +168,7 @@
 <P>There is a few known issues in this version of Squid which we hope to correct in a later release</P>
 <P>
 <UL>
-<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1590">#1590</a>: "ETag Loop" warnings in cache.log</LI>
-<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=761">#761</a>: assertion failed: cbdata.c:249: "c-&gt;locks &gt; 0" when using diskd</LI>
-<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1640">#1640</a>: unstable if mixing coss cache_dir type with other cache_dir types (ufs/aufs/diskd).</LI>
-<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1602">#1602</a>: Need to implement TCP fallback on truncated (large) DNS responses</LI>
+<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=761">#761</a>: Unstable under load when using diskd</LI>
 </UL>
 </P>
 
@@ -475,6 +475,23 @@
 <LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1699">#1699</a>: assertion failed: authenticate.c:836: "auth_user_request != NULL"</LI>
 <LI>a number of other minor and cosmetic bugfixes. See the list of 
 <A HREF="http://www.squid-cache.org/Versions/v2/2.6/changesets/SQUID_2_6_STABLE4.html">squid-2.6.STABLE4 changes</A> and the 
+<A HREF="ChangeLog">ChangeLog</A> file for details.</LI>
+</UL>
+</P>
+
+<H2><A NAME="s10">10.</A> <A HREF="#toc10">Key changes squid-2.6.STABLE4 to 2.6.STABLE5</A></H2>
+
+<P>
+<UL>
+<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1776">#1776</a>: 2.6.STABLE4 aufs fails to compile if coss isn't enabled</LI>
+<LI>COSS improvements and cleanups</LI>
+<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1785">#1785</a>: Memory leak in handling of negatively cached objects</LI>
+<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1780">#1780</a>: Incorrect Vary processing in combination with collapsed_forwarding</LI>
+<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1779">#1779</a>: Delay pools fairness when multiple connections compete for bandwidth</LI>
+<LI>Bug <a href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1796">#1796</a>: Assertion error HttpHeader.c:914: "str"</LI>
+<LI>All comm loops now use the generic event framework</LI>
+<LI>a number of other minor and cosmetic bugfixes. See the list of 
+<A HREF="http://www.squid-cache.org/Versions/v2/2.6/changesets/SQUID_2_6_STABLE5.html">squid-2.6.STABLE4 changes</A> and the 
 <A HREF="ChangeLog">ChangeLog</A> file for details.</LI>
 </UL>
 </P>
diff -ruN squid-2.6.STABLE4/configure squid-2.6.STABLE5/configure
--- squid-2.6.STABLE4/configure	Sat Sep 23 11:49:33 2006
+++ squid-2.6.STABLE5/configure	Fri Nov  3 06:20:14 2006
@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.in Revision: 1.402 .
+# From configure.in Revision: 1.410 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE4.
+# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE5.
 #
 # Report bugs to <http://www.squid-cache.org/bugs/>.
 #
@@ -270,8 +270,8 @@
 # Identity of this package.
 PACKAGE_NAME='Squid Web Proxy'
 PACKAGE_TARNAME='squid'
-PACKAGE_VERSION='2.6.STABLE4'
-PACKAGE_STRING='Squid Web Proxy 2.6.STABLE4'
+PACKAGE_VERSION='2.6.STABLE5'
+PACKAGE_STRING='Squid Web Proxy 2.6.STABLE5'
 PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/'
 
 ac_default_prefix=/usr/local/squid
@@ -312,7 +312,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os PKGCONFIG CGIEXT ENABLE_WIN32SPECIFIC_TRUE ENABLE_WIN32SPECIFIC_FALSE ENABLE_MINGW32SPECIFIC_TRUE ENABLE_MINGW32SPECIFIC_FALSE WIN32_PSAPI CACHE_HTTP_PORT CACHE_ICP_PORT LIBDLMALLOC LIB_MALLOC STORE_OBJS STORE_LIBS STORE_MODULES NEED_DISKD_TRUE NEED_DISKD_FALSE USE_AIOPS_WIN32_TRUE USE_AIOPS_WIN32_FALSE NEED_COSSDUMP_TRUE NEED_COSSDUMP_FALSE REPL_POLICIES REPL_OBJS REPL_LIBS ENABLE_PINGER_TRUE ENABLE_PINGER_FALSE USE_DELAY_POOLS_TRUE USE_DELAY_POOLS_FALSE USE_SNMP_TRUE USE_SNMP_FALSE SNMPLIB makesnmplib ENABLE_HTCP_TRUE ENABLE_HTCP_FALSE ENABLE_SSL_TRUE ENABLE_SSL_FALSE NEED_OWN_MD5_TRUE NEED_OWN_MD5_FALSE SSLLIB ERR_DEFAULT_LANGUAGE ERR_LANGUAGES MAKE_LEAKFINDER_TRUE MAKE_LEAKFINDER_FALSE USE_DNSSERVER_TRUE USE_DNSSERVER_FALSE OPT_DEFAULT_HOSTS AUTH_MODULES AUTH_OBJS AUTH_LIBS BASIC_AUTH_HELPERS NTLM_AUTH_HELPERS DIGEST_AUTH_HELPERS NEGOTIATE_AUTH_HELPERS EXTERNAL_ACL_HELPERS CPP EGREP LIBSASL ENABLE_UNLINKD_TRUE ENABLE_UNLINKD_FALSE RANLIB ac_ct_RANLIB LN_S SH FALSE TRUE RM MV MKDIR LN PERL AR AR_R ALLOCA CRYPTLIB LIB_EPOLL LIB_LDAP LIB_LBER LIB_DB EPOLL_LIBS USE_POLL_TRUE USE_POLL_FALSE USE_EPOLL_TRUE USE_EPOLL_FALSE USE_SELECT_TRUE USE_SELECT_FALSE USE_SELECT_WIN32_TRUE USE_SELECT_WIN32_FALSE USE_KQUEUE_TRUE USE_KQUEUE_FALSE NEED_OWN_SNPRINTF_TRUE NEED_OWN_SNPRINTF_FALSE NEED_OWN_STRSEP_TRUE NEED_OWN_STRSEP_FALSE REGEXLIB LIBREGEX LIBOBJS XTRA_OBJS XTRA_LIBS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os PKGCONFIG CGIEXT ENABLE_WIN32SPECIFIC_TRUE ENABLE_WIN32SPECIFIC_FALSE ENABLE_MINGW32SPECIFIC_TRUE ENABLE_MINGW32SPECIFIC_FALSE WIN32_PSAPI CACHE_HTTP_PORT CACHE_ICP_PORT LIBDLMALLOC LIB_MALLOC STORE_OBJS STORE_LIBS STORE_MODULES NEED_DISKD_TRUE NEED_DISKD_FALSE USE_AIOPS_WIN32_TRUE USE_AIOPS_WIN32_FALSE NEED_COSSDUMP_TRUE NEED_COSSDUMP_FALSE REPL_POLICIES REPL_OBJS REPL_LIBS ENABLE_PINGER_TRUE ENABLE_PINGER_FALSE USE_DELAY_POOLS_TRUE USE_DELAY_POOLS_FALSE USE_SNMP_TRUE USE_SNMP_FALSE SNMPLIB makesnmplib ENABLE_HTCP_TRUE ENABLE_HTCP_FALSE ENABLE_SSL_TRUE ENABLE_SSL_FALSE NEED_OWN_MD5_TRUE NEED_OWN_MD5_FALSE SSLLIB ERR_DEFAULT_LANGUAGE ERR_LANGUAGES MAKE_LEAKFINDER_TRUE MAKE_LEAKFINDER_FALSE USE_DNSSERVER_TRUE USE_DNSSERVER_FALSE OPT_DEFAULT_HOSTS AUTH_MODULES AUTH_OBJS AUTH_LIBS BASIC_AUTH_HELPERS NTLM_AUTH_HELPERS DIGEST_AUTH_HELPERS NEGOTIATE_AUTH_HELPERS EXTERNAL_ACL_HELPERS CPP EGREP LIBSASL ENABLE_UNLINKD_TRUE ENABLE_UNLINKD_FALSE RANLIB ac_ct_RANLIB LN_S SH FALSE TRUE RM MV MKDIR LN PERL AR AR_R ALLOCA CRYPTLIB LIB_EPOLL LIB_LDAP LIB_LBER LIB_DB USE_POLL_TRUE USE_POLL_FALSE USE_EPOLL_TRUE USE_EPOLL_FALSE USE_SELECT_TRUE USE_SELECT_FALSE USE_SELECT_SIMPLE_TRUE USE_SELECT_SIMPLE_FALSE USE_SELECT_WIN32_TRUE USE_SELECT_WIN32_FALSE USE_KQUEUE_TRUE USE_KQUEUE_FALSE NEED_OWN_SNPRINTF_TRUE NEED_OWN_SNPRINTF_FALSE NEED_OWN_STRSEP_TRUE NEED_OWN_STRSEP_FALSE REGEXLIB LIBREGEX LIBOBJS XTRA_OBJS XTRA_LIBS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -781,7 +781,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.STABLE4 to adapt to many kinds of systems.
+\`configure' configures Squid Web Proxy 2.6.STABLE5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -847,7 +847,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE4:";;
+     short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE5:";;
    esac
   cat <<\_ACEOF
 
@@ -914,19 +914,22 @@
 			  Select languages to be installed. (All will be
 			  installed by default)
   --enable-coss-aio-ops   Enable COSS I/O with Posix AIO (default is aufs I/O)
-  --enable-select         Enable select() support.
-  --disable-select        Disable select() support.
-  --enable-poll           Enable poll() instead of select().  Normally poll
-			  is preferred over select, but configure knows poll
-			  is broken on some platforms.  If you think you are
-			  smarter than the configure script, you may enable
-			  poll with this option.
-  --disable-poll          Disable the use of poll().
-  --enable-epoll          Enable epoll() instead of poll() or select().
-			  epoll() is best where available, but must be
-			  explicitly set at the moment.
-  --disable-epoll         Disable the use of epoll().
-  --enable-kqueue         Enable kqueue support.
+  --enable-select         Force the use of select support.
+			  Normally configure automatically selects a better
+			  alternative if available.
+  --disable-select        Disable select support, causing configure to fail
+			  if a better alternative is not available
+  --enable-select-simple  Force the use of select support (POSIX).
+			  Useful if your system only supports the bare minium
+			  POSIX select requirements without fds_bits.
+  --enable-poll           Force the use of poll even if automatic checks
+			  indicate poll may be broken on your plaform.
+  --disable-poll          Disable the use of poll.
+  --enable-epoll          Force the use of epoll even if automatic checks
+			  indicate epoll may not be supported.
+  --disable-epoll         Disable the use of epoll.
+  --enable-kqueue         Force the use of kqueue even if automatic checks
+			  indicate kqueue may not be supported.
   --disable-kqueue        Disable kqueue support.
   --disable-http-violations
 			  This allows you to remove code which is known to
@@ -1155,7 +1158,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-Squid Web Proxy configure 2.6.STABLE4
+Squid Web Proxy configure 2.6.STABLE5
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1169,7 +1172,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.STABLE4, which was
+It was created by Squid Web Proxy $as_me 2.6.STABLE5, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1815,7 +1818,7 @@
 
 # Define the identity of the package.
  PACKAGE='squid'
- VERSION='2.6.STABLE4'
+ VERSION='2.6.STABLE5'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4078,7 +4081,7 @@
 #define SQUID_SNMP 1
 _ACEOF
 
-    SNMPLIB='-L../snmplib -lsnmp'
+    SNMPLIB='../snmplib/libsnmp.a'
 
 
 if true; then
@@ -4421,6 +4424,24 @@
 
 fi;
 
+# Check whether --enable-select-simple or --disable-select-simple was given.
+if test "${enable_select_simple+set}" = set; then
+  enableval="$enable_select_simple"
+
+  case "$enableval" in
+  yes)
+    echo "Forcing select() to be enabled in simple POSIX mode"
+    SELECT_TYPE="select_simple"
+    ac_cv_func_select='yes'
+    ;;
+  no)
+    echo "Forcing select() to be disabled"
+    ac_cv_func_select='no'
+    ;;
+  esac
+
+fi;
+
 # Check whether --enable-poll or --disable-poll was given.
 if test "${enable_poll+set}" = set; then
   enableval="$enable_poll"
@@ -4647,6 +4668,10 @@
 _ACEOF
 
 	LINUX_TPROXY="yes"
+        if test -z "$LINUX_NETFILTER"; then
+	    echo "Linux-Netfilter Transparent Proxy automatically enabled"
+	    LINUX_NETFILTER="yes"
+	fi
   fi
 
 fi;
@@ -16254,116 +16279,6 @@
 	SELECT_TYPE="select"
 fi
 
-case "$SELECT_TYPE" in
-epoll)
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_EPOLL 1
-_ACEOF
-
-	echo "$as_me:$LINENO: checking for epoll_create in -lepoll" >&5
-echo $ECHO_N "checking for epoll_create in -lepoll... $ECHO_C" >&6
-if test "${ac_cv_lib_epoll_epoll_create+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lepoll  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char epoll_create ();
-int
-main ()
-{
-epoll_create ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_epoll_epoll_create=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_epoll_epoll_create=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_epoll_epoll_create" >&5
-echo "${ECHO_T}$ac_cv_lib_epoll_epoll_create" >&6
-if test $ac_cv_lib_epoll_epoll_create = yes; then
-  EPOLL_LIBS="-lepoll"
-fi
-
-
-	;;
-poll)
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_POLL 1
-_ACEOF
-
-	;;
-select)
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_SELECT 1
-_ACEOF
-
-	;;
-select_win32)
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_SELECT_WIN32 1
-_ACEOF
-
-	;;
-kqueue)
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_KQUEUE 1
-_ACEOF
-
-	;;
-*)
-	echo "ERROR: Unknown IO loop type '$SELECT_TYPE'"
-	exit 1
-esac
-
 echo "Using ${SELECT_TYPE} for the IO loop."
 
 
@@ -16397,6 +16312,16 @@
 
 
 
+if test $SELECT_TYPE = select_simple; then
+  USE_SELECT_SIMPLE_TRUE=
+  USE_SELECT_SIMPLE_FALSE='#'
+else
+  USE_SELECT_SIMPLE_TRUE='#'
+  USE_SELECT_SIMPLE_FALSE=
+fi
+
+
+
 if test $SELECT_TYPE = select_win32; then
   USE_SELECT_WIN32_TRUE=
   USE_SELECT_WIN32_FALSE='#'
@@ -16766,7 +16691,7 @@
     echo "$as_me:$LINENO: checking if TPROXY header files are installed" >&5
 echo $ECHO_N "checking if TPROXY header files are installed... $ECHO_C" >&6
     # hold on to your hats...
-    if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes"; then
+    if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
 	LINUX_TPROXY="yes"
 
 cat >>confdefs.h <<\_ACEOF
@@ -16784,7 +16709,7 @@
     echo "$as_me:$LINENO: result: $LINUX_TPROXY" >&5
 echo "${ECHO_T}$LINUX_TPROXY" >&6
 fi
-if test "$LINUX_TPROXY" = "no" ; then
+if test "$LINUX_TPROXY" = "no" && test "$LINUX_NETFILTER" = "yes"; then
     echo "WARNING: Cannot find TPROXY headers, you need to install the"
     echo "tproxy package from:"
     echo " - lynx http://www.balabit.com/downloads/tproxy/"
@@ -18141,6 +18066,13 @@
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${USE_SELECT_SIMPLE_TRUE}" && test -z "${USE_SELECT_SIMPLE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"USE_SELECT_SIMPLE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"USE_SELECT_SIMPLE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${USE_SELECT_WIN32_TRUE}" && test -z "${USE_SELECT_WIN32_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"USE_SELECT_WIN32\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -18454,7 +18386,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by Squid Web Proxy $as_me 2.6.STABLE4, which was
+This file was extended by Squid Web Proxy $as_me 2.6.STABLE5, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18517,7 +18449,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-Squid Web Proxy config.status 2.6.STABLE4
+Squid Web Proxy config.status 2.6.STABLE5
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -18884,13 +18816,14 @@
 s,@LIB_LDAP@,$LIB_LDAP,;t t
 s,@LIB_LBER@,$LIB_LBER,;t t
 s,@LIB_DB@,$LIB_DB,;t t
-s,@EPOLL_LIBS@,$EPOLL_LIBS,;t t
 s,@USE_POLL_TRUE@,$USE_POLL_TRUE,;t t
 s,@USE_POLL_FALSE@,$USE_POLL_FALSE,;t t
 s,@USE_EPOLL_TRUE@,$USE_EPOLL_TRUE,;t t
 s,@USE_EPOLL_FALSE@,$USE_EPOLL_FALSE,;t t
 s,@USE_SELECT_TRUE@,$USE_SELECT_TRUE,;t t
 s,@USE_SELECT_FALSE@,$USE_SELECT_FALSE,;t t
+s,@USE_SELECT_SIMPLE_TRUE@,$USE_SELECT_SIMPLE_TRUE,;t t
+s,@USE_SELECT_SIMPLE_FALSE@,$USE_SELECT_SIMPLE_FALSE,;t t
 s,@USE_SELECT_WIN32_TRUE@,$USE_SELECT_WIN32_TRUE,;t t
 s,@USE_SELECT_WIN32_FALSE@,$USE_SELECT_WIN32_FALSE,;t t
 s,@USE_KQUEUE_TRUE@,$USE_KQUEUE_TRUE,;t t
diff -ruN squid-2.6.STABLE4/configure.in squid-2.6.STABLE5/configure.in
--- squid-2.6.STABLE4/configure.in	Sat Sep 23 11:49:33 2006
+++ squid-2.6.STABLE5/configure.in	Fri Nov  3 06:20:14 2006
@@ -1,16 +1,16 @@
 dnl
 dnl  Configuration input file for Squid
 dnl
-dnl  $Id: configure.in,v 1.402 2006/09/22 11:10:14 hno Exp $
+dnl  $Id: configure.in,v 1.410 2006/11/03 13:16:21 hno Exp $
 dnl
 dnl
 dnl
-AC_INIT(Squid Web Proxy, 2.6.STABLE4, http://www.squid-cache.org/bugs/, squid)
+AC_INIT(Squid Web Proxy, 2.6.STABLE5, 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.402 $)dnl
+AC_REVISION($Revision: 1.410 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -615,7 +615,7 @@
 [ if test "$enableval" = "yes" ; then
     echo "SNMP monitoring enabled"
     AC_DEFINE(SQUID_SNMP, 1, [Define to enable SNMP monitoring of Squid])
-    SNMPLIB='-L../snmplib -lsnmp'
+    SNMPLIB='../snmplib/libsnmp.a'
     AM_CONDITIONAL(USE_SNMP, true)
     SNMP_MAKEFILE=./snmplib/Makefile
     makesnmplib=snmplib
@@ -828,8 +828,11 @@
 
 dnl Enable select()
 AC_ARG_ENABLE(select,
-[  --enable-select         Enable select() support.
-  --disable-select        Disable select() support. ],
+[  --enable-select         Force the use of select support.
+			  Normally configure automatically selects a better
+			  alternative if available.
+  --disable-select        Disable select support, causing configure to fail
+			  if a better alternative is not available],
 
 [
   case "$enableval" in
@@ -845,14 +848,30 @@
   esac
 ])
 
+dnl Enable select()
+AC_ARG_ENABLE(select-simple,
+[  --enable-select-simple  Force the use of select support (POSIX).
+			  Useful if your system only supports the bare minium
+			  POSIX select requirements without fds_bits.],
+[
+  case "$enableval" in
+  yes)
+    echo "Forcing select() to be enabled in simple POSIX mode"
+    SELECT_TYPE="select_simple"
+    ac_cv_func_select='yes'
+    ;;
+  no)
+    echo "Forcing select() to be disabled"
+    ac_cv_func_select='no'
+    ;;
+  esac
+])
+
 dnl Enable poll()
 AC_ARG_ENABLE(poll,
-[  --enable-poll           Enable poll() instead of select().  Normally poll
-			  is preferred over select, but configure knows poll
-			  is broken on some platforms.  If you think you are
-			  smarter than the configure script, you may enable
-			  poll with this option.
-  --disable-poll          Disable the use of poll().],
+[  --enable-poll           Force the use of poll even if automatic checks
+			  indicate poll may be broken on your plaform.
+  --disable-poll          Disable the use of poll.],
 [ 
   case "$enableval" in
   yes)
@@ -869,10 +888,9 @@
 
 dnl Enable epoll()
 AC_ARG_ENABLE(epoll,
-[  --enable-epoll          Enable epoll() instead of poll() or select().  
-			  epoll() is best where available, but must be 
-			  explicitly set at the moment.
-  --disable-epoll         Disable the use of epoll().],
+[  --enable-epoll          Force the use of epoll even if automatic checks
+			  indicate epoll may not be supported.
+  --disable-epoll         Disable the use of epoll.],
 [ 
   case "$enableval" in
   yes)
@@ -889,7 +907,8 @@
 
 dnl Enable kqueue
 AC_ARG_ENABLE(kqueue,
-[  --enable-kqueue         Enable kqueue support.
+[  --enable-kqueue         Force the use of kqueue even if automatic checks
+			  indicate kqueue may not be supported.
   --disable-kqueue        Disable kqueue support. ],
 
 [
@@ -1081,6 +1100,10 @@
 	echo "Linux Netfilter/TPROXY enabled"
 	AC_DEFINE(LINUX_TPROXY, 1, [Enable real Transparent Proxy support for Netfilter TPROXY.])
 	LINUX_TPROXY="yes"
+        if test -z "$LINUX_NETFILTER"; then
+	    echo "Linux-Netfilter Transparent Proxy automatically enabled"
+	    LINUX_NETFILTER="yes"
+	fi
   fi
 ])
 
@@ -2392,33 +2415,11 @@
 	SELECT_TYPE="select"
 fi
 
-case "$SELECT_TYPE" in
-epoll)
-	AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
-	AC_CHECK_LIB(epoll, epoll_create, [EPOLL_LIBS="-lepoll"])
-	AC_SUBST(EPOLL_LIBS)
-	;;
-poll)
-	AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
-	;;
-select)
-	AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
-	;;
-select_win32)
-	AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
-	;;
-kqueue)
-	AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
-	;;
-*)
-	echo "ERROR: Unknown IO loop type '$SELECT_TYPE'"
-	exit 1
-esac
-
 echo "Using ${SELECT_TYPE} for the IO loop."
 AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
 AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
 AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
+AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
 AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
 AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
 
@@ -2587,7 +2588,7 @@
 if test "$LINUX_TPROXY" ; then
     AC_MSG_CHECKING(if TPROXY header files are installed)
     # hold on to your hats...
-    if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes"; then
+    if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
 	LINUX_TPROXY="yes"
 	AC_DEFINE(LINUX_TPROXY, 1, [Enable real Transparent Proxy support for Netfilter TPROXY.])
     else
@@ -2596,7 +2597,7 @@
     fi
     AC_MSG_RESULT($LINUX_TPROXY)
 fi
-if test "$LINUX_TPROXY" = "no" ; then
+if test "$LINUX_TPROXY" = "no" && test "$LINUX_NETFILTER" = "yes"; then
     echo "WARNING: Cannot find TPROXY headers, you need to install the"
     echo "tproxy package from:"
     echo " - lynx http://www.balabit.com/downloads/tproxy/"
diff -ruN squid-2.6.STABLE4/contrib/Makefile.in squid-2.6.STABLE5/contrib/Makefile.in
--- squid-2.6.STABLE4/contrib/Makefile.in	Fri Sep 22 03:09:34 2006
+++ squid-2.6.STABLE5/contrib/Makefile.in	Sun Oct 29 19:21:10 2006
@@ -97,7 +97,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -181,6 +180,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/doc/Makefile.in squid-2.6.STABLE5/doc/Makefile.in
--- squid-2.6.STABLE4/doc/Makefile.in	Fri Sep 22 03:09:36 2006
+++ squid-2.6.STABLE5/doc/Makefile.in	Sun Oct 29 19:21:11 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.29 2006/09/22 09:09:36 hno Exp $
+#  $Id: Makefile.in,v 1.31 2006/10/30 02:21:11 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -104,7 +104,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -188,6 +187,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/errors/Makefile.in squid-2.6.STABLE5/errors/Makefile.in
--- squid-2.6.STABLE4/errors/Makefile.in	Fri Sep 22 03:09:37 2006
+++ squid-2.6.STABLE5/errors/Makefile.in	Sun Oct 29 19:21:13 2006
@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 #
-# $Id: Makefile.in,v 1.45 2006/09/22 09:09:37 hno Exp $
+# $Id: Makefile.in,v 1.47 2006/10/30 02:21:13 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -96,7 +96,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -180,6 +179,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/Makefile.in squid-2.6.STABLE5/helpers/Makefile.in
--- squid-2.6.STABLE4/helpers/Makefile.in	Fri Sep 22 03:09:38 2006
+++ squid-2.6.STABLE5/helpers/Makefile.in	Sun Oct 29 19:21:14 2006
@@ -101,7 +101,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -185,6 +184,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/LDAP/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/LDAP/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/LDAP/Makefile.in	Fri Sep 22 03:09:39 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/LDAP/Makefile.in	Sun Oct 29 19:21:16 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.in,v 1.37 2006/09/22 09:09:39 hno Exp $
+#  $Id: Makefile.in,v 1.39 2006/10/30 02:21:16 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -123,7 +123,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -207,6 +206,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/MSNT/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/MSNT/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/MSNT/Makefile.in	Fri Sep 22 03:09:39 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/MSNT/Makefile.in	Sun Oct 29 19:21:17 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.40 2006/09/22 09:09:39 hno Exp $
+#  $Id: Makefile.in,v 1.42 2006/10/30 02:21:17 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -132,7 +132,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -216,6 +215,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/Makefile.in	Fri Sep 22 03:09:39 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/Makefile.in	Sun Oct 29 19:21:15 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.36 2006/09/22 09:09:39 hno Exp $
+#  $Id: Makefile.in,v 1.38 2006/10/30 02:21:15 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -105,7 +105,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -189,6 +188,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/NCSA/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/NCSA/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/NCSA/Makefile.in	Fri Sep 22 03:09:40 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/NCSA/Makefile.in	Sun Oct 29 19:21:17 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.37 2006/09/22 09:09:40 hno Exp $
+#  $Id: Makefile.in,v 1.39 2006/10/30 02:21:17 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -123,7 +123,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -207,6 +206,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/NCSA/ncsa_auth.c squid-2.6.STABLE5/helpers/basic_auth/NCSA/ncsa_auth.c
--- squid-2.6.STABLE4/helpers/basic_auth/NCSA/ncsa_auth.c	Thu Sep 21 20:18:00 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/NCSA/ncsa_auth.c	Sat Sep 30 15:25:01 2006
@@ -73,6 +73,7 @@
     char *passwd;
     if (hash != NULL) {
 	hashFreeItems(hash, my_free);
+	hashFreeMemory(hash);
     }
     /* initial setup */
     hash = hash_create((HASHCMP *) strcmp, 7921, hash_string);
@@ -149,6 +150,10 @@
 	} else {
 	    printf("ERR Wrong password\n");
 	}
+    }
+    if (hash != NULL) {
+	hashFreeItems(hash, my_free);
+	hashFreeMemory(hash);
     }
     exit(0);
 }
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/PAM/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/PAM/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/PAM/Makefile.in	Fri Sep 22 03:09:40 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/PAM/Makefile.in	Sun Oct 29 19:21:18 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid PAM authentication helper
 #
-#  $Id: Makefile.in,v 1.36 2006/09/22 09:09:40 hno Exp $
+#  $Id: Makefile.in,v 1.38 2006/10/30 02:21:18 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -122,7 +122,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -206,6 +205,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/SASL/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/SASL/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/SASL/Makefile.in	Fri Sep 22 03:09:40 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/SASL/Makefile.in	Sun Oct 29 19:21:19 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid SASL authentication helper
 #
-#  $Id: Makefile.in,v 1.33 2006/09/22 09:09:40 hno Exp $
+#  $Id: Makefile.in,v 1.35 2006/10/30 02:21:19 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -119,7 +119,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -203,6 +202,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/SMB/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/SMB/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/SMB/Makefile.in	Fri Sep 22 03:09:41 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/SMB/Makefile.in	Sun Oct 29 19:21:19 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.36 2006/09/22 09:09:41 hno Exp $
+#  $Id: Makefile.in,v 1.38 2006/10/30 02:21:19 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -128,7 +128,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -212,6 +211,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/YP/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/YP/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/YP/Makefile.in	Fri Sep 22 03:09:41 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/YP/Makefile.in	Sun Oct 29 19:21:20 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.37 2006/09/22 09:09:41 hno Exp $
+#  $Id: Makefile.in,v 1.39 2006/10/30 02:21:20 hno Exp $
 #
 #
 
@@ -118,7 +118,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -202,6 +201,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/getpwnam/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/getpwnam/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/getpwnam/Makefile.in	Fri Sep 22 03:09:41 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/getpwnam/Makefile.in	Sun Oct 29 19:21:20 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.35 2006/09/22 09:09:41 hno Exp $
+#  $Id: Makefile.in,v 1.37 2006/10/30 02:21:20 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -120,7 +120,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -204,6 +203,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/mswin_sspi/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/mswin_sspi/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/mswin_sspi/Makefile.in	Fri Sep 22 03:09:41 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/mswin_sspi/Makefile.in	Sun Oct 29 19:21:22 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2006/09/22 09:09:41 hno Exp $
+#  $Id: Makefile.in,v 1.11 2006/10/30 02:21:22 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -119,7 +119,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -203,6 +202,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/basic_auth/multi-domain-NTLM/Makefile.in squid-2.6.STABLE5/helpers/basic_auth/multi-domain-NTLM/Makefile.in
--- squid-2.6.STABLE4/helpers/basic_auth/multi-domain-NTLM/Makefile.in	Fri Sep 22 03:09:42 2006
+++ squid-2.6.STABLE5/helpers/basic_auth/multi-domain-NTLM/Makefile.in	Sun Oct 29 19:21:22 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.33 2006/09/22 09:09:42 hno Exp $
+#  $Id: Makefile.in,v 1.35 2006/10/30 02:21:22 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -104,7 +104,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -188,6 +187,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/digest_auth/Makefile.in squid-2.6.STABLE5/helpers/digest_auth/Makefile.in
--- squid-2.6.STABLE4/helpers/digest_auth/Makefile.in	Fri Sep 22 03:09:42 2006
+++ squid-2.6.STABLE5/helpers/digest_auth/Makefile.in	Sun Oct 29 19:21:22 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for digest auth helpers in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.33 2006/09/22 09:09:42 hno Exp $
+#  $Id: Makefile.in,v 1.35 2006/10/30 02:21:22 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -105,7 +105,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -189,6 +188,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/digest_auth/ldap/Makefile.in squid-2.6.STABLE5/helpers/digest_auth/ldap/Makefile.in
--- squid-2.6.STABLE4/helpers/digest_auth/ldap/Makefile.in	Fri Sep 22 03:09:43 2006
+++ squid-2.6.STABLE5/helpers/digest_auth/ldap/Makefile.in	Sun Oct 29 19:21:22 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.14 2006/09/22 09:09:43 hno Exp $
+#  $Id: Makefile.in,v 1.16 2006/10/30 02:21:22 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -122,7 +122,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -206,6 +205,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/digest_auth/password/Makefile.in squid-2.6.STABLE5/helpers/digest_auth/password/Makefile.in
--- squid-2.6.STABLE4/helpers/digest_auth/password/Makefile.in	Fri Sep 22 03:09:43 2006
+++ squid-2.6.STABLE5/helpers/digest_auth/password/Makefile.in	Sun Oct 29 19:21:23 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.35 2006/09/22 09:09:43 hno Exp $
+#  $Id: Makefile.in,v 1.37 2006/10/30 02:21:23 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -121,7 +121,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -205,6 +204,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/Makefile.in squid-2.6.STABLE5/helpers/external_acl/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/Makefile.in	Fri Sep 22 03:09:43 2006
+++ squid-2.6.STABLE5/helpers/external_acl/Makefile.in	Sun Oct 29 19:21:23 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.23 2006/09/22 09:09:43 hno Exp $
+#  $Id: Makefile.in,v 1.25 2006/10/30 02:21:23 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -105,7 +105,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -189,6 +188,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/ip_user/Makefile.in squid-2.6.STABLE5/helpers/external_acl/ip_user/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/ip_user/Makefile.in	Fri Sep 22 03:09:43 2006
+++ squid-2.6.STABLE5/helpers/external_acl/ip_user/Makefile.in	Sun Oct 29 19:21:24 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the ip_user external_acl helper by Rodrigo Campos
 #
-#  $Id: Makefile.in,v 1.22 2006/09/22 09:09:43 hno Exp $
+#  $Id: Makefile.in,v 1.24 2006/10/30 02:21:24 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -119,7 +119,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -203,6 +202,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/ldap_group/Makefile.in squid-2.6.STABLE5/helpers/external_acl/ldap_group/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/ldap_group/Makefile.in	Fri Sep 22 03:09:44 2006
+++ squid-2.6.STABLE5/helpers/external_acl/ldap_group/Makefile.in	Sun Oct 29 19:21:24 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.in,v 1.23 2006/09/22 09:09:44 hno Exp $
+#  $Id: Makefile.in,v 1.25 2006/10/30 02:21:24 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -124,7 +124,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -208,6 +207,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/mswin_lm_group/Makefile.in squid-2.6.STABLE5/helpers/external_acl/mswin_lm_group/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/mswin_lm_group/Makefile.in	Fri Sep 22 03:09:44 2006
+++ squid-2.6.STABLE5/helpers/external_acl/mswin_lm_group/Makefile.in	Sun Oct 29 19:21:25 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.8 2006/09/22 09:09:44 hno Exp $
+#  $Id: Makefile.in,v 1.10 2006/10/30 02:21:25 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -119,7 +119,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -203,6 +202,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/session/Makefile.in squid-2.6.STABLE5/helpers/external_acl/session/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/session/Makefile.in	Fri Sep 22 03:09:44 2006
+++ squid-2.6.STABLE5/helpers/external_acl/session/Makefile.in	Sun Oct 29 19:21:26 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.in,v 1.9 2006/09/22 09:09:44 hno Exp $
+#  $Id: Makefile.in,v 1.11 2006/10/30 02:21:26 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -122,7 +122,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -206,6 +205,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/unix_group/Makefile.in squid-2.6.STABLE5/helpers/external_acl/unix_group/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/unix_group/Makefile.in	Fri Sep 22 03:09:44 2006
+++ squid-2.6.STABLE5/helpers/external_acl/unix_group/Makefile.in	Sun Oct 29 19:21:27 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.in,v 1.22 2006/09/22 09:09:44 hno Exp $
+#  $Id: Makefile.in,v 1.24 2006/10/30 02:21:27 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -121,7 +121,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -205,6 +204,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/external_acl/wbinfo_group/Makefile.in squid-2.6.STABLE5/helpers/external_acl/wbinfo_group/Makefile.in
--- squid-2.6.STABLE4/helpers/external_acl/wbinfo_group/Makefile.in	Fri Sep 22 03:09:44 2006
+++ squid-2.6.STABLE5/helpers/external_acl/wbinfo_group/Makefile.in	Sun Oct 29 19:21:28 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.in,v 1.21 2006/09/22 09:09:44 hno Exp $
+#  $Id: Makefile.in,v 1.23 2006/10/30 02:21:28 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -104,7 +104,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -188,6 +187,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/negotiate_auth/Makefile.in squid-2.6.STABLE5/helpers/negotiate_auth/Makefile.in
--- squid-2.6.STABLE4/helpers/negotiate_auth/Makefile.in	Fri Sep 22 03:09:45 2006
+++ squid-2.6.STABLE5/helpers/negotiate_auth/Makefile.in	Sun Oct 29 19:21:28 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.10 2006/09/22 09:09:45 hno Exp $
+#  $Id: Makefile.in,v 1.12 2006/10/30 02:21:28 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -105,7 +105,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -189,6 +188,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/negotiate_auth/mswin_sspi/Makefile.in squid-2.6.STABLE5/helpers/negotiate_auth/mswin_sspi/Makefile.in
--- squid-2.6.STABLE4/helpers/negotiate_auth/mswin_sspi/Makefile.in	Fri Sep 22 03:09:45 2006
+++ squid-2.6.STABLE5/helpers/negotiate_auth/mswin_sspi/Makefile.in	Sun Oct 29 19:21:29 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.8 2006/09/22 09:09:45 hno Exp $
+#  $Id: Makefile.in,v 1.10 2006/10/30 02:21:29 hno Exp $
 #
 
 srcdir = @srcdir@
@@ -118,7 +118,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -202,6 +201,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/ntlm_auth/Makefile.in squid-2.6.STABLE5/helpers/ntlm_auth/Makefile.in
--- squid-2.6.STABLE4/helpers/ntlm_auth/Makefile.in	Fri Sep 22 03:09:46 2006
+++ squid-2.6.STABLE5/helpers/ntlm_auth/Makefile.in	Sun Oct 29 19:21:30 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.36 2006/09/22 09:09:46 hno Exp $
+#  $Id: Makefile.in,v 1.38 2006/10/30 02:21:30 hno Exp $
 #
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -105,7 +105,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -189,6 +188,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/ntlm_auth/SMB/Makefile.in squid-2.6.STABLE5/helpers/ntlm_auth/SMB/Makefile.in
--- squid-2.6.STABLE4/helpers/ntlm_auth/SMB/Makefile.in	Fri Sep 22 03:09:46 2006
+++ squid-2.6.STABLE5/helpers/ntlm_auth/SMB/Makefile.in	Sun Oct 29 19:21:30 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.35 2006/09/22 09:09:46 hno Exp $
+#  $Id: Makefile.in,v 1.37 2006/10/30 02:21:30 hno Exp $
 #
 
 srcdir = @srcdir@
@@ -125,7 +125,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -209,6 +208,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/ntlm_auth/SMB/smbval/Makefile.in squid-2.6.STABLE5/helpers/ntlm_auth/SMB/smbval/Makefile.in
--- squid-2.6.STABLE4/helpers/ntlm_auth/SMB/smbval/Makefile.in	Fri Sep 22 03:09:46 2006
+++ squid-2.6.STABLE5/helpers/ntlm_auth/SMB/smbval/Makefile.in	Sun Oct 29 19:21:30 2006
@@ -113,7 +113,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -197,6 +196,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/Makefile.in squid-2.6.STABLE5/helpers/ntlm_auth/fakeauth/Makefile.in
--- squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/Makefile.in	Fri Sep 22 03:09:47 2006
+++ squid-2.6.STABLE5/helpers/ntlm_auth/fakeauth/Makefile.in	Sun Oct 29 19:21:31 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.34 2006/09/22 09:09:47 hno Exp $
+#  $Id: Makefile.in,v 1.36 2006/10/30 02:21:31 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -120,7 +120,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -204,6 +203,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/ntlm_auth/mswin_sspi/Makefile.in squid-2.6.STABLE5/helpers/ntlm_auth/mswin_sspi/Makefile.in
--- squid-2.6.STABLE4/helpers/ntlm_auth/mswin_sspi/Makefile.in	Fri Sep 22 03:09:47 2006
+++ squid-2.6.STABLE5/helpers/ntlm_auth/mswin_sspi/Makefile.in	Sun Oct 29 19:21:31 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.8 2006/09/22 09:09:47 hno Exp $
+#  $Id: Makefile.in,v 1.10 2006/10/30 02:21:31 hno Exp $
 #
 
 srcdir = @srcdir@
@@ -117,7 +117,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -201,6 +200,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/helpers/ntlm_auth/no_check/Makefile.in squid-2.6.STABLE5/helpers/ntlm_auth/no_check/Makefile.in
--- squid-2.6.STABLE4/helpers/ntlm_auth/no_check/Makefile.in	Fri Sep 22 03:09:47 2006
+++ squid-2.6.STABLE5/helpers/ntlm_auth/no_check/Makefile.in	Sun Oct 29 19:21:31 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.36 2006/09/22 09:09:47 hno Exp $
+#  $Id: Makefile.in,v 1.38 2006/10/30 02:21:31 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -104,7 +104,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -188,6 +187,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/icons/Makefile.in squid-2.6.STABLE5/icons/Makefile.in
--- squid-2.6.STABLE4/icons/Makefile.in	Fri Sep 22 03:09:47 2006
+++ squid-2.6.STABLE5/icons/Makefile.in	Sun Oct 29 19:21:32 2006
@@ -14,7 +14,7 @@
 
 @SET_MAKE@
 
-# $Id: Makefile.in,v 1.46 2006/09/22 09:09:47 hno Exp $
+# $Id: Makefile.in,v 1.48 2006/10/30 02:21:32 hno Exp $
 #
 
 srcdir = @srcdir@
@@ -105,7 +105,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -189,6 +188,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/include/autoconf.h.in squid-2.6.STABLE5/include/autoconf.h.in
--- squid-2.6.STABLE4/include/autoconf.h.in	Sat Sep 16 14:30:43 2006
+++ squid-2.6.STABLE5/include/autoconf.h.in	Sun Oct 29 19:21:33 2006
@@ -772,9 +772,6 @@
    dnsserver processes instead. */
 #undef USE_DNSSERVERS
 
-/* Use epoll() for the IO loop */
-#undef USE_EPOLL
-
 /* Define if we should use GNU regex */
 #undef USE_GNUREGEX
 
@@ -792,9 +789,6 @@
 /* Compile in support for Ident (RFC 931) lookups? Enabled by default. */
 #undef USE_IDENT
 
-/* Use kqueue() for the IO loop */
-#undef USE_KQUEUE
-
 /* Enable code for assiting in finding memory leaks. Hacker stuff only. */
 #undef USE_LEAKFINDER
 
@@ -803,18 +797,9 @@
    (USE_SSL) */
 #undef USE_OPENSSL
 
-/* Use poll() for the IO loop */
-#undef USE_POLL
-
 /* If you want to log Referer request header values, define this. By default,
    they are written to referer.log in the Squid log directory. */
 #undef USE_REFERER_LOG
-
-/* Use select() for the IO loop */
-#undef USE_SELECT
-
-/* Use Winsock select() for the IO loop */
-#undef USE_SELECT_WIN32
 
 /* Define this to include code for SSL encryption. */
 #undef USE_SSL
diff -ruN squid-2.6.STABLE4/include/version.h squid-2.6.STABLE5/include/version.h
--- squid-2.6.STABLE4/include/version.h	Sat Sep 23 11:49:33 2006
+++ squid-2.6.STABLE5/include/version.h	Fri Nov  3 06:20:14 2006
@@ -9,5 +9,5 @@
  */
 
 #ifndef SQUID_RELEASE_TIME
-#define SQUID_RELEASE_TIME 1159033770
+#define SQUID_RELEASE_TIME 1162560011
 #endif
diff -ruN squid-2.6.STABLE4/lib/Makefile.in squid-2.6.STABLE5/lib/Makefile.in
--- squid-2.6.STABLE4/lib/Makefile.in	Fri Sep 22 03:09:48 2006
+++ squid-2.6.STABLE5/lib/Makefile.in	Sun Oct 29 19:21:33 2006
@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 #
-#  $Id: Makefile.in,v 1.85 2006/09/22 09:09:48 hno Exp $
+#  $Id: Makefile.in,v 1.87 2006/10/30 02:21:33 hno Exp $
 #
 
 srcdir = @srcdir@
@@ -150,7 +150,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -234,6 +233,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/scripts/Makefile.in squid-2.6.STABLE5/scripts/Makefile.in
--- squid-2.6.STABLE4/scripts/Makefile.in	Fri Sep 22 03:09:48 2006
+++ squid-2.6.STABLE5/scripts/Makefile.in	Sun Oct 29 19:21:33 2006
@@ -102,7 +102,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -186,6 +185,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/snmplib/Makefile.in squid-2.6.STABLE5/snmplib/Makefile.in
--- squid-2.6.STABLE4/snmplib/Makefile.in	Fri Sep 22 03:09:48 2006
+++ squid-2.6.STABLE5/snmplib/Makefile.in	Sun Oct 29 19:21:33 2006
@@ -111,7 +111,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -195,6 +194,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/src/Makefile.am squid-2.6.STABLE5/src/Makefile.am
--- squid-2.6.STABLE4/src/Makefile.am	Fri Sep  8 13:41:24 2006
+++ squid-2.6.STABLE5/src/Makefile.am	Sun Oct 29 17:07:33 2006
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.55 2006/09/08 19:41:24 serassio Exp $
+#  $Id: Makefile.am,v 1.56 2006/10/30 00:07:33 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -79,6 +79,9 @@
 if USE_SELECT
 COMMLOOP_SOURCE = comm_select.c
 endif
+if USE_SELECT_SIMPLE
+COMMLOOP_SOURCE = comm_select_simple.c
+endif
 if USE_SELECT_WIN32
 COMMLOOP_SOURCE = comm_select_win32.c
 endif
@@ -127,6 +130,7 @@
 	comm_poll.c \
 	comm_select.c \
 	comm_select_win32.c \
+	comm_select_simple.c \
 	comm_kqueue.c \
 	comm_generic.c \
 	ipc.c \
diff -ruN squid-2.6.STABLE4/src/Makefile.in squid-2.6.STABLE5/src/Makefile.in
--- squid-2.6.STABLE4/src/Makefile.in	Fri Sep 22 03:09:48 2006
+++ squid-2.6.STABLE5/src/Makefile.in	Sun Oct 29 19:21:34 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.278 2006/09/22 09:09:48 hno Exp $
+#  $Id: Makefile.in,v 1.280 2006/10/30 02:21:34 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -84,27 +84,28 @@
 am__squid_SOURCES_DIST = access_log.c acl.c asn.c authenticate.c \
 	cache_cf.c CacheDigest.c cache_manager.c carp.c cbdata.c \
 	client_db.c client_side.c comm.c comm_epoll.c comm_kqueue.c \
-	comm_poll.c comm_select.c comm_select_win32.c debug.c \
-	defines.h delay_pools.c disk.c dns_internal.c dns.c enums.h \
-	errorpage.c event.c errormap.c external_acl.c fd.c filemap.c \
-	forward.c fqdncache.c ftp.c globals.h gopher.c helper.c htcp.c \
-	http.c HttpStatusLine.c HttpHdrCc.c HttpHdrRange.c \
-	HttpHdrContRange.c HttpHeader.c HttpHeaderTools.c HttpBody.c \
-	HttpMsg.c HttpReply.c HttpRequest.c icmp.c icp_v2.c icp_v3.c \
-	ident.c internal.c ipc.c ipc_win32.c ipcache.c leakfinder.c \
-	locrewrite.c logfile.c main.c mem.c MemPool.c MemBuf.c mime.c \
-	multicast.c neighbors.c net_db.c Packer.c pconn.c \
-	peer_digest.c peer_monitor.c peer_select.c peer_sourcehash.c \
-	peer_userhash.c protos.h redirect.c referer.c refresh.c \
-	send-announce.c snmp_core.c snmp_agent.c squid.h ssl.c \
-	ssl_support.c stat.c StatHist.c String.c stmem.c store.c \
-	store_io.c store_client.c store_digest.c store_dir.c \
-	store_key_md5.c store_log.c store_rebuild.c store_swapin.c \
-	store_swapmeta.c store_swapout.c structs.h tools.c typedefs.h \
-	unlinkd.c url.c urn.c useragent.c wais.c wccp.c wccp2.c \
-	whois.c win32.c
-@USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_FALSE@@USE_SELECT_WIN32_TRUE@am__objects_1 = comm_select_win32.$(OBJEXT)
-@USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_TRUE@am__objects_1 = comm_select.$(OBJEXT)
+	comm_poll.c comm_select_simple.c comm_select.c \
+	comm_select_win32.c debug.c defines.h delay_pools.c disk.c \
+	dns_internal.c dns.c enums.h errorpage.c event.c errormap.c \
+	external_acl.c fd.c filemap.c forward.c fqdncache.c ftp.c \
+	globals.h gopher.c helper.c htcp.c http.c HttpStatusLine.c \
+	HttpHdrCc.c HttpHdrRange.c HttpHdrContRange.c HttpHeader.c \
+	HttpHeaderTools.c HttpBody.c HttpMsg.c HttpReply.c \
+	HttpRequest.c icmp.c icp_v2.c icp_v3.c ident.c internal.c \
+	ipc.c ipc_win32.c ipcache.c leakfinder.c locrewrite.c \
+	logfile.c main.c mem.c MemPool.c MemBuf.c mime.c multicast.c \
+	neighbors.c net_db.c Packer.c pconn.c peer_digest.c \
+	peer_monitor.c peer_select.c peer_sourcehash.c peer_userhash.c \
+	protos.h redirect.c referer.c refresh.c send-announce.c \
+	snmp_core.c snmp_agent.c squid.h ssl.c ssl_support.c stat.c \
+	StatHist.c String.c stmem.c store.c store_io.c store_client.c \
+	store_digest.c store_dir.c store_key_md5.c store_log.c \
+	store_rebuild.c store_swapin.c store_swapmeta.c \
+	store_swapout.c structs.h tools.c typedefs.h unlinkd.c url.c \
+	urn.c useragent.c wais.c wccp.c wccp2.c whois.c win32.c
+@USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_FALSE@@USE_SELECT_SIMPLE_FALSE@@USE_SELECT_WIN32_TRUE@am__objects_1 = comm_select_win32.$(OBJEXT)
+@USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_SIMPLE_FALSE@@USE_SELECT_TRUE@am__objects_1 = comm_select.$(OBJEXT)
+@USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_SIMPLE_TRUE@am__objects_1 = comm_select_simple.$(OBJEXT)
 @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_TRUE@am__objects_1 = comm_poll.$(OBJEXT)
 @USE_EPOLL_FALSE@@USE_KQUEUE_TRUE@am__objects_1 =  \
 @USE_EPOLL_FALSE@@USE_KQUEUE_TRUE@	comm_kqueue.$(OBJEXT)
@@ -242,7 +243,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -326,6 +326,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
@@ -402,6 +404,7 @@
 @USE_EPOLL_TRUE@COMMLOOP_SOURCE = comm_epoll.c
 @USE_KQUEUE_TRUE@COMMLOOP_SOURCE = comm_kqueue.c
 @USE_POLL_TRUE@COMMLOOP_SOURCE = comm_poll.c
+@USE_SELECT_SIMPLE_TRUE@COMMLOOP_SOURCE = comm_select_simple.c
 @USE_SELECT_TRUE@COMMLOOP_SOURCE = comm_select.c
 @USE_SELECT_WIN32_TRUE@COMMLOOP_SOURCE = comm_select_win32.c
 SUBDIRS = fs repl auth
@@ -425,6 +428,7 @@
 	comm_poll.c \
 	comm_select.c \
 	comm_select_win32.c \
+	comm_select_simple.c \
 	comm_kqueue.c \
 	comm_generic.c \
 	ipc.c \
@@ -765,6 +769,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comm_kqueue.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comm_poll.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comm_select.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comm_select_simple.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comm_select_win32.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delay_pools.Po@am__quote@
diff -ruN squid-2.6.STABLE4/src/access_log.c squid-2.6.STABLE5/src/access_log.c
--- squid-2.6.STABLE4/src/access_log.c	Sat Sep  2 08:08:42 2006
+++ squid-2.6.STABLE5/src/access_log.c	Thu Sep 28 15:55:37 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.c,v 1.92 2006/09/02 14:08:42 hno Exp $
+ * $Id: access_log.c,v 1.93 2006/09/28 21:55:37 hno Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -1031,31 +1031,46 @@
 #endif
     if (user && !*user)
 	safe_free(user);
-    logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %" PRINTF_OFF_T " %s %s %s %s%s/%s %s",
-	(long int) current_time.tv_sec,
-	(int) current_time.tv_usec / 1000,
-	al->cache.msec,
-	client,
-	log_tags[al->cache.code],
-	al->http.code,
-	al->cache.size,
-	al->private.method_str,
-	al->url,
-	user ? user : dash_str,
-	al->hier.ping.timedout ? "TIMEOUT_" : "",
-	hier_strings[al->hier.code],
-	al->hier.host,
-	al->http.content_type);
-    safe_free(user);
-    if (Config.onoff.log_mime_hdrs) {
+    if (!Config.onoff.log_mime_hdrs) {
+	logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %" PRINTF_OFF_T " %s %s %s %s%s/%s %s\n",
+	    (long int) current_time.tv_sec,
+	    (int) current_time.tv_usec / 1000,
+	    al->cache.msec,
+	    client,
+	    log_tags[al->cache.code],
+	    al->http.code,
+	    al->cache.size,
+	    al->private.method_str,
+	    al->url,
+	    user ? user : dash_str,
+	    al->hier.ping.timedout ? "TIMEOUT_" : "",
+	    hier_strings[al->hier.code],
+	    al->hier.host,
+	    al->http.content_type);
+    } else {
 	char *ereq = log_quote(al->headers.request);
 	char *erep = log_quote(al->headers.reply);
-	logfilePrintf(logfile, " [%s] [%s]\n", ereq, erep);
+	logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %" PRINTF_OFF_T " %s %s %s %s%s/%s %s [%s] [%s]\n",
+	    (long int) current_time.tv_sec,
+	    (int) current_time.tv_usec / 1000,
+	    al->cache.msec,
+	    client,
+	    log_tags[al->cache.code],
+	    al->http.code,
+	    al->cache.size,
+	    al->private.method_str,
+	    al->url,
+	    user ? user : dash_str,
+	    al->hier.ping.timedout ? "TIMEOUT_" : "",
+	    hier_strings[al->hier.code],
+	    al->hier.host,
+	    al->http.content_type,
+	    ereq,
+	    erep);
 	safe_free(ereq);
 	safe_free(erep);
-    } else {
-	logfilePrintf(logfile, "\n");
     }
+    safe_free(user);
 }
 
 static void
diff -ruN squid-2.6.STABLE4/src/acl.c squid-2.6.STABLE5/src/acl.c
--- squid-2.6.STABLE4/src/acl.c	Fri Sep 22 04:44:24 2006
+++ squid-2.6.STABLE5/src/acl.c	Mon Oct 16 14:11:41 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.c,v 1.314 2006/09/22 10:44:24 hno Exp $
+ * $Id: acl.c,v 1.316 2006/10/16 20:11:41 serassio Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -623,7 +623,7 @@
 	    }
 	} else {
 	    /* assume its time-of-day spec */
-	    if ((sscanf(t, "%d:%d-%d:%d", &h1, &m1, &h2, &m2) < 4) || (!((h1 >= 0 && h1 < 24) && (h2 >= 0 && h2 < 24) && (m1 >= 0 && m1 < 60) && (m2 >= 0 && m2 < 60)))) {
+	    if ((sscanf(t, "%d:%d-%d:%d", &h1, &m1, &h2, &m2) < 4) || (!((h1 >= 0 && h1 < 24) && ((h2 >= 0 && h2 < 24) || (h2 == 24 && m2 == 0)) && (m1 >= 0 && m1 < 60) && (m2 >= 0 && m2 < 60)))) {
 		debug(28, 0) ("aclParseTimeSpec: ERROR: Bad time range '%s'\n", t);
 		self_destruct();
 	    }
@@ -747,7 +747,7 @@
 	acl_hdr_data *q = *acldata;
 	*acldata = q->next;
 	if (q->reglist)
-	    aclDestroyRegexList((*acldata)->reglist);
+	    aclDestroyRegexList(q->reglist);
 	safe_free(q);
     }
 }
diff -ruN squid-2.6.STABLE4/src/auth/Makefile.in squid-2.6.STABLE5/src/auth/Makefile.in
--- squid-2.6.STABLE4/src/auth/Makefile.in	Fri Sep 22 03:09:49 2006
+++ squid-2.6.STABLE5/src/auth/Makefile.in	Sun Oct 29 19:21:35 2006
@@ -123,7 +123,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -207,6 +206,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
@@ -258,7 +259,7 @@
 
 #  Makefile for authentication modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.35 2006/09/22 09:09:49 hno Exp $
+#  $Id: Makefile.in,v 1.37 2006/10/30 02:21:35 hno Exp $
 #
 AUTOMAKE_OPTIONS = subdir-objects
 EXTRA_LIBRARIES = libbasic.a libdigest.a libntlm.a libnegotiate.a
diff -ruN squid-2.6.STABLE4/src/cache_cf.c squid-2.6.STABLE5/src/cache_cf.c
--- squid-2.6.STABLE4/src/cache_cf.c	Fri Sep 22 04:47:04 2006
+++ squid-2.6.STABLE5/src/cache_cf.c	Sat Sep 30 15:01:08 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.c,v 1.457 2006/09/22 10:47:04 hno Exp $
+ * $Id: cache_cf.c,v 1.458 2006/09/30 21:01:08 hno Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -277,6 +277,15 @@
     return i;
 }
 
+static u_short
+GetShort(void)
+{
+    char *token = strtok(NULL, w_space);
+    if (token == NULL)
+	self_destruct();
+    return xatos(token);
+}
+
 static squid_off_t
 GetOffT(void)
 {
@@ -1583,7 +1592,6 @@
 {
     char *token = NULL;
     peer *p;
-    int i;
     p = cbdataAlloc(peer);
     p->http_port = CACHE_HTTP_PORT;
     p->icp.port = CACHE_ICP_PORT;
@@ -1597,10 +1605,10 @@
     if ((token = strtok(NULL, w_space)) == NULL)
 	self_destruct();
     p->type = parseNeighborType(token);
-    i = GetInteger();
-    p->http_port = (u_short) i;
-    i = GetInteger();
-    p->icp.port = (u_short) i;
+    p->http_port = GetShort();
+    if (!p->http_port)
+	self_destruct();
+    p->icp.port = GetShort();
     p->connection_auth = -1;	/* auto */
     while ((token = strtok(NULL, w_space))) {
 	if (!strcasecmp(token, "proxy-only")) {
@@ -1979,16 +1987,13 @@
 parse_ushortlist(ushortlist ** P)
 {
     char *token;
-    int i;
+    u_short i;
     ushortlist *u;
     ushortlist **U;
     while ((token = strtok(NULL, w_space))) {
-	if (sscanf(token, "%d", &i) != 1)
-	    self_destruct();
-	if (i < 0)
-	    i = 0;
+	i = GetShort();
 	u = xcalloc(1, sizeof(ushortlist));
-	u->i = (u_short) i;
+	u->i = i;
 	for (U = P; *U; U = &(*U)->next);
 	*U = u;
     }
@@ -2413,12 +2418,7 @@
 static void
 parse_ushort(u_short * var)
 {
-    int i;
-
-    i = GetInteger();
-    if (i < 0)
-	i = 0;
-    *var = (u_short) i;
+    *var = GetShort();
 }
 
 static void
diff -ruN squid-2.6.STABLE4/src/cf.data.pre squid-2.6.STABLE5/src/cf.data.pre
--- squid-2.6.STABLE4/src/cf.data.pre	Fri Sep 22 00:36:51 2006
+++ squid-2.6.STABLE5/src/cf.data.pre	Thu Oct 12 14:48:48 2006
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.371 2006/09/22 06:36:51 swilton Exp $
+# $Id: cf.data.pre,v 1.374 2006/10/12 20:48:48 wessels Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -1062,10 +1062,13 @@
 	see the --enable-storeio configure option.
 
 	'Directory' is a top-level directory where cache swap
-	files will be stored.  If you want to use an entire disk
+	files will be stored. If you want to use an entire disk
 	for caching, this can be the mount-point directory.
 	The directory must exist and be writable by the Squid
-	process.  Squid will NOT create this directory for you.
+	process. Squid will NOT create this directory for you.
+	Only using COSS, a raw disk device or a stripe file can
+	be specified, but the configuration of the "cache_wap_log"
+	tag is mandatory.
 
 	The ufs store type:
 
@@ -2120,9 +2123,9 @@
 			as ttl)
 	  children=n	number of processes spawn to service external acl
 			lookups of this type.
-			Note: see compatibility note below
 	  concurrency=n	concurrency level per process. Use 0 for simple helpers
 			who can only process a single request at a time.
+			Note: see compatibility note below
 	  cache=n	result cache size, 0 is unbounded (default)
 	  grace=	Percentage remaining of TTL where a refresh of a
 			cached entry should be initiated without needing to
@@ -2186,13 +2189,10 @@
 	of the above described quoting format.
 
 	Compatibility Note: The children= option was named concurrency= in
-	Squid-2.5.STABLE3 and earlier and such syntax is still accepted to
-	keep compatibility within the Squid-2.5 release. However, the meaning
-	of concurrency= option has changed in Squid-3 and the old syntax of
-	the directive is therefore deprecated from Squid-2.5.STABLE4 and later.
-	If you want to be able to easily downgrade to earlier Squid-2.5
-	releases you may want to continue using the old name, if not
-	please use the new name.
+	Squid-2.5.STABLE3 and earlier, and was accepted as an alias for the
+	duration of the Squid-2.5 releases to keep compatibility. However,
+	the meaning of concurrency= option has changed in Squid-2.6 to match
+	that of Squid-3 and the old syntax no longer works.
 DOC_END
 
 COMMENT_START
@@ -2801,10 +2801,10 @@
 acl manager proto cache_object
 acl localhost src 127.0.0.1/255.255.255.255
 acl to_localhost dst 127.0.0.0/8
-acl SSL_ports port 443 563
+acl SSL_ports port 443
 acl Safe_ports port 80		# http
 acl Safe_ports port 21		# ftp
-acl Safe_ports port 443 563	# https, snews
+acl Safe_ports port 443		# https
 acl Safe_ports port 70		# gopher
 acl Safe_ports port 210		# wais
 acl Safe_ports port 1025-65535	# unregistered ports
diff -ruN squid-2.6.STABLE4/src/client_side.c squid-2.6.STABLE5/src/client_side.c
--- squid-2.6.STABLE4/src/client_side.c	Fri Sep 22 03:47:55 2006
+++ squid-2.6.STABLE5/src/client_side.c	Sat Sep 30 15:10:48 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.c,v 1.678 2006/09/22 09:47:55 hno Exp $
+ * $Id: client_side.c,v 1.680 2006/09/30 21:10:48 hno Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2154,6 +2154,14 @@
 	    debug(33, 2) ("clientProcessHit: Vary detected!\n");
 	    return;
 	}
+    case VARY_RESTART:
+	/* Used on collapsed requests when the main request wasn't
+	 * compatible. Resart processing from the beginning.
+	 */
+	safe_free(r->vary_hdr);
+	safe_free(r->vary_headers);
+	clientProcessRequest(http);
+	return;
     case VARY_CANCEL:
 	/* varyEvaluateMatch found a object loop. Process as miss */
 	debug(33, 1) ("clientProcessHit: Vary object loop!\n");
@@ -2180,6 +2188,7 @@
 	    http->log_type = LOG_TCP_NEGATIVE_HIT;
 	    clientSendMoreHeaderData(data, buf, size);
 	} else {
+	    memFree(buf, MEM_CLIENT_SOCK_BUF);
 	    http->log_type = LOG_TCP_MISS;
 	    clientProcessMiss(http);
 	}
@@ -3306,6 +3315,9 @@
 	http->entry = NULL;
 	return LOG_TCP_MISS;
     }
+    if (EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
+	r->flags.collapsed = 1;	/* Don't trust the store entry */
+    }
     if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) {
 	/* Special entries are always hits, no matter what the client says */
 	debug(33, 3) ("clientProcessRequest2: ENTRY_SPECIAL HIT\n");
@@ -3349,6 +3361,7 @@
     debug(33, 4) ("clientProcessRequest: %s '%s'\n",
 	RequestMethodStr[r->method],
 	url);
+    r->flags.collapsed = 0;
     if (r->method == METHOD_CONNECT && !http->redirect.status) {
 	http->log_type = LOG_TCP_MISS;
 #if USE_SSL && SSL_CONNECT_INTERCEPT
@@ -3483,6 +3496,15 @@
     http->entry = clientCreateStoreEntry(http, r->method, r->flags);
     if (Config.onoff.collapsed_forwarding && r->flags.cachable && !r->flags.need_validation && (r->method = METHOD_GET || r->method == METHOD_HEAD)) {
 	http->entry->mem_obj->refresh_timestamp = squid_curtime;
+	/* Set the vary object state */
+	safe_free(http->entry->mem_obj->vary_headers);
+	if (r->vary_headers)
+	    http->entry->mem_obj->vary_headers = xstrdup(r->vary_headers);
+	safe_free(http->entry->mem_obj->vary_encoding);
+	if (strBuf(r->vary_encoding))
+	    http->entry->mem_obj->vary_encoding = xstrdup(strBuf(r->vary_encoding));
+	http->entry->mem_obj->request = requestLink(r);
+	EBIT_SET(http->entry->flags, KEY_EARLY_PUBLIC);
 	storeSetPublicKey(http->entry);
     }
     fwdStart(http->conn->fd, http->entry, r);
@@ -4983,6 +5005,10 @@
 	    /* Ouch.. we cannot handle this kind of variance */
 	    /* XXX This cannot really happen, but just to be complete */
 	    return VARY_CANCEL;
+	} else if (request->flags.collapsed) {
+	    /* This request was merged before we knew the outcome. Don't trust the response */
+	    /* restart vary processing from the beginning */
+	    return VARY_RESTART;
 	} else {
 	    return VARY_MATCH;
 	}
diff -ruN squid-2.6.STABLE4/src/comm.c squid-2.6.STABLE5/src/comm.c
--- squid-2.6.STABLE4/src/comm.c	Sat Sep  9 06:45:06 2006
+++ squid-2.6.STABLE5/src/comm.c	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.c,v 1.357 2006/09/09 12:45:06 serassio Exp $
+ * $Id: comm.c,v 1.358 2006/10/23 11:22:21 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -1036,8 +1036,7 @@
 void
 comm_init(void)
 {
-    fd_table = xcalloc(Squid_MaxFD, sizeof(fde));
-    /* XXX account fd_table */
+    fd_init();
     /* Keep a few file descriptors free so that we don't run out of FD's
      * after accepting a client but before it opens a socket or a file.
      * Since Squid_MaxFD can be as high as several thousand, don't waste them */
diff -ruN squid-2.6.STABLE4/src/comm_epoll.c squid-2.6.STABLE5/src/comm_epoll.c
--- squid-2.6.STABLE4/src/comm_epoll.c	Tue Aug 15 13:27:28 2006
+++ squid-2.6.STABLE5/src/comm_epoll.c	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_epoll.c,v 1.26 2006/08/15 19:27:28 hno Exp $
+ * $Id: comm_epoll.c,v 1.27 2006/10/23 11:22:21 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -65,8 +65,8 @@
     }
 }
 
-void
-comm_select_init()
+static void
+do_select_init()
 {
     kdpfd = epoll_create(Squid_MaxFD);
     if (kdpfd < 0)
@@ -83,8 +83,8 @@
     debug(5, 1) ("Using epoll for the IO loop\n");
 }
 
-void
-comm_select_shutdown()
+static void
+do_select_shutdown()
 {
     fd_close(kdpfd);
     close(kdpfd);
@@ -153,37 +153,20 @@
     }
 }
 
-int
-comm_select(int msec)
+static int
+do_comm_select(int msec)
 {
-    static time_t last_timeout = 0;
     int i;
     int num;
     int fd;
     struct epoll_event *cevents;
-    double start = current_dtime;
-
-    if (msec > MAX_POLL_TIME)
-	msec = MAX_POLL_TIME;
-
-    debug(5, 3) ("comm_select: timeout %d\n", msec);
 
     if (epoll_fds == 0) {
 	assert(shutting_down);
 	return COMM_SHUTDOWN;
     }
-    /* Check for disk io callbacks */
-    storeDirCallback();
-
-    /* Check timeouts once per second */
-    if (last_timeout != squid_curtime) {
-	last_timeout = squid_curtime;
-	checkTimeouts();
-    }
     statCounter.syscalls.polls++;
     num = epoll_wait(kdpfd, events, MAX_EVENTS, msec);
-    statCounter.select_loops++;
-
     if (num < 0) {
 	getCurrentTime();
 	if (ignoreErrno(errno))
@@ -194,17 +177,13 @@
     }
     statHistCount(&statCounter.select_fds_hist, num);
 
-    if (num > 0) {
-	for (i = 0, cevents = events; i < num; i++, cevents++) {
-	    fd = cevents->data.fd;
-	    comm_call_handlers(fd, cevents->events & ~EPOLLOUT, cevents->events & ~EPOLLIN);
-	}
-	getCurrentTime();
-	statCounter.select_time += (current_dtime - start);
-	return COMM_OK;
-    } else {
-	getCurrentTime();
-	debug(5, 8) ("comm_select: time out: %ld.\n", (long int) squid_curtime);
+    if (num == 0)
 	return COMM_TIMEOUT;
+
+    for (i = 0, cevents = events; i < num; i++, cevents++) {
+	fd = cevents->data.fd;
+	comm_call_handlers(fd, cevents->events & ~EPOLLOUT, cevents->events & ~EPOLLIN);
     }
+
+    return COMM_OK;
 }
diff -ruN squid-2.6.STABLE4/src/comm_generic.c squid-2.6.STABLE5/src/comm_generic.c
--- squid-2.6.STABLE4/src/comm_generic.c	Tue Jun 27 05:14:22 2006
+++ squid-2.6.STABLE5/src/comm_generic.c	Tue Oct 31 11:25:15 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_generic.c,v 1.5 2006/06/27 11:14:22 hno Exp $
+ * $Id: comm_generic.c,v 1.8 2006/10/31 18:25:15 serassio Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -39,6 +39,33 @@
 
 static int MAX_POLL_TIME = 1000;	/* see also comm_quick_poll_required() */
 
+#if DELAY_POOLS
+static int *slow_fds = NULL;
+static int n_slow_fds = 0;
+#endif
+
+static void do_select_init(void);
+
+void
+comm_select_init(void)
+{
+#if DELAY_POOLS
+    slow_fds = xmalloc(sizeof(int) * Squid_MaxFD);
+#endif
+    do_select_init();
+}
+
+static void do_select_shutdown(void);
+
+void
+comm_select_shutdown(void)
+{
+    do_select_shutdown();
+#if DELAY_POOLS
+    safe_free(slow_fds);
+#endif
+}
+
 /* Defer reads from this fd */
 void
 commDeferFD(int fd)
@@ -84,10 +111,114 @@
     return F->defer_check(fd, F->defer_data);
 }
 
+#if DELAY_POOLS
+static void
+commAddSlow(int fd)
+{
+    fde *F = &fd_table[fd];
+    if (F->slow_id)
+	return;
+    F->slow_id = ++n_slow_fds;
+    assert(n_slow_fds < Squid_MaxFD);
+    slow_fds[n_slow_fds] = fd;
+}
+
+void
+commRemoveSlow(int fd)
+{
+    int fd2;
+    fde *F = &fd_table[fd];
+    if (!F->slow_id)
+	return;
+    fd2 = slow_fds[n_slow_fds--];
+    if (F->slow_id <= n_slow_fds) {
+	fde *F2;
+	slow_fds[F->slow_id] = fd2;
+	F2 = &fd_table[fd2];
+	F2->slow_id = F->slow_id;
+    }
+    F->slow_id = 0;
+}
+#endif
+
+static int comm_select_handled;
+
+static inline int do_comm_select(int msec);
+
+static inline void comm_call_handlers(int fd, int read_event, int write_event);
+
+static inline void
+do_call_incoming(int fd)
+{
+    fde *F = &fd_table[fd];
+    if (!F->flags.backoff)
+	comm_call_handlers(fd, -1, -1);
+}
+
 static void
+do_check_incoming(void)
+{
+    int i;
+    for (i = 0; i < NHttpSockets; i++)
+	do_call_incoming(HttpSockets[i]);
+    if (theInIcpConnection >= 0)
+	do_call_incoming(theInIcpConnection);
+    if (theOutIcpConnection != theInIcpConnection)
+	do_call_incoming(theOutIcpConnection);
+}
+
+static inline void
+check_incoming(void)
+{
+    comm_select_handled++;
+    if (comm_select_handled > 30 && comm_select_handled > NHttpSockets << 2) {
+	comm_select_handled = 0;
+	do_check_incoming();
+    }
+}
+
+#if DELAY_POOLS
+static void
+comm_call_slowfds(void)
+{
+    while (n_slow_fds) {
+	int i = (squid_random() % n_slow_fds) + 1;
+	int fd = slow_fds[i];
+	fde *F = &fd_table[fd];
+	commRemoveSlow(fd);
+	if (F->read_handler) {
+	    PF *hdl = F->read_handler;
+	    void *hdl_data = F->read_data;
+	    debug(5, 8) ("comm_call_handlers(): Calling read handler on fd=%d\n", fd);
+#if SIMPLE_COMM_HANDLER
+	    commUpdateReadHandler(fd, NULL, NULL);
+	    commResumeFD(fd);
+	    hdl(fd, hdl_data);
+#else
+	    /* Optimized version to avoid the fd bouncing in/out of the waited set */
+	    F->read_handler = NULL;
+	    F->read_data = NULL;
+	    F->read_pending = COMM_PENDING_NORMAL;
+	    hdl(fd, hdl_data);
+	    /* backoff check is for delayed connections kicked alive from checkTimeouts */
+	    if (F->flags.open && (!F->read_handler || F->flags.backoff)) {
+		if (F->flags.backoff && commDeferRead(fd) != 1)
+		    F->flags.backoff = 0;
+		commUpdateEvents(fd);
+	    }
+#endif
+	    statCounter.select_fds++;
+	    check_incoming();
+	}
+    }
+}
+#endif
+
+static inline void
 comm_call_handlers(int fd, int read_event, int write_event)
 {
     fde *F = &fd_table[fd];
+    const int do_incoming = read_event == 1 || write_event == 1;
     debug(5, 8) ("comm_call_handlers(): got fd=%d read_event=%x write_event=%x F->read_handler=%p F->write_handler=%p\n"
 	,fd, read_event, write_event, F->read_handler, F->write_handler);
     if (F->read_handler) {
@@ -109,13 +240,18 @@
 	    void *hdl_data = F->read_data;
 	    /* If the descriptor is meant to be deferred, don't handle */
 	    switch (commDeferRead(fd)) {
-	    case 1:
+#if DELAY_POOLS
+	    case -1:
+		commAddSlow(fd);
+		break;
+#endif
+	    default:
 		if (!(F->flags.backoff)) {
 		    debug(5, 1) ("comm_call_handlers(): WARNING defer handler for fd=%d (desc=%s) does not call commDeferFD() - backing off manually\n", fd, F->desc);
 		    commDeferFD(fd);
 		}
 		break;
-	    default:
+	    case 0:
 		debug(5, 8) ("comm_call_handlers(): Calling read handler on fd=%d\n", fd);
 #if SIMPLE_COMM_HANDLER
 		commUpdateReadHandler(fd, NULL, NULL);
@@ -130,6 +266,9 @@
 		    commUpdateEvents(fd);
 #endif
 		statCounter.select_fds++;
+		if (do_incoming)
+		    check_incoming();
+		break;
 	    }
 	}
     }
@@ -163,6 +302,8 @@
 		commUpdateEvents(fd);
 #endif
 	    statCounter.select_fds++;
+	    if (do_incoming)
+		check_incoming();
 	}
     }
 }
@@ -173,17 +314,32 @@
     int fd;
     fde *F = NULL;
     PF *callback;
+#if DELAY_POOLS
+    delayPoolsUpdate(NULL);
+#endif
     for (fd = 0; fd <= Biggest_FD; fd++) {
 	F = &fd_table[fd];
 	if (!F->flags.open)
 	    continue;
-	if (F->flags.backoff)
-	    commResumeFD(fd);
+	if (F->flags.backoff) {
+	    switch (commDeferRead(fd)) {
+	    case 0:
+		commResumeFD(fd);
+		break;
+#if DELAY_POOLS
+	    case -1:
+		commAddSlow(fd);
+		break;
+#endif
+	    }
+	}
 	if (F->timeout == 0)
 	    continue;
 	if (F->timeout > squid_curtime)
 	    continue;
 	debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
+	if (F->flags.backoff)
+	    commResumeFD(fd);
 	if (F->timeout_handler) {
 	    debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
 	    callback = F->timeout_handler;
@@ -196,6 +352,50 @@
     }
 }
 
+
+int
+comm_select(int msec)
+{
+    static time_t last_timeout = 0;
+    int rc;
+    double start = current_dtime;
+
+    debug(5, 3) ("comm_select: timeout %d\n", msec);
+
+    if (msec > MAX_POLL_TIME)
+	msec = MAX_POLL_TIME;
+
+#if DELAY_POOLS
+    /* We have delayed fds in queue? */
+    if (n_slow_fds)
+	msec = 0;
+#endif
+
+    statCounter.select_loops++;
+
+    /* Check for disk io callbacks */
+    storeDirCallback();
+
+    /* Check timeouts once per second */
+    if (last_timeout != squid_curtime) {
+	last_timeout = squid_curtime;
+	checkTimeouts();
+    }
+    comm_select_handled = 0;
+
+    rc = do_comm_select(msec);
+
+#if DELAY_POOLS
+    comm_call_slowfds();
+#endif
+    getCurrentTime();
+    statCounter.select_time += (current_dtime - start);
+
+    if (rc == COMM_TIMEOUT)
+	debug(5, 8) ("comm_select: time out\n");
+
+    return rc;
+}
 
 /* Called by async-io or diskd to speed up the polling */
 void
diff -ruN squid-2.6.STABLE4/src/comm_kqueue.c squid-2.6.STABLE5/src/comm_kqueue.c
--- squid-2.6.STABLE4/src/comm_kqueue.c	Tue Aug 15 13:27:28 2006
+++ squid-2.6.STABLE5/src/comm_kqueue.c	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_kqueue.c,v 1.9 2006/08/15 19:27:28 hno Exp $
+ * $Id: comm_kqueue.c,v 1.10 2006/10/23 11:22:21 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -50,8 +50,8 @@
 static int kqoff;		/* offset into the buffer */
 static unsigned *kqueue_state;	/* keep track of the kqueue state */
 
-void
-comm_select_init()
+static void
+do_select_init()
 {
     kq = kqueue();
     if (kq < 0)
@@ -71,8 +71,8 @@
     debug(5, 1) ("Using kqueue for the IO loop\n");
 }
 
-void
-comm_select_shutdown()
+static void
+do_select_shutdown()
 {
     fd_close(kq);
     close(kq);
@@ -123,37 +123,20 @@
     }
 }
 
-int
-comm_select(int msec)
+static int
+do_comm_select(int msec)
 {
-    static time_t last_timeout = 0;
     int i;
     int num;
-    double start = current_dtime;
     static struct kevent ke[KE_LENGTH];
     struct timespec timeout;
 
-    if (msec > MAX_POLL_TIME)
-	msec = MAX_POLL_TIME;
-
     timeout.tv_sec = msec / 1000;
     timeout.tv_nsec = (msec % 1000) * 1000000;
 
-    debug(5, 3) ("comm_select: timeout %d\n", msec);
-
-    /* Check for disk io callbacks */
-    storeDirCallback();
-
-    /* Check timeouts once per second */
-    if (last_timeout != squid_curtime) {
-	last_timeout = squid_curtime;
-	checkTimeouts();
-    }
     statCounter.syscalls.polls++;
     num = kevent(kq, kqlst, kqoff, ke, KE_LENGTH, &timeout);
-    statCounter.select_loops++;
     kqoff = 0;
-
     if (num < 0) {
 	getCurrentTime();
 	if (ignoreErrno(errno))
@@ -162,11 +145,9 @@
 	debug(5, 1) ("comm_select: kevent failure: %s\n", xstrerror());
 	return COMM_ERROR;
     }
-    if (num == 0) {
-	getCurrentTime();
-	return COMM_TIMEOUT;
-    }
     statHistCount(&statCounter.select_fds_hist, num);
+    if (num == 0)
+	return COMM_TIMEOUT;
 
     for (i = 0; i < num; i++) {
 	int fd = (int) ke[i].ident;
@@ -190,7 +171,5 @@
 	}
     }
 
-    getCurrentTime();
-    statCounter.select_time += (current_dtime - start);
     return COMM_OK;
 }
diff -ruN squid-2.6.STABLE4/src/comm_poll.c squid-2.6.STABLE5/src/comm_poll.c
--- squid-2.6.STABLE4/src/comm_poll.c	Tue Aug 15 13:27:28 2006
+++ squid-2.6.STABLE5/src/comm_poll.c	Fri Oct 27 18:34:54 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_poll.c,v 1.21 2006/08/15 19:27:28 hno Exp $
+ * $Id: comm_poll.c,v 1.23 2006/10/28 00:34:54 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -33,6 +33,7 @@
  */
 
 #include "squid.h"
+#include "comm_generic.c"
 
 #if HAVE_SYS_POLL_H
 #include <sys/poll.h>
@@ -40,539 +41,19 @@
 #include <poll.h>
 #endif
 
-static int MAX_POLL_TIME = 1000;	/* see also comm_quick_poll_required() */
-
-/* STATIC */
-static int fdIsHttp(int fd);
-static int fdIsIcp(int fd);
-static int fdIsDns(int fd);
-static int commDeferRead(int fd);
-static void checkTimeouts(void);
-static OBJH commIncomingStats;
-static int comm_check_incoming_poll_handlers(int nfds, int *fds);
-static void comm_poll_dns_incoming(void);
-
-/*
- * Automatic tuning for incoming requests:
- *
- * INCOMING sockets are the ICP and HTTP ports.  We need to check these
- * fairly regularly, but how often?  When the load increases, we
- * want to check the incoming sockets more often.  If we have a lot
- * of incoming ICP, then we need to check these sockets more than
- * if we just have HTTP.
- *
- * The variables 'incoming_icp_interval' and 'incoming_http_interval' 
- * determine how many normal I/O events to process before checking
- * incoming sockets again.  Note we store the incoming_interval
- * multipled by a factor of (2^INCOMING_FACTOR) to have some
- * pseudo-floating point precision.
- *
- * The variable 'icp_io_events' and 'http_io_events' counts how many normal
- * I/O events have been processed since the last check on the incoming
- * sockets.  When io_events > incoming_interval, its time to check incoming
- * sockets.
- *
- * Every time we check incoming sockets, we count how many new messages
- * or connections were processed.  This is used to adjust the
- * incoming_interval for the next iteration.  The new incoming_interval
- * is calculated as the current incoming_interval plus what we would
- * like to see as an average number of events minus the number of
- * events just processed.
- *
- *  incoming_interval = incoming_interval + target_average - number_of_events_processed
- *
- * There are separate incoming_interval counters for both HTTP and ICP events
- * 
- * You can see the current values of the incoming_interval's, as well as
- * a histogram of 'incoming_events' by asking the cache manager
- * for 'comm_incoming', e.g.:
- *
- *      % ./client mgr:comm_incoming
- *
- * Caveats:
- *
- *      - We have MAX_INCOMING_INTEGER as a magic upper limit on
- *        incoming_interval for both types of sockets.  At the
- *        largest value the cache will effectively be idling.
- *
- *      - The higher the INCOMING_FACTOR, the slower the algorithm will
- *        respond to load spikes/increases/decreases in demand. A value
- *        between 3 and 8 is recommended.
- */
-
-#define MAX_INCOMING_INTEGER 256
-#define INCOMING_FACTOR 5
-#define MAX_INCOMING_INTERVAL (MAX_INCOMING_INTEGER << INCOMING_FACTOR)
-static int icp_io_events = 0;
-static int dns_io_events = 0;
-static int http_io_events = 0;
-static int incoming_icp_interval = 16 << INCOMING_FACTOR;
-static int incoming_dns_interval = 16 << INCOMING_FACTOR;
-static int incoming_http_interval = 16 << INCOMING_FACTOR;
-#define commCheckICPIncoming (++icp_io_events > (incoming_icp_interval>> INCOMING_FACTOR))
-#define commCheckDNSIncoming (++dns_io_events > (incoming_dns_interval>> INCOMING_FACTOR))
-#define commCheckHTTPIncoming (++http_io_events > (incoming_http_interval>> INCOMING_FACTOR))
-
-static int
-fdIsIcp(int fd)
-{
-    if (fd == theInIcpConnection)
-	return 1;
-    if (fd == theOutIcpConnection)
-	return 1;
-    return 0;
-}
-
-static int
-fdIsDns(int fd)
-{
-    if (fd == DnsSocket)
-	return 1;
-    return 0;
-}
-
-static int
-fdIsHttp(int fd)
-{
-    int j;
-    for (j = 0; j < NHttpSockets; j++) {
-	if (fd == HttpSockets[j])
-	    return 1;
-    }
-    return 0;
-}
-
-#if DELAY_POOLS
-static int slowfdcnt = 0;
-static int slowfdarr[SQUID_MAXFD];
+static struct pollfd *pfds;
+static int *pfd_map;
+static int nfds = 0;
 
 static void
-commAddSlowFd(int fd)
-{
-    assert(slowfdcnt < SQUID_MAXFD);
-    slowfdarr[slowfdcnt++] = fd;
-}
-
-static int
-commGetSlowFd(void)
-{
-    int whichfd, retfd;
-
-    if (!slowfdcnt)
-	return -1;
-    whichfd = squid_random() % slowfdcnt;
-    retfd = slowfdarr[whichfd];
-    slowfdarr[whichfd] = slowfdarr[--slowfdcnt];
-    return retfd;
-}
-#endif
-
-static int
-comm_check_incoming_poll_handlers(int nfds, int *fds)
+do_select_init()
 {
     int i;
-    int fd;
-    PF *hdl = NULL;
-    int npfds;
-    struct pollfd pfds[3 + MAXHTTPPORTS];
-    incoming_sockets_accepted = 0;
-    for (i = npfds = 0; i < nfds; i++) {
-	int events;
-	fd = fds[i];
-	events = 0;
-	if (fd_table[fd].read_handler)
-	    events |= POLLRDNORM;
-	if (fd_table[fd].write_handler)
-	    events |= POLLWRNORM;
-	if (events) {
-	    pfds[npfds].fd = fd;
-	    pfds[npfds].events = events;
-	    pfds[npfds].revents = 0;
-	    npfds++;
-	}
+    pfds = xcalloc(sizeof(*pfds), Squid_MaxFD);
+    pfd_map = xcalloc(sizeof(*pfd_map), Squid_MaxFD);
+    for (i = 0; i < Squid_MaxFD; i++) {
+	pfd_map[i] = -1;
     }
-    if (!nfds)
-	return -1;
-    getCurrentTime();
-    statCounter.syscalls.polls++;
-    if (poll(pfds, npfds, 0) < 1)
-	return incoming_sockets_accepted;
-    for (i = 0; i < npfds; i++) {
-	int revents;
-	if (((revents = pfds[i].revents) == 0) || ((fd = pfds[i].fd) == -1))
-	    continue;
-	if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) {
-	    if ((hdl = fd_table[fd].read_handler)) {
-		fd_table[fd].read_handler = NULL;
-		hdl(fd, fd_table[fd].read_data);
-	    } else if (pfds[i].events & POLLRDNORM)
-		debug(5, 1) ("comm_poll_incoming: FD %d NULL read handler\n",
-		    fd);
-	}
-	if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
-	    if ((hdl = fd_table[fd].write_handler)) {
-		fd_table[fd].write_handler = NULL;
-		hdl(fd, fd_table[fd].write_data);
-	    } else if (pfds[i].events & POLLWRNORM)
-		debug(5, 1) ("comm_poll_incoming: FD %d NULL write_handler\n",
-		    fd);
-	}
-    }
-    return incoming_sockets_accepted;
-}
-
-static void
-comm_poll_icp_incoming(void)
-{
-    int nfds = 0;
-    int fds[2];
-    int nevents;
-    icp_io_events = 0;
-    if (theInIcpConnection >= 0)
-	fds[nfds++] = theInIcpConnection;
-    if (theInIcpConnection != theOutIcpConnection)
-	if (theOutIcpConnection >= 0)
-	    fds[nfds++] = theOutIcpConnection;
-    if (nfds == 0)
-	return;
-    nevents = comm_check_incoming_poll_handlers(nfds, fds);
-    incoming_icp_interval += Config.comm_incoming.icp_average - nevents;
-    if (incoming_icp_interval < Config.comm_incoming.icp_min_poll)
-	incoming_icp_interval = Config.comm_incoming.icp_min_poll;
-    if (incoming_icp_interval > MAX_INCOMING_INTERVAL)
-	incoming_icp_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_ICP_MAX)
-	nevents = INCOMING_ICP_MAX;
-    statHistCount(&statCounter.comm_icp_incoming, nevents);
-}
-
-static void
-comm_poll_http_incoming(void)
-{
-    int nfds = 0;
-    int fds[MAXHTTPPORTS];
-    int j;
-    int nevents;
-    http_io_events = 0;
-    for (j = 0; j < NHttpSockets; j++) {
-	if (HttpSockets[j] < 0)
-	    continue;
-	if (commDeferRead(HttpSockets[j]))
-	    continue;
-	fds[nfds++] = HttpSockets[j];
-    }
-    nevents = comm_check_incoming_poll_handlers(nfds, fds);
-    incoming_http_interval = incoming_http_interval
-	+ Config.comm_incoming.http_average - nevents;
-    if (incoming_http_interval < Config.comm_incoming.http_min_poll)
-	incoming_http_interval = Config.comm_incoming.http_min_poll;
-    if (incoming_http_interval > MAX_INCOMING_INTERVAL)
-	incoming_http_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_HTTP_MAX)
-	nevents = INCOMING_HTTP_MAX;
-    statHistCount(&statCounter.comm_http_incoming, nevents);
-}
-
-/* poll all sockets; call handlers for those that are ready. */
-int
-comm_select(int msec)
-{
-    struct pollfd pfds[SQUID_MAXFD];
-#if DELAY_POOLS
-    char slowfds[SQUID_MAXFD];
-#endif
-    int fd;
-    unsigned int i;
-    unsigned int maxfd;
-    unsigned int nfds;
-    unsigned int npending;
-    int num;
-    int callicp = 0, callhttp = 0;
-    int calldns = 0;
-    static time_t last_timeout = 0;
-    double timeout = current_dtime + (msec / 1000.0);
-    do {
-	double start;
-	getCurrentTime();
-	start = current_dtime;
-	/* Handle any fs callbacks that need doing */
-	storeDirCallback();
-#if DELAY_POOLS
-	memset(slowfds, 0, Biggest_FD);
-#endif
-	if (commCheckICPIncoming)
-	    comm_poll_icp_incoming();
-	if (commCheckDNSIncoming)
-	    comm_poll_dns_incoming();
-	if (commCheckHTTPIncoming)
-	    comm_poll_http_incoming();
-	callicp = calldns = callhttp = 0;
-	nfds = 0;
-	npending = 0;
-	maxfd = Biggest_FD + 1;
-	for (i = 0; i < maxfd; i++) {
-	    int events;
-	    events = 0;
-	    /* Check each open socket for a handler. */
-	    if (fd_table[i].read_handler) {
-		int dopoll = 1;
-		switch (commDeferRead(i)) {
-		case 0:
-		    break;
-		case 1:
-		    dopoll = 0;
-		    break;
-#if DELAY_POOLS
-		case -1:
-		    slowfds[i] = 1;
-		    break;
-#endif
-		default:
-		    fatalf("bad return value from commDeferRead(FD %d)\n", i);
-		    /* NOTREACHED */
-		}
-		if (dopoll) {
-		    switch (fd_table[i].read_pending) {
-		    case COMM_PENDING_NORMAL:
-			events |= POLLRDNORM;
-			break;
-		    case COMM_PENDING_WANTS_WRITE:
-			events |= POLLWRNORM;
-			break;
-		    case COMM_PENDING_WANTS_READ:
-			events |= POLLRDNORM;
-			break;
-		    case COMM_PENDING_NOW:
-			events |= POLLRDNORM;
-			npending++;
-			break;
-		    }
-		}
-	    }
-	    if (fd_table[i].write_handler) {
-		switch (fd_table[i].write_pending) {
-		case COMM_PENDING_NORMAL:
-		    events |= POLLWRNORM;
-		    break;
-		case COMM_PENDING_WANTS_WRITE:
-		    events |= POLLWRNORM;
-		    break;
-		case COMM_PENDING_WANTS_READ:
-		    events |= POLLRDNORM;
-		    break;
-		case COMM_PENDING_NOW:
-		    events |= POLLWRNORM;
-		    npending++;
-		    break;
-		}
-	    }
-	    if (events) {
-		pfds[nfds].fd = i;
-		pfds[nfds].events = events;
-		pfds[nfds].revents = 0;
-		nfds++;
-	    }
-	}
-	if (nfds == 0) {
-	    assert(shutting_down);
-	    return COMM_SHUTDOWN;
-	}
-	if (npending)
-	    msec = 0;
-	if (msec > MAX_POLL_TIME)
-	    msec = MAX_POLL_TIME;
-	statCounter.syscalls.polls++;
-	num = poll(pfds, nfds, msec);
-	statCounter.select_loops++;
-	if (num < 0 && !ignoreErrno(errno)) {
-	    debug(5, 0) ("comm_select: poll failure: %s\n", xstrerror());
-	    assert(errno != EINVAL);
-	    return COMM_ERROR;
-	    /* NOTREACHED */
-	}
-	debug(5, num ? 5 : 8) ("comm_select: %d+%u FDs ready\n", num, npending);
-	statHistCount(&statCounter.select_fds_hist, num);
-	/* Check timeout handlers ONCE each second. */
-	if (squid_curtime > last_timeout) {
-	    last_timeout = squid_curtime;
-	    checkTimeouts();
-	}
-	if (num <= 0 && npending == 0)
-	    continue;
-	/* scan each socket but the accept socket. Poll this 
-	 * more frequently to minimize losses due to the 5 connect 
-	 * limit in SunOS */
-	for (i = 0; i < nfds; i++) {
-	    fde *F;
-	    int revents = pfds[i].revents;
-	    fd = pfds[i].fd;
-	    if (fd == -1)
-		continue;
-	    switch (fd_table[fd].read_pending) {
-	    case COMM_PENDING_NORMAL:
-	    case COMM_PENDING_WANTS_READ:
-		break;
-	    case COMM_PENDING_WANTS_WRITE:
-		if (pfds[i].revents & (POLLOUT | POLLWRNORM))
-		    revents |= POLLIN;
-		break;
-	    case COMM_PENDING_NOW:
-		revents |= POLLIN;
-		break;
-	    }
-	    switch (fd_table[fd].write_pending) {
-	    case COMM_PENDING_NORMAL:
-	    case COMM_PENDING_WANTS_WRITE:
-		break;
-	    case COMM_PENDING_WANTS_READ:
-		if (pfds[i].revents & (POLLIN | POLLRDNORM))
-		    revents |= POLLOUT;
-		break;
-	    case COMM_PENDING_NOW:
-		revents |= POLLOUT;
-		break;
-	    }
-	    if (revents == 0)
-		continue;
-	    if (fdIsIcp(fd)) {
-		callicp = 1;
-		continue;
-	    }
-	    if (fdIsDns(fd)) {
-		calldns = 1;
-		continue;
-	    }
-	    if (fdIsHttp(fd)) {
-		callhttp = 1;
-		continue;
-	    }
-	    F = &fd_table[fd];
-	    if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) {
-		PF *hdl = F->read_handler;
-		debug(5, 6) ("comm_select: FD %d ready for reading\n", fd);
-		if (hdl == NULL)
-		    (void) 0;	/* Nothing to do */
-#if DELAY_POOLS
-		else if (slowfds[i])
-		    commAddSlowFd(fd);
-#endif
-		else {
-		    F->read_handler = NULL;
-		    F->read_pending = COMM_PENDING_NORMAL;
-		    hdl(fd, F->read_data);
-		    statCounter.select_fds++;
-		    if (commCheckICPIncoming)
-			comm_poll_icp_incoming();
-		    if (commCheckDNSIncoming)
-			comm_poll_dns_incoming();
-		    if (commCheckHTTPIncoming)
-			comm_poll_http_incoming();
-		}
-	    }
-	    if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
-		PF *hdl = F->write_handler;
-		debug(5, 5) ("comm_select: FD %d ready for writing\n", fd);
-		if (hdl != NULL) {
-		    F->write_handler = NULL;
-		    F->write_pending = COMM_PENDING_NORMAL;
-		    hdl(fd, F->write_data);
-		    statCounter.select_fds++;
-		    if (commCheckICPIncoming)
-			comm_poll_icp_incoming();
-		    if (commCheckDNSIncoming)
-			comm_poll_dns_incoming();
-		    if (commCheckHTTPIncoming)
-			comm_poll_http_incoming();
-		}
-	    }
-	    if (revents & POLLNVAL) {
-		close_handler *ch;
-		debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd);
-		debug(5, 0) ("FD %d is a %s\n", fd, fdTypeStr[F->type]);
-		debug(5, 0) ("--> %s\n", F->desc);
-		debug(5, 0) ("tmout:%p read:%p write:%p\n",
-		    F->timeout_handler,
-		    F->read_handler,
-		    F->write_handler);
-		for (ch = F->close_handler; ch; ch = ch->next)
-		    debug(5, 0) (" close handler: %p\n", ch->handler);
-		if (F->close_handler) {
-		    commCallCloseHandlers(fd);
-		} else if (F->timeout_handler) {
-		    debug(5, 0) ("comm_select: Calling Timeout Handler\n");
-		    F->timeout_handler(fd, F->timeout_data);
-		}
-		F->close_handler = NULL;
-		F->timeout_handler = NULL;
-		F->read_handler = NULL;
-		F->write_handler = NULL;
-		if (F->flags.open)
-		    fd_close(fd);
-	    }
-	}
-	if (callicp)
-	    comm_poll_icp_incoming();
-	if (calldns)
-	    comm_poll_dns_incoming();
-	if (callhttp)
-	    comm_poll_http_incoming();
-#if DELAY_POOLS
-	while ((fd = commGetSlowFd()) != -1) {
-	    fde *F = &fd_table[fd];
-	    PF *hdl = F->read_handler;
-	    debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd);
-	    if (hdl != NULL) {
-		F->read_handler = NULL;
-		F->read_pending = COMM_PENDING_NORMAL;
-		hdl(fd, F->read_data);
-		statCounter.select_fds++;
-		if (commCheckICPIncoming)
-		    comm_poll_icp_incoming();
-		if (commCheckDNSIncoming)
-		    comm_poll_dns_incoming();
-		if (commCheckHTTPIncoming)
-		    comm_poll_http_incoming();
-	    }
-	}
-#endif
-	getCurrentTime();
-	statCounter.select_time += (current_dtime - start);
-	return COMM_OK;
-    }
-    while (timeout > current_dtime);
-    debug(5, 8) ("comm_select: time out: %ld.\n", (long int) squid_curtime);
-    return COMM_TIMEOUT;
-}
-
-static void
-comm_poll_dns_incoming(void)
-{
-    int nfds = 0;
-    int fds[2];
-    int nevents;
-    dns_io_events = 0;
-    if (DnsSocket < 0)
-	return;
-    fds[nfds++] = DnsSocket;
-    nevents = comm_check_incoming_poll_handlers(nfds, fds);
-    if (nevents < 0)
-	return;
-    incoming_dns_interval += Config.comm_incoming.dns_average - nevents;
-    if (incoming_dns_interval < Config.comm_incoming.dns_min_poll)
-	incoming_dns_interval = Config.comm_incoming.dns_min_poll;
-    if (incoming_dns_interval > MAX_INCOMING_INTERVAL)
-	incoming_dns_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_DNS_MAX)
-	nevents = INCOMING_DNS_MAX;
-    statHistCount(&statCounter.comm_dns_incoming, nevents);
-}
-
-void
-comm_select_init(void)
-{
-    cachemgrRegister("comm_incoming",
-	"comm_incoming() stats",
-	commIncomingStats, 0, 1);
 }
 
 void
@@ -581,9 +62,11 @@
     debug(5, 1) ("Using poll for the IO loop\n");
 }
 
-void
-comm_select_shutdown(void)
+static void
+do_select_shutdown()
 {
+    safe_free(pfds);
+    safe_free(pfd_map);
 }
 
 void
@@ -592,86 +75,76 @@
     storeAppendPrintf(sentry, "\tIO loop method:                     poll\n");
 }
 
-static void
-commIncomingStats(StoreEntry * sentry)
-{
-    StatCounters *f = &statCounter;
-    storeAppendPrintf(sentry, "Current incoming_icp_interval: %d\n",
-	incoming_icp_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "Current incoming_dns_interval: %d\n",
-	incoming_dns_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "Current incoming_http_interval: %d\n",
-	incoming_http_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "\n");
-    storeAppendPrintf(sentry, "Histogram of events per incoming socket type\n");
-    storeAppendPrintf(sentry, "ICP Messages handled per comm_poll_icp_incoming() call:\n");
-    statHistDump(&f->comm_icp_incoming, sentry, statHistIntDumper);
-    storeAppendPrintf(sentry, "DNS Messages handled per comm_poll_dns_incoming() call:\n");
-    statHistDump(&f->comm_dns_incoming, sentry, statHistIntDumper);
-    storeAppendPrintf(sentry, "HTTP Messages handled per comm_poll_http_incoming() call:\n");
-    statHistDump(&f->comm_http_incoming, sentry, statHistIntDumper);
-}
-
 void
 commSetEvents(int fd, int need_read, int need_write)
 {
-    /* XXX Here we could optimize the poll arrays quite considerably */
+    int pfdn = pfd_map[fd];
+    struct pollfd *pfd = pfdn >= 0 ? &pfds[pfdn] : NULL;
+    short events = (need_read ? POLLRDNORM : 0) | (need_write ? POLLWRNORM : 0);
+
+    if (!pfd && !events)
+	return;
+
+    if (!pfd) {
+	pfdn = nfds++;
+	pfd_map[fd] = pfdn;
+	pfd = &pfds[pfdn];
+	pfd->fd = fd;
+	pfd->events = events;
+    } else if (events) {
+	pfd->events = events;
+    } else {
+	pfd_map[fd] = -1;
+	nfds--;
+	*pfd = pfds[nfds];
+	pfds[nfds].events = 0;
+	pfds[nfds].revents = 0;
+	pfds[nfds].fd = -1;
+	if (pfd->fd >= 0)
+	    pfd_map[pfd->fd] = pfdn;
+    }
 }
 
 static int
-commDeferRead(int fd)
+do_comm_select(int msec)
 {
-    fde *F = &fd_table[fd];
-    if (F->defer_check == NULL)
-	return 0;
-    return F->defer_check(fd, F->defer_data);
-}
+    int num;
+    int i;
 
-static void
-checkTimeouts(void)
-{
-    int fd;
-    fde *F = NULL;
-    PF *callback;
-    for (fd = 0; fd <= Biggest_FD; fd++) {
-	F = &fd_table[fd];
-	if (!F->flags.open)
-	    continue;
-	if (F->timeout == 0)
-	    continue;
-	if (F->timeout > squid_curtime)
-	    continue;
-	debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
-	if (F->timeout_handler) {
-	    debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
-	    callback = F->timeout_handler;
-	    F->timeout_handler = NULL;
-	    callback(fd, F->timeout_data);
-	} else {
-	    debug(5, 5) ("checkTimeouts: FD %d: Forcing comm_close()\n", fd);
-	    comm_close(fd);
-	}
+    if (nfds == 0) {
+	assert(shutting_down);
+	return COMM_SHUTDOWN;
+    }
+    statCounter.syscalls.selects++;
+    num = poll(pfds, nfds, msec);
+    if (num < 0) {
+	getCurrentTime();
+	if (ignoreErrno(errno))
+	    return COMM_OK;
+
+	debug(5, 1) ("comm_select: poll failure: %s\n", xstrerror());
+	return COMM_ERROR;
     }
-}
+    statHistCount(&statCounter.select_fds_hist, num);
 
+    if (num == 0)
+	return COMM_TIMEOUT;
 
-/* Called by async-io or diskd to speed up the polling */
-void
-comm_quick_poll_required(void)
-{
-    MAX_POLL_TIME = 10;
-}
+    for (i = nfds - 1; num > 0 && i >= 0; i--) {
+	struct pollfd *pfd = &pfds[i];
+	short read_event, write_event;
 
-/* Defer reads from this fd */
-void
-commDeferFD(int fd)
-{
-    /* Not implemented */
-}
+	if (!pfd->revents)
+	    continue;
 
-/* Resume reading from the given fd */
-void
-commResumeFD(int fd)
-{
-    /* Not implemented */
+	read_event = pfd->revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR);
+	write_event = pfd->revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR);
+
+	pfd->revents = 0;
+
+	comm_call_handlers(pfd->fd, read_event, write_event);
+	num--;
+    }
+
+    return COMM_OK;
 }
diff -ruN squid-2.6.STABLE4/src/comm_select.c squid-2.6.STABLE5/src/comm_select.c
--- squid-2.6.STABLE4/src/comm_select.c	Tue Aug 15 13:27:28 2006
+++ squid-2.6.STABLE5/src/comm_select.c	Sun Oct 29 17:04:52 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select.c,v 1.77 2006/08/15 19:27:28 hno Exp $
+ * $Id: comm_select.c,v 1.79 2006/10/30 00:04:52 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -33,13 +33,16 @@
  */
 
 #include "squid.h"
+#include "comm_generic.c"
+
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 
 #if HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif
 
-static int MAX_POLL_TIME = 1000;	/* see also comm_quick_poll_required() */
-
 #ifndef        howmany
 #define howmany(x, y)   (((x)+((y)-1))/(y))
 #endif
@@ -49,522 +52,22 @@
 #define FD_MASK_BYTES sizeof(fd_mask)
 #define FD_MASK_BITS (FD_MASK_BYTES*NBBY)
 
-/* STATIC */
-static int examine_select(fd_set *, fd_set *);
-static int fdIsHttp(int fd);
-static int fdIsIcp(int fd);
-static int fdIsDns(int fd);
-static int commDeferRead(int fd);
-static void checkTimeouts(void);
-static OBJH commIncomingStats;
-static int comm_check_incoming_select_handlers(int nfds, int *fds);
-static void comm_select_dns_incoming(void);
-
-static struct timeval zero_tv;
-static fd_set global_readfds;
-static fd_set global_writefds;
+static fd_set *global_readfds;
+static fd_set *global_writefds;
+static fd_set *current_readfds;
+static fd_set *current_writefds;
+static fd_set *current_errfds;
 static int nreadfds;
 static int nwritefds;
 
-/*
- * Automatic tuning for incoming requests:
- *
- * INCOMING sockets are the ICP and HTTP ports.  We need to check these
- * fairly regularly, but how often?  When the load increases, we
- * want to check the incoming sockets more often.  If we have a lot
- * of incoming ICP, then we need to check these sockets more than
- * if we just have HTTP.
- *
- * The variables 'incoming_icp_interval' and 'incoming_http_interval' 
- * determine how many normal I/O events to process before checking
- * incoming sockets again.  Note we store the incoming_interval
- * multipled by a factor of (2^INCOMING_FACTOR) to have some
- * pseudo-floating point precision.
- *
- * The variable 'icp_io_events' and 'http_io_events' counts how many normal
- * I/O events have been processed since the last check on the incoming
- * sockets.  When io_events > incoming_interval, its time to check incoming
- * sockets.
- *
- * Every time we check incoming sockets, we count how many new messages
- * or connections were processed.  This is used to adjust the
- * incoming_interval for the next iteration.  The new incoming_interval
- * is calculated as the current incoming_interval plus what we would
- * like to see as an average number of events minus the number of
- * events just processed.
- *
- *  incoming_interval = incoming_interval + target_average - number_of_events_processed
- *
- * There are separate incoming_interval counters for both HTTP and ICP events
- * 
- * You can see the current values of the incoming_interval's, as well as
- * a histogram of 'incoming_events' by asking the cache manager
- * for 'comm_incoming', e.g.:
- *
- *      % ./client mgr:comm_incoming
- *
- * Caveats:
- *
- *      - We have MAX_INCOMING_INTEGER as a magic upper limit on
- *        incoming_interval for both types of sockets.  At the
- *        largest value the cache will effectively be idling.
- *
- *      - The higher the INCOMING_FACTOR, the slower the algorithm will
- *        respond to load spikes/increases/decreases in demand. A value
- *        between 3 and 8 is recommended.
- */
-
-#define MAX_INCOMING_INTEGER 256
-#define INCOMING_FACTOR 5
-#define MAX_INCOMING_INTERVAL (MAX_INCOMING_INTEGER << INCOMING_FACTOR)
-static int icp_io_events = 0;
-static int dns_io_events = 0;
-static int http_io_events = 0;
-static int incoming_icp_interval = 16 << INCOMING_FACTOR;
-static int incoming_dns_interval = 16 << INCOMING_FACTOR;
-static int incoming_http_interval = 16 << INCOMING_FACTOR;
-#define commCheckICPIncoming (++icp_io_events > (incoming_icp_interval>> INCOMING_FACTOR))
-#define commCheckDNSIncoming (++dns_io_events > (incoming_dns_interval>> INCOMING_FACTOR))
-#define commCheckHTTPIncoming (++http_io_events > (incoming_http_interval>> INCOMING_FACTOR))
-
-static int
-fdIsIcp(int fd)
-{
-    if (fd == theInIcpConnection)
-	return 1;
-    if (fd == theOutIcpConnection)
-	return 1;
-    return 0;
-}
-
-static int
-fdIsDns(int fd)
-{
-    if (fd == DnsSocket)
-	return 1;
-    return 0;
-}
-
-static int
-fdIsHttp(int fd)
-{
-    int j;
-    for (j = 0; j < NHttpSockets; j++) {
-	if (fd == HttpSockets[j])
-	    return 1;
-    }
-    return 0;
-}
-
-#if DELAY_POOLS
-static int slowfdcnt = 0;
-static int slowfdarr[SQUID_MAXFD];
-
-static void
-commAddSlowFd(int fd)
-{
-    assert(slowfdcnt < SQUID_MAXFD);
-    slowfdarr[slowfdcnt++] = fd;
-}
-
-static int
-commGetSlowFd(void)
-{
-    int whichfd, retfd;
-
-    if (!slowfdcnt)
-	return -1;
-    whichfd = squid_random() % slowfdcnt;
-    retfd = slowfdarr[whichfd];
-    slowfdarr[whichfd] = slowfdarr[--slowfdcnt];
-    return retfd;
-}
-#endif
-
-static int
-comm_check_incoming_select_handlers(int nfds, int *fds)
-{
-    int i;
-    int fd;
-    int maxfd = 0;
-    fd_set read_mask;
-    fd_set write_mask;
-    FD_ZERO(&read_mask);
-    FD_ZERO(&write_mask);
-    incoming_sockets_accepted = 0;
-    for (i = 0; i < nfds; i++) {
-	fd = fds[i];
-	if (fd_table[fd].read_handler) {
-	    FD_SET(fd, &read_mask);
-	    if (fd > maxfd)
-		maxfd = fd;
-	}
-	if (fd_table[fd].write_handler) {
-	    FD_SET(fd, &write_mask);
-	    if (fd > maxfd)
-		maxfd = fd;
-	}
-    }
-    if (maxfd++ == 0)
-	return -1;
-    getCurrentTime();
-    statCounter.syscalls.selects++;
-    if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1)
-	return incoming_sockets_accepted;
-    for (i = 0; i < nfds; i++) {
-	fd = fds[i];
-	if (FD_ISSET(fd, &read_mask)) {
-	    PF *hdl = fd_table[fd].read_handler;
-	    void *hdl_data = fd_table[fd].read_data;
-	    commUpdateReadHandler(fd, NULL, NULL);
-	    if (hdl)
-		hdl(fd, hdl_data);
-	    else
-		debug(5, 1) ("comm_select_incoming: FD %d NULL read handler\n", fd);
-	}
-	if (FD_ISSET(fd, &write_mask)) {
-	    PF *hdl = fd_table[fd].write_handler;
-	    void *hdl_data = fd_table[fd].write_data;
-	    commUpdateWriteHandler(fd, NULL, NULL);
-	    if (hdl)
-		hdl(fd, hdl_data);
-	    else
-		debug(5, 1) ("comm_select_incoming: FD %d NULL write handler\n", fd);
-	}
-    }
-    return incoming_sockets_accepted;
-}
-
-static void
-comm_select_icp_incoming(void)
-{
-    int nfds = 0;
-    int fds[2];
-    int nevents;
-    icp_io_events = 0;
-    if (theInIcpConnection >= 0)
-	fds[nfds++] = theInIcpConnection;
-    if (theInIcpConnection != theOutIcpConnection)
-	if (theOutIcpConnection >= 0)
-	    fds[nfds++] = theOutIcpConnection;
-    if (nfds == 0)
-	return;
-    nevents = comm_check_incoming_select_handlers(nfds, fds);
-    incoming_icp_interval += Config.comm_incoming.icp_average - nevents;
-    if (incoming_icp_interval < 0)
-	incoming_icp_interval = 0;
-    if (incoming_icp_interval > MAX_INCOMING_INTERVAL)
-	incoming_icp_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_ICP_MAX)
-	nevents = INCOMING_ICP_MAX;
-    statHistCount(&statCounter.comm_icp_incoming, nevents);
-}
-
-static void
-comm_select_http_incoming(void)
-{
-    int nfds = 0;
-    int fds[MAXHTTPPORTS];
-    int j;
-    int nevents;
-    http_io_events = 0;
-    for (j = 0; j < NHttpSockets; j++) {
-	if (HttpSockets[j] < 0)
-	    continue;
-	if (commDeferRead(HttpSockets[j]))
-	    continue;
-	fds[nfds++] = HttpSockets[j];
-    }
-    nevents = comm_check_incoming_select_handlers(nfds, fds);
-    incoming_http_interval += Config.comm_incoming.http_average - nevents;
-    if (incoming_http_interval < 0)
-	incoming_http_interval = 0;
-    if (incoming_http_interval > MAX_INCOMING_INTERVAL)
-	incoming_http_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_HTTP_MAX)
-	nevents = INCOMING_HTTP_MAX;
-    statHistCount(&statCounter.comm_http_incoming, nevents);
-}
-
-#define DEBUG_FDBITS 0
-/* Select on all sockets; call handlers for those that are ready. */
-int
-comm_select(int msec)
-{
-    fd_set readfds;
-    fd_set writefds;
-#if DELAY_POOLS
-    fd_set slowfds;
-#endif
-    int fd;
-    int maxfd;
-    int num;
-    int callicp = 0, callhttp = 0;
-    int calldns = 0;
-    int maxindex;
-    int k;
-    int j;
-    fd_mask *rfdsp;
-    fd_mask *wfdsp;
-    fd_mask tmask;
-    static time_t last_timeout = 0;
-    struct timeval poll_time;
-    double timeout = current_dtime + (msec / 1000.0);
-    do {
-	double start;
-	getCurrentTime();
-	start = current_dtime;
-#if DELAY_POOLS
-	FD_ZERO(&slowfds);
-#endif
-	/* Handle any fs callbacks that need doing */
-	storeDirCallback();
-	if (commCheckICPIncoming)
-	    comm_select_icp_incoming();
-	if (commCheckDNSIncoming)
-	    comm_select_dns_incoming();
-	if (commCheckHTTPIncoming)
-	    comm_select_http_incoming();
-	callicp = calldns = callhttp = 0;
-	maxfd = Biggest_FD + 1;
-	xmemcpy(&readfds, &global_readfds,
-	    howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES);
-	xmemcpy(&writefds, &global_writefds,
-	    howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES);
-	/* remove stalled FDs, and deal with pending descriptors */
-	maxindex = howmany(maxfd, FD_MASK_BITS);
-	/* Note: To simplify logics we are cheating a little on pending fds
-	 * by assuming they will be ready for either read or write to trigger
-	 * the callback.
-	 */
-	rfdsp = (fd_mask *) & readfds;
-	for (j = 0; j < maxindex; j++) {
-	    if ((tmask = rfdsp[j]) == 0)
-		continue;	/* no bits here */
-	    for (k = 0; k < FD_MASK_BITS; k++) {
-		if (!EBIT_TEST(tmask, k))
-		    continue;
-		/* Found a set bit */
-		fd = (j * FD_MASK_BITS) + k;
-		if (fd_table[fd].read_handler) {
-		    switch (commDeferRead(fd)) {
-		    case 0:
-			break;
-		    case 1:
-			FD_CLR(fd, &readfds);
-			if (!fd_table[fd].write_handler)
-			    FD_CLR(fd, &writefds);
-			break;
-#if DELAY_POOLS
-		    case -1:
-			FD_SET(fd, &slowfds);
-			break;
-#endif
-		    default:
-			fatalf("bad return value from commDeferRead(FD %d)\n", fd);
-		    }
-		}
-	    }
-	}
-	if (nreadfds + nwritefds == 0) {
-	    assert(shutting_down);
-	    return COMM_SHUTDOWN;
-	}
-	if (msec > MAX_POLL_TIME)
-	    msec = MAX_POLL_TIME;
-	for (;;) {
-	    poll_time.tv_sec = msec / 1000;
-	    poll_time.tv_usec = (msec % 1000) * 1000;
-	    statCounter.syscalls.selects++;
-	    num = select(maxfd, &readfds, &writefds, NULL, &poll_time);
-	    statCounter.select_loops++;
-	    if (num >= 0)
-		break;
-	    if (ignoreErrno(errno))
-		break;
-	    debug(5, 0) ("comm_select: select failure: %s\n",
-		xstrerror());
-	    examine_select(&readfds, &writefds);
-	    return COMM_ERROR;
-	    /* NOTREACHED */
-	}
-	if (num < 0)
-	    continue;
-	debug(5, num ? 5 : 8) ("comm_select: %d FDs ready at %d\n",
-	    num, (int) squid_curtime);
-	statHistCount(&statCounter.select_fds_hist, num);
-	/* Check lifetime and timeout handlers ONCE each second.
-	 * Replaces brain-dead check every time through the loop! */
-	if (squid_curtime > last_timeout) {
-	    last_timeout = squid_curtime;
-	    checkTimeouts();
-	}
-	if (num == 0)
-	    continue;
-	/* Scan return fd masks for ready descriptors */
-	rfdsp = (fd_mask *) & readfds;
-	wfdsp = (fd_mask *) & writefds;
-	maxindex = howmany(maxfd, FD_MASK_BITS);
-	for (j = 0; j < maxindex; j++) {
-	    if ((tmask = (rfdsp[j] | wfdsp[j])) == 0)
-		continue;	/* no bits here */
-	    for (k = 0; k < FD_MASK_BITS; k++) {
-		fde *F;
-		if (tmask == 0)
-		    break;	/* no more bits left */
-		if (!EBIT_TEST(tmask, k))
-		    continue;
-		/* Found a set bit */
-		fd = (j * FD_MASK_BITS) + k;
-		EBIT_CLR(tmask, k);	/* this will be done */
-		if (fdIsIcp(fd)) {
-		    callicp = 1;
-		    continue;
-		}
-		if (fdIsDns(fd)) {
-		    calldns = 1;
-		    continue;
-		}
-		if (fdIsHttp(fd)) {
-		    callhttp = 1;
-		    continue;
-		}
-		F = &fd_table[fd];
-		debug(5, 6) ("comm_select: FD %d ready for %s%s\n", fd,
-		    FD_ISSET(fd, &readfds) ? "read" : "",
-		    FD_ISSET(fd, &writefds) ? "write" : "");
-		if (F->read_handler) {
-		    int do_read = 0;
-		    switch (F->read_pending) {
-		    case COMM_PENDING_NORMAL:
-		    case COMM_PENDING_WANTS_READ:
-			do_read = FD_ISSET(fd, &readfds);
-			break;
-		    case COMM_PENDING_WANTS_WRITE:
-			do_read = FD_ISSET(fd, &writefds);
-			break;
-		    case COMM_PENDING_NOW:
-			do_read = 1;
-			break;
-		    }
-#if DELAY_POOLS
-		    if (do_read && FD_ISSET(fd, &slowfds))
-			commAddSlowFd(fd);
-		    else
-#endif
-		    if (do_read) {
-			PF *hdl = F->read_handler;
-			void *hdl_data = F->read_data;
-			debug(5, 6) ("comm_select: FD %d calling read_handler %p(%p)\n", fd, hdl, hdl_data);
-			commUpdateReadHandler(fd, NULL, NULL);
-			hdl(fd, hdl_data);
-			statCounter.select_fds++;
-			if (commCheckICPIncoming)
-			    comm_select_icp_incoming();
-			if (commCheckDNSIncoming)
-			    comm_select_dns_incoming();
-			if (commCheckHTTPIncoming)
-			    comm_select_http_incoming();
-		    }
-		}
-		if (F->write_handler) {
-		    int do_write = 0;
-		    switch (F->write_pending) {
-		    case COMM_PENDING_WANTS_READ:
-			do_write = FD_ISSET(fd, &readfds);
-			break;
-		    case COMM_PENDING_NORMAL:
-		    case COMM_PENDING_WANTS_WRITE:
-			do_write = FD_ISSET(fd, &writefds);
-			break;
-		    case COMM_PENDING_NOW:
-			do_write = 1;
-			break;
-		    }
-		    if (do_write) {
-			PF *hdl = F->write_handler;
-			void *hdl_data = F->write_data;
-			debug(5, 6) ("comm_select: FD %d calling write_handler %p(%p)\n", fd, hdl, hdl_data);
-			commUpdateWriteHandler(fd, NULL, NULL);
-			hdl(fd, hdl_data);
-			statCounter.select_fds++;
-			if (commCheckICPIncoming)
-			    comm_select_icp_incoming();
-			if (commCheckDNSIncoming)
-			    comm_select_dns_incoming();
-			if (commCheckHTTPIncoming)
-			    comm_select_http_incoming();
-		    }
-		}
-	    }
-	}
-	if (callicp)
-	    comm_select_icp_incoming();
-	if (calldns)
-	    comm_select_dns_incoming();
-	if (callhttp)
-	    comm_select_http_incoming();
-#if DELAY_POOLS
-	while ((fd = commGetSlowFd()) != -1) {
-	    fde *F = &fd_table[fd];
-	    PF *hdl = F->read_handler;
-	    void *hdl_data = F->read_data;
-	    debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd);
-	    if (hdl) {
-		commUpdateReadHandler(fd, NULL, NULL);
-		hdl(fd, hdl_data);
-		statCounter.select_fds++;
-		if (commCheckICPIncoming)
-		    comm_select_icp_incoming();
-		if (commCheckDNSIncoming)
-		    comm_select_dns_incoming();
-		if (commCheckHTTPIncoming)
-		    comm_select_http_incoming();
-	    }
-	}
-#endif
-	getCurrentTime();
-	statCounter.select_time += (current_dtime - start);
-	return COMM_OK;
-    }
-    while (timeout > current_dtime);
-    debug(5, 8) ("comm_select: time out: %d\n", (int) squid_curtime);
-    return COMM_TIMEOUT;
-}
-
 static void
-comm_select_dns_incoming(void)
-{
-    int nfds = 0;
-    int fds[2];
-    int nevents;
-    dns_io_events = 0;
-    if (DnsSocket < 0)
-	return;
-    fds[nfds++] = DnsSocket;
-    nevents = comm_check_incoming_select_handlers(nfds, fds);
-    if (nevents < 0)
-	return;
-    incoming_dns_interval += Config.comm_incoming.dns_average - nevents;
-    if (incoming_dns_interval < Config.comm_incoming.dns_min_poll)
-	incoming_dns_interval = Config.comm_incoming.dns_min_poll;
-    if (incoming_dns_interval > MAX_INCOMING_INTERVAL)
-	incoming_dns_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_DNS_MAX)
-	nevents = INCOMING_DNS_MAX;
-    statHistCount(&statCounter.comm_dns_incoming, nevents);
-}
-
-void
-comm_select_init(void)
+do_select_init()
 {
-    zero_tv.tv_sec = 0;
-    zero_tv.tv_usec = 0;
-    cachemgrRegister("comm_incoming",
-	"comm_incoming() stats",
-	commIncomingStats, 0, 1);
-    FD_ZERO(&global_readfds);
-    FD_ZERO(&global_writefds);
+    global_readfds = xcalloc(FD_MASK_BYTES, howmany(Squid_MaxFD, FD_MASK_BITS));
+    global_writefds = xcalloc(FD_MASK_BYTES, howmany(Squid_MaxFD, FD_MASK_BITS));
+    current_readfds = xcalloc(FD_MASK_BYTES, howmany(Squid_MaxFD, FD_MASK_BITS));
+    current_writefds = xcalloc(FD_MASK_BYTES, howmany(Squid_MaxFD, FD_MASK_BITS));
+    current_errfds = xcalloc(FD_MASK_BYTES, howmany(Squid_MaxFD, FD_MASK_BITS));
     nreadfds = nwritefds = 0;
 }
 
@@ -574,9 +77,14 @@
     debug(5, 1) ("Using select for the IO loop\n");
 }
 
-void
-comm_select_shutdown(void)
+static void
+do_select_shutdown()
 {
+    safe_free(global_readfds);
+    safe_free(global_writefds);
+    safe_free(current_readfds);
+    safe_free(current_writefds);
+    safe_free(current_errfds);
 }
 
 void
@@ -585,165 +93,78 @@
     storeAppendPrintf(sentry, "\tIO loop method:                     select\n");
 }
 
-/*
- * examine_select - debug routine.
- *
- * I spend the day chasing this core dump that occurs when both the client
- * and the server side of a cache fetch simultaneoulsy abort the
- * connection.  While I haven't really studied the code to figure out how
- * it happens, the snippet below may prevent the cache from exitting:
- * 
- * Call this from where the select loop fails.
- */
-static int
-examine_select(fd_set * readfds, fd_set * writefds)
-{
-    int fd = 0;
-    fd_set read_x;
-    fd_set write_x;
-    struct timeval tv;
-    close_handler *ch = NULL;
-    fde *F = NULL;
-    struct stat sb;
-    debug(5, 0) ("examine_select: Examining open file descriptors...\n");
-    for (fd = 0; fd < Squid_MaxFD; fd++) {
-	FD_ZERO(&read_x);
-	FD_ZERO(&write_x);
-	tv.tv_sec = tv.tv_usec = 0;
-	if (FD_ISSET(fd, readfds))
-	    FD_SET(fd, &read_x);
-	else if (FD_ISSET(fd, writefds))
-	    FD_SET(fd, &write_x);
-	else
-	    continue;
-	statCounter.syscalls.selects++;
-	errno = 0;
-	if (!fstat(fd, &sb)) {
-	    debug(5, 5) ("FD %d is valid.\n", fd);
-	    continue;
-	}
-	F = &fd_table[fd];
-	debug(5, 0) ("FD %d: %s\n", fd, xstrerror());
-	debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd);
-	debug(5, 0) ("FD %d is a %s called '%s'\n",
-	    fd,
-	    fdTypeStr[F->type],
-	    F->desc);
-	debug(5, 0) ("tmout:%p read:%p write:%p\n",
-	    F->timeout_handler,
-	    F->read_handler,
-	    F->write_handler);
-	for (ch = F->close_handler; ch; ch = ch->next)
-	    debug(5, 0) (" close handler: %p\n", ch->handler);
-	if (F->close_handler) {
-	    commCallCloseHandlers(fd);
-	} else if (F->timeout_handler) {
-	    debug(5, 0) ("examine_select: Calling Timeout Handler\n");
-	    F->timeout_handler(fd, F->timeout_data);
-	}
-	F->close_handler = NULL;
-	F->timeout_handler = NULL;
-	F->read_handler = NULL;
-	F->write_handler = NULL;
-	FD_CLR(fd, readfds);
-	FD_CLR(fd, writefds);
-    }
-    return 0;
-}
-
-static void
-commIncomingStats(StoreEntry * sentry)
-{
-    StatCounters *f = &statCounter;
-    storeAppendPrintf(sentry, "Current incoming_icp_interval: %d\n",
-	incoming_icp_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "Current incoming_dns_interval: %d\n",
-	incoming_dns_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "Current incoming_http_interval: %d\n",
-	incoming_http_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "\n");
-    storeAppendPrintf(sentry, "Histogram of events per incoming socket type\n");
-    storeAppendPrintf(sentry, "ICP Messages handled per comm_select_icp_incoming() call:\n");
-    statHistDump(&f->comm_icp_incoming, sentry, statHistIntDumper);
-    storeAppendPrintf(sentry, "DNS Messages handled per comm_select_dns_incoming() call:\n");
-    statHistDump(&f->comm_dns_incoming, sentry, statHistIntDumper);
-    storeAppendPrintf(sentry, "HTTP Messages handled per comm_select_http_incoming() call:\n");
-    statHistDump(&f->comm_http_incoming, sentry, statHistIntDumper);
-}
-
 void
 commSetEvents(int fd, int need_read, int need_write)
 {
-    if (need_read && !FD_ISSET(fd, &global_readfds)) {
-	FD_SET(fd, &global_readfds);
+    if (need_read && !FD_ISSET(fd, global_readfds)) {
+	FD_SET(fd, global_readfds);
 	nreadfds++;
-    } else if (!need_read && FD_ISSET(fd, &global_readfds)) {
-	FD_CLR(fd, &global_readfds);
+    } else if (!need_read && FD_ISSET(fd, global_readfds)) {
+	FD_CLR(fd, global_readfds);
 	nreadfds--;
     }
-    if (need_write && !FD_ISSET(fd, &global_writefds)) {
-	FD_SET(fd, &global_writefds);
+    if (need_write && !FD_ISSET(fd, global_writefds)) {
+	FD_SET(fd, global_writefds);
 	nwritefds++;
-    } else if (!need_write && FD_ISSET(fd, &global_writefds)) {
-	FD_CLR(fd, &global_writefds);
+    } else if (!need_write && FD_ISSET(fd, global_writefds)) {
+	FD_CLR(fd, global_writefds);
 	nwritefds--;
     }
 }
 
 static int
-commDeferRead(int fd)
+do_comm_select(int msec)
 {
-    fde *F = &fd_table[fd];
-    if (F->defer_check == NULL)
-	return 0;
-    return F->defer_check(fd, F->defer_data);
-}
-
-static void
-checkTimeouts(void)
-{
-    int fd;
-    fde *F = NULL;
-    PF *callback;
-    for (fd = 0; fd <= Biggest_FD; fd++) {
-	F = &fd_table[fd];
-	if (!F->flags.open)
-	    continue;
-	if (F->timeout == 0)
-	    continue;
-	if (F->timeout > squid_curtime)
-	    continue;
-	debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
-	if (F->timeout_handler) {
-	    debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
-	    callback = F->timeout_handler;
-	    F->timeout_handler = NULL;
-	    callback(fd, F->timeout_data);
-	} else {
-	    debug(5, 5) ("checkTimeouts: FD %d: Forcing comm_close()\n", fd);
-	    comm_close(fd);
-	}
-    }
-}
+    int num;
+    struct timeval tv;
+    fd_mask *rfdsp = (fd_mask *) current_readfds;
+    fd_mask *wfdsp = (fd_mask *) current_writefds;
+    fd_mask *efdsp = (fd_mask *) current_errfds;
+    int maxindex = howmany(Biggest_FD + 1, FD_MASK_BITS);
+    int fd_set_size = maxindex * FD_MASK_BYTES;
+    int j;
 
+    if (nreadfds + nwritefds == 0) {
+	assert(shutting_down);
+	return COMM_SHUTDOWN;
+    }
+    memcpy(current_readfds, global_readfds, fd_set_size);
+    memcpy(current_writefds, global_writefds, fd_set_size);
+    memcpy(current_errfds, global_writefds, fd_set_size);
+    tv.tv_sec = msec / 1000;
+    tv.tv_usec = (msec % 1000) * 1000;
+    statCounter.syscalls.selects++;
+    num = select(Biggest_FD + 1, current_readfds, current_writefds, current_errfds, &tv);
+    statCounter.select_loops++;
 
-/* Called by async-io or diskd to speed up the polling */
-void
-comm_quick_poll_required(void)
-{
-    MAX_POLL_TIME = 10;
-}
+    if (num < 0) {
+	getCurrentTime();
+	if (ignoreErrno(errno))
+	    return COMM_OK;
 
-/* Defer reads from this fd */
-void
-commDeferFD(int fd)
-{
-    /* Not implemented */
-}
+	debug(5, 1) ("comm_select: select failure: %s\n", xstrerror());
+	return COMM_ERROR;
+    }
+    statHistCount(&statCounter.select_fds_hist, num);
 
-/* Resume reading from the given fd */
-void
-commResumeFD(int fd)
-{
-    /* Not implemented */
+    if (num == 0)
+	return COMM_TIMEOUT;
+
+    for (j = 0; j < maxindex; j++) {
+	int k;
+	fd_mask tmask = rfdsp[j] | wfdsp[j] | efdsp[j];
+	for (k = 0; tmask && k < FD_MASK_BITS; k++) {
+	    int fd;
+	    int read_event, write_event;
+	    if (!EBIT_TEST(tmask, k))
+		continue;
+	    /* Found a set bit */
+	    fd = (j * FD_MASK_BITS) + k;
+	    read_event = FD_ISSET(fd, current_readfds);
+	    write_event = FD_ISSET(fd, current_writefds) | FD_ISSET(fd, current_errfds);
+	    EBIT_CLR(tmask, k);	/* this will be done */
+	    comm_call_handlers(fd, read_event, write_event);
+	}
+    }
+    return COMM_OK;
 }
diff -ruN squid-2.6.STABLE4/src/comm_select_simple.c squid-2.6.STABLE5/src/comm_select_simple.c
--- squid-2.6.STABLE4/src/comm_select_simple.c	Wed Dec 31 17:00:00 1969
+++ squid-2.6.STABLE5/src/comm_select_simple.c	Fri Nov  3 05:30:40 2006
@@ -0,0 +1,138 @@
+
+/*
+ * $Id: comm_select_simple.c,v 1.2 2006/11/03 12:30:40 hno Exp $
+ *
+ * DEBUG: section 5     Socket Functions
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "squid.h"
+#include "comm_generic.c"
+
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+static fd_set global_readfds;
+static fd_set global_writefds;
+static int nreadfds;
+static int nwritefds;
+
+static void
+do_select_init()
+{
+    if (Squid_MaxFD > FD_SETSIZE)
+	Squid_MaxFD = FD_SETSIZE;
+    nreadfds = nwritefds = 0;
+}
+
+void
+comm_select_postinit()
+{
+    debug(5, 1) ("Using select in POSIX mode for the IO loop\n");
+}
+
+static void
+do_select_shutdown()
+{
+}
+
+void
+comm_select_status(StoreEntry * sentry)
+{
+    storeAppendPrintf(sentry, "\tIO loop method:                     select in POSIX mode\n");
+}
+
+void
+commSetEvents(int fd, int need_read, int need_write)
+{
+    if (need_read && !FD_ISSET(fd, &global_readfds)) {
+	FD_SET(fd, &global_readfds);
+	nreadfds++;
+    } else if (!need_read && FD_ISSET(fd, &global_readfds)) {
+	FD_CLR(fd, &global_readfds);
+	nreadfds--;
+    }
+    if (need_write && !FD_ISSET(fd, &global_writefds)) {
+	FD_SET(fd, &global_writefds);
+	nwritefds++;
+    } else if (!need_write && FD_ISSET(fd, &global_writefds)) {
+	FD_CLR(fd, &global_writefds);
+	nwritefds--;
+    }
+}
+
+static int
+do_comm_select(int msec)
+{
+    int num;
+    struct timeval tv;
+    fd_set readfds;
+    fd_set writefds;
+    fd_set errfds;
+    int fd;
+
+    if (nreadfds + nwritefds == 0) {
+	assert(shutting_down);
+	return COMM_SHUTDOWN;
+    }
+    memcpy(&readfds, &global_readfds, sizeof(fd_set));
+    memcpy(&writefds, &global_writefds, sizeof(fd_set));
+    memcpy(&errfds, &global_writefds, sizeof(fd_set));
+    tv.tv_sec = msec / 1000;
+    tv.tv_usec = (msec % 1000) * 1000;
+    statCounter.syscalls.selects++;
+    num = select(Biggest_FD + 1, &readfds, &writefds, &errfds, &tv);
+    statCounter.select_loops++;
+
+    if (num < 0) {
+	getCurrentTime();
+	if (ignoreErrno(errno))
+	    return COMM_OK;
+
+	debug(5, 1) ("comm_select: select failure: %s\n", xstrerror());
+	return COMM_ERROR;
+    }
+    statHistCount(&statCounter.select_fds_hist, num);
+
+    if (num == 0)
+	return COMM_TIMEOUT;
+
+    for (fd = 0; fd <= Biggest_FD; fd++) {
+	int read_event = FD_ISSET(fd, &readfds);
+	int write_event = FD_ISSET(fd, &writefds) || FD_ISSET(fd, &errfds);
+	if (read_event || write_event)
+	    comm_call_handlers(fd, read_event, write_event);
+    }
+    return COMM_OK;
+}
diff -ruN squid-2.6.STABLE4/src/comm_select_win32.c squid-2.6.STABLE5/src/comm_select_win32.c
--- squid-2.6.STABLE4/src/comm_select_win32.c	Tue Aug 15 14:28:20 2006
+++ squid-2.6.STABLE5/src/comm_select_win32.c	Sat Oct 28 11:08:16 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select_win32.c,v 1.2 2006/08/15 20:28:20 serassio Exp $
+ * $Id: comm_select_win32.c,v 1.6 2006/10/28 17:08:16 serassio Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -33,576 +33,23 @@
  */
 
 #include "squid.h"
+#include "comm_generic.c"
 
-static int MAX_POLL_TIME = 1000;	/* see also comm_quick_poll_required() */
+#if HAVE_WINSOCK2_H
+#include <Winsock2.h>
+#endif
 
-/* STATIC */
-static int examine_select(fd_set *, fd_set *);
-static int fdIsHttp(int fd);
-static int fdIsIcp(int fd);
-static int fdIsDns(int fd);
-static int commDeferRead(int fd);
-static void checkTimeouts(void);
-static OBJH commIncomingStats;
-static int comm_check_incoming_select_handlers(int nfds, int *fds);
-static void comm_select_dns_incoming(void);
 
-static struct timeval zero_tv;
 static fd_set global_readfds;
 static fd_set global_writefds;
 static int nreadfds;
 static int nwritefds;
 
-/*
- * Automatic tuning for incoming requests:
- *
- * INCOMING sockets are the ICP and HTTP ports.  We need to check these
- * fairly regularly, but how often?  When the load increases, we
- * want to check the incoming sockets more often.  If we have a lot
- * of incoming ICP, then we need to check these sockets more than
- * if we just have HTTP.
- *
- * The variables 'incoming_icp_interval' and 'incoming_http_interval' 
- * determine how many normal I/O events to process before checking
- * incoming sockets again.  Note we store the incoming_interval
- * multipled by a factor of (2^INCOMING_FACTOR) to have some
- * pseudo-floating point precision.
- *
- * The variable 'icp_io_events' and 'http_io_events' counts how many normal
- * I/O events have been processed since the last check on the incoming
- * sockets.  When io_events > incoming_interval, its time to check incoming
- * sockets.
- *
- * Every time we check incoming sockets, we count how many new messages
- * or connections were processed.  This is used to adjust the
- * incoming_interval for the next iteration.  The new incoming_interval
- * is calculated as the current incoming_interval plus what we would
- * like to see as an average number of events minus the number of
- * events just processed.
- *
- *  incoming_interval = incoming_interval + target_average - number_of_events_processed
- *
- * There are separate incoming_interval counters for both HTTP and ICP events
- * 
- * You can see the current values of the incoming_interval's, as well as
- * a histogram of 'incoming_events' by asking the cache manager
- * for 'comm_incoming', e.g.:
- *
- *      % ./client mgr:comm_incoming
- *
- * Caveats:
- *
- *      - We have MAX_INCOMING_INTEGER as a magic upper limit on
- *        incoming_interval for both types of sockets.  At the
- *        largest value the cache will effectively be idling.
- *
- *      - The higher the INCOMING_FACTOR, the slower the algorithm will
- *        respond to load spikes/increases/decreases in demand. A value
- *        between 3 and 8 is recommended.
- */
-
-#define MAX_INCOMING_INTEGER 256
-#define INCOMING_FACTOR 5
-#define MAX_INCOMING_INTERVAL (MAX_INCOMING_INTEGER << INCOMING_FACTOR)
-static int icp_io_events = 0;
-static int dns_io_events = 0;
-static int http_io_events = 0;
-static int incoming_icp_interval = 16 << INCOMING_FACTOR;
-static int incoming_dns_interval = 16 << INCOMING_FACTOR;
-static int incoming_http_interval = 16 << INCOMING_FACTOR;
-#define commCheckICPIncoming (++icp_io_events > (incoming_icp_interval>> INCOMING_FACTOR))
-#define commCheckDNSIncoming (++dns_io_events > (incoming_dns_interval>> INCOMING_FACTOR))
-#define commCheckHTTPIncoming (++http_io_events > (incoming_http_interval>> INCOMING_FACTOR))
-
-static int
-fdIsIcp(int fd)
-{
-    if (fd == theInIcpConnection)
-	return 1;
-    if (fd == theOutIcpConnection)
-	return 1;
-    return 0;
-}
-
-static int
-fdIsDns(int fd)
-{
-    if (fd == DnsSocket)
-	return 1;
-    return 0;
-}
-
-static int
-fdIsHttp(int fd)
-{
-    int j;
-    for (j = 0; j < NHttpSockets; j++) {
-	if (fd == HttpSockets[j])
-	    return 1;
-    }
-    return 0;
-}
-
-#if DELAY_POOLS
-static int slowfdcnt = 0;
-static int slowfdarr[SQUID_MAXFD];
-
-static void
-commAddSlowFd(int fd)
-{
-    assert(slowfdcnt < SQUID_MAXFD);
-    slowfdarr[slowfdcnt++] = fd;
-}
-
-static int
-commGetSlowFd(void)
-{
-    int whichfd, retfd;
-
-    if (!slowfdcnt)
-	return -1;
-    whichfd = squid_random() % slowfdcnt;
-    retfd = slowfdarr[whichfd];
-    slowfdarr[whichfd] = slowfdarr[--slowfdcnt];
-    return retfd;
-}
-#endif
-
-static int
-comm_check_incoming_select_handlers(int nfds, int *fds)
-{
-    int i;
-    int fd;
-    int maxfd = 0;
-    fd_set read_mask;
-    fd_set write_mask;
-    fd_set errfds;
-    FD_ZERO(&errfds);
-    FD_ZERO(&read_mask);
-    FD_ZERO(&write_mask);
-    incoming_sockets_accepted = 0;
-    for (i = 0; i < nfds; i++) {
-	fd = fds[i];
-	if (fd_table[fd].read_handler) {
-	    FD_SET(fd, &read_mask);
-	    if (fd > maxfd)
-		maxfd = fd;
-	}
-	if (fd_table[fd].write_handler) {
-	    FD_SET(fd, &write_mask);
-	    if (fd > maxfd)
-		maxfd = fd;
-	}
-    }
-    if (maxfd++ == 0)
-	return -1;
-    getCurrentTime();
-    statCounter.syscalls.selects++;
-    if (select(maxfd, &read_mask, &write_mask, &errfds, &zero_tv) < 1)
-	return incoming_sockets_accepted;
-    for (i = 0; i < nfds; i++) {
-	fd = fds[i];
-	if (__WSAFDIsSet(fd_table[fd].win32.handle, &read_mask)) {
-	    PF *hdl = fd_table[fd].read_handler;
-	    void *hdl_data = fd_table[fd].read_data;
-	    commUpdateReadHandler(fd, NULL, NULL);
-	    if (hdl)
-		hdl(fd, hdl_data);
-	    else
-		debug(5, 1) ("comm_select_incoming: FD %d NULL read handler\n", fd);
-	}
-	if (__WSAFDIsSet(fd_table[fd].win32.handle, &write_mask)) {
-	    PF *hdl = fd_table[fd].write_handler;
-	    void *hdl_data = fd_table[fd].write_data;
-	    commUpdateWriteHandler(fd, NULL, NULL);
-	    if (hdl)
-		hdl(fd, hdl_data);
-	    else
-		debug(5, 1) ("comm_select_incoming: FD %d NULL write handler\n", fd);
-	}
-    }
-    return incoming_sockets_accepted;
-}
-
-static void
-comm_select_icp_incoming(void)
-{
-    int nfds = 0;
-    int fds[2];
-    int nevents;
-    icp_io_events = 0;
-    if (theInIcpConnection >= 0)
-	fds[nfds++] = theInIcpConnection;
-    if (theInIcpConnection != theOutIcpConnection)
-	if (theOutIcpConnection >= 0)
-	    fds[nfds++] = theOutIcpConnection;
-    if (nfds == 0)
-	return;
-    nevents = comm_check_incoming_select_handlers(nfds, fds);
-    incoming_icp_interval += Config.comm_incoming.icp_average - nevents;
-    if (incoming_icp_interval < 0)
-	incoming_icp_interval = 0;
-    if (incoming_icp_interval > MAX_INCOMING_INTERVAL)
-	incoming_icp_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_ICP_MAX)
-	nevents = INCOMING_ICP_MAX;
-    statHistCount(&statCounter.comm_icp_incoming, nevents);
-}
-
-static void
-comm_select_http_incoming(void)
-{
-    int nfds = 0;
-    int fds[MAXHTTPPORTS];
-    int j;
-    int nevents;
-    http_io_events = 0;
-    for (j = 0; j < NHttpSockets; j++) {
-	if (HttpSockets[j] < 0)
-	    continue;
-	if (commDeferRead(HttpSockets[j]))
-	    continue;
-	fds[nfds++] = HttpSockets[j];
-    }
-    nevents = comm_check_incoming_select_handlers(nfds, fds);
-    incoming_http_interval += Config.comm_incoming.http_average - nevents;
-    if (incoming_http_interval < 0)
-	incoming_http_interval = 0;
-    if (incoming_http_interval > MAX_INCOMING_INTERVAL)
-	incoming_http_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_HTTP_MAX)
-	nevents = INCOMING_HTTP_MAX;
-    statHistCount(&statCounter.comm_http_incoming, nevents);
-}
-
-/* Select on all sockets; call handlers for those that are ready. */
-int
-comm_select(int msec)
-{
-    fd_set readfds;
-    fd_set writefds;
-#if DELAY_POOLS
-    fd_set slowfds;
-#endif
-    int fd;
-    int maxfd;
-    int num;
-    int callicp = 0, callhttp = 0;
-    int calldns = 0;
-    register int j;
-    static time_t last_timeout = 0;
-    struct timeval poll_time;
-    double timeout = current_dtime + (msec / 1000.0);
-    int no_bits;
-    fd_set errfds;
-    FD_ZERO(&errfds);
-    do {
-	double start;
-	getCurrentTime();
-	start = current_dtime;
-#if DELAY_POOLS
-	FD_ZERO(&slowfds);
-#endif
-	/* Handle any fs callbacks that need doing */
-	storeDirCallback();
-	if (commCheckICPIncoming)
-	    comm_select_icp_incoming();
-	if (commCheckDNSIncoming)
-	    comm_select_dns_incoming();
-	if (commCheckHTTPIncoming)
-	    comm_select_http_incoming();
-	callicp = calldns = callhttp = 0;
-	maxfd = Biggest_FD + 1;
-	xmemcpy(&readfds, &global_readfds, sizeof(global_readfds));
-	xmemcpy(&writefds, &global_writefds, sizeof(global_writefds));
-	xmemcpy(&errfds, &global_writefds, sizeof(global_writefds));
-	/* remove stalled FDs, and deal with pending descriptors */
-	for (j = 0; j < (int) readfds.fd_count; j++) {
-	    register int readfds_handle = readfds.fd_array[j];
-	    no_bits = 1;
-	    for (fd = Biggest_FD; fd; fd--) {
-		if (fd_table[fd].win32.handle == readfds_handle) {
-		    if (fd_table[fd].flags.open) {
-			no_bits = 0;
-			break;
-		    }
-		}
-	    }
-	    if (no_bits)
-		continue;
-	    if (fd_table[fd].read_handler) {
-		switch (commDeferRead(fd)) {
-		case 0:
-		    break;
-		case 1:
-		    FD_CLR(fd, &readfds);
-		    /* FD_CLR() decrements readfds.fd_count, so we must */
-		    /*   decrement too the counter j                      */
-		    j--;
-		    if (!fd_table[fd].write_handler)
-			FD_CLR(fd, &writefds);
-		    break;
-#if DELAY_POOLS
-		case -1:
-		    FD_SET(fd, &slowfds);
-		    break;
-#endif
-		default:
-		    fatalf("bad return value from commDeferRead(FD %d)\n", fd);
-		}
-	    }
-	}
-	if (nreadfds + nwritefds == 0) {
-	    assert(shutting_down);
-	    return COMM_SHUTDOWN;
-	}
-	if (msec > MAX_POLL_TIME)
-	    msec = MAX_POLL_TIME;
-	for (;;) {
-	    poll_time.tv_sec = msec / 1000;
-	    poll_time.tv_usec = (msec % 1000) * 1000;
-	    statCounter.syscalls.selects++;
-	    num = select(maxfd, &readfds, &writefds, &errfds, &poll_time);
-	    statCounter.select_loops++;
-	    if (num >= 0)
-		break;
-	    if (ignoreErrno(errno))
-		break;
-	    debug(5, 0) ("comm_select: select failure: %s\n",
-		xstrerror());
-	    examine_select(&readfds, &writefds);
-	    return COMM_ERROR;
-	    /* NOTREACHED */
-	}
-	if (num < 0)
-	    continue;
-	debug(5, num ? 5 : 8) ("comm_select: %d FDs ready at %d\n",
-	    num, (int) squid_curtime);
-	statHistCount(&statCounter.select_fds_hist, num);
-	/* Check lifetime and timeout handlers ONCE each second.
-	 * Replaces brain-dead check every time through the loop! */
-	if (squid_curtime > last_timeout) {
-	    last_timeout = squid_curtime;
-	    checkTimeouts();
-	}
-	if (num == 0)
-	    continue;
-	/* Scan return fd masks for ready for read descriptors */
-	assert(readfds.fd_count <= (unsigned int) Biggest_FD);
-	for (j = 0; j < (int) readfds.fd_count; j++) {
-	    register int readfds_handle = readfds.fd_array[j];
-	    register int osfhandle;
-	    fde *F;
-	    no_bits = 1;
-	    for (fd = Biggest_FD; fd; fd--) {
-		osfhandle = fd_table[fd].win32.handle;
-		if (osfhandle == readfds_handle) {
-		    if (fd_table[fd].flags.open) {
-			no_bits = 0;
-			break;
-		    }
-		}
-	    }
-	    if (no_bits)
-		continue;
-	    if (fdIsIcp(fd)) {
-		callicp = 1;
-		continue;
-	    }
-	    if (fdIsDns(fd)) {
-		calldns = 1;
-		continue;
-	    }
-	    if (fdIsHttp(fd)) {
-		callhttp = 1;
-		continue;
-	    }
-	    F = &fd_table[fd];
-	    debug(5, 6) ("comm_select: FD %d ready for read\n", fd);
-	    if (F->read_handler) {
-		int do_read = 0;
-		switch (F->read_pending) {
-		case COMM_PENDING_NORMAL:
-		case COMM_PENDING_WANTS_READ:
-		    do_read = 1;
-		    break;
-		case COMM_PENDING_WANTS_WRITE:
-		    do_read = __WSAFDIsSet(fd_table[fd].win32.handle, &writefds);
-		    break;
-		case COMM_PENDING_NOW:
-		    do_read = 1;
-		    break;
-		}
-#if DELAY_POOLS
-		if (do_read && __WSAFDIsSet(fd_table[fd].win32.handle, &slowfds))
-		    commAddSlowFd(fd);
-		else
-#endif
-		if (do_read) {
-		    PF *hdl = F->read_handler;
-		    void *hdl_data = F->read_data;
-		    debug(5, 6) ("comm_select: FD %d calling read_handler %p(%p)\n", fd, hdl, hdl_data);
-		    commUpdateReadHandler(fd, NULL, NULL);
-		    hdl(fd, hdl_data);
-		    statCounter.select_fds++;
-		    if (commCheckICPIncoming)
-			comm_select_icp_incoming();
-		    if (commCheckDNSIncoming)
-			comm_select_dns_incoming();
-		    if (commCheckHTTPIncoming)
-			comm_select_http_incoming();
-		}
-	    }
-	}
-	/* Scan return fd masks for error on connect() descriptors */
-	assert(errfds.fd_count <= (unsigned int) Biggest_FD);
-	for (j = 0; j < (int) errfds.fd_count; j++) {
-	    register int errfds_handle = errfds.fd_array[j];
-	    for (fd = Biggest_FD; fd; fd--) {
-		if (fd_table[fd].win32.handle == errfds_handle) {
-		    if (fd_table[fd].flags.open) {
-			fde *F = &fd_table[fd];
-			if (F->write_handler) {
-			    PF *hdl = F->write_handler;
-			    void *hdl_data = F->write_data;
-			    commUpdateWriteHandler(fd, NULL, NULL);
-			    hdl(fd, hdl_data);
-			    statCounter.select_fds++;
-			}
-		    }
-		    break;
-		}
-	    }
-	}
-	/* Scan return fd masks for ready for write descriptors */
-	assert(writefds.fd_count <= (unsigned int) Biggest_FD);
-	for (j = 0; j < (int) writefds.fd_count; j++) {
-	    register int writefds_handle = writefds.fd_array[j];
-	    register int osfhandle;
-	    fde *F;
-	    no_bits = 1;
-	    for (fd = Biggest_FD; fd; fd--) {
-		osfhandle = fd_table[fd].win32.handle;
-		if (osfhandle == writefds_handle) {
-		    if (fd_table[fd].flags.open) {
-			no_bits = 0;
-			break;
-		    }
-		}
-	    }
-	    if (no_bits)
-		continue;
-	    if (fdIsIcp(fd)) {
-		callicp = 1;
-		continue;
-	    }
-	    if (fdIsDns(fd)) {
-		calldns = 1;
-		continue;
-	    }
-	    if (fdIsHttp(fd)) {
-		callhttp = 1;
-		continue;
-	    }
-	    F = &fd_table[fd];
-	    debug(5, 6) ("comm_select: FD %d ready for write\n", fd);
-	    if (F->write_handler) {
-		int do_write = 0;
-		switch (F->write_pending) {
-		case COMM_PENDING_WANTS_READ:
-		    do_write = __WSAFDIsSet(fd_table[fd].win32.handle, &readfds);
-		    break;
-		case COMM_PENDING_NORMAL:
-		case COMM_PENDING_WANTS_WRITE:
-		    do_write = 1;
-		    break;
-		case COMM_PENDING_NOW:
-		    do_write = 1;
-		    break;
-		}
-		if (do_write) {
-		    PF *hdl = F->write_handler;
-		    void *hdl_data = F->write_data;
-		    debug(5, 6) ("comm_select: FD %d calling write_handler %p(%p)\n", fd, hdl, hdl_data);
-		    commUpdateWriteHandler(fd, NULL, NULL);
-		    hdl(fd, hdl_data);
-		    statCounter.select_fds++;
-		    if (commCheckICPIncoming)
-			comm_select_icp_incoming();
-		    if (commCheckDNSIncoming)
-			comm_select_dns_incoming();
-		    if (commCheckHTTPIncoming)
-			comm_select_http_incoming();
-		}
-	    }
-	}
-	if (callicp)
-	    comm_select_icp_incoming();
-	if (calldns)
-	    comm_select_dns_incoming();
-	if (callhttp)
-	    comm_select_http_incoming();
-#if DELAY_POOLS
-	while ((fd = commGetSlowFd()) != -1) {
-	    fde *F = &fd_table[fd];
-	    PF *hdl = F->read_handler;
-	    void *hdl_data = F->read_data;
-	    debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd);
-	    if (hdl) {
-		commUpdateReadHandler(fd, NULL, NULL);
-		hdl(fd, hdl_data);
-		statCounter.select_fds++;
-		if (commCheckICPIncoming)
-		    comm_select_icp_incoming();
-		if (commCheckDNSIncoming)
-		    comm_select_dns_incoming();
-		if (commCheckHTTPIncoming)
-		    comm_select_http_incoming();
-	    }
-	}
-#endif
-	getCurrentTime();
-	statCounter.select_time += (current_dtime - start);
-	return COMM_OK;
-    }
-    while (timeout > current_dtime);
-    debug(5, 8) ("comm_select: time out: %d\n", (int) squid_curtime);
-    return COMM_TIMEOUT;
-}
-
 static void
-comm_select_dns_incoming(void)
+do_select_init()
 {
-    int nfds = 0;
-    int fds[2];
-    int nevents;
-    dns_io_events = 0;
-    if (DnsSocket < 0)
-	return;
-    fds[nfds++] = DnsSocket;
-    nevents = comm_check_incoming_select_handlers(nfds, fds);
-    if (nevents < 0)
-	return;
-    incoming_dns_interval += Config.comm_incoming.dns_average - nevents;
-    if (incoming_dns_interval < Config.comm_incoming.dns_min_poll)
-	incoming_dns_interval = Config.comm_incoming.dns_min_poll;
-    if (incoming_dns_interval > MAX_INCOMING_INTERVAL)
-	incoming_dns_interval = MAX_INCOMING_INTERVAL;
-    if (nevents > INCOMING_DNS_MAX)
-	nevents = INCOMING_DNS_MAX;
-    statHistCount(&statCounter.comm_dns_incoming, nevents);
-}
-
-void
-comm_select_init(void)
-{
-    zero_tv.tv_sec = 0;
-    zero_tv.tv_usec = 0;
-    cachemgrRegister("comm_incoming",
-	"comm_incoming() stats",
-	commIncomingStats, 0, 1);
-    FD_ZERO(&global_readfds);
-    FD_ZERO(&global_writefds);
+    if (Squid_MaxFD > FD_SETSIZE)
+	Squid_MaxFD = FD_SETSIZE;
     nreadfds = nwritefds = 0;
 }
 
@@ -612,8 +59,8 @@
     debug(5, 1) ("Using select for the IO loop\n");
 }
 
-void
-comm_select_shutdown(void)
+static void
+do_select_shutdown()
 {
 }
 
@@ -623,92 +70,6 @@
     storeAppendPrintf(sentry, "\tIO loop method:                     select\n");
 }
 
-/*
- * examine_select - debug routine.
- *
- * I spend the day chasing this core dump that occurs when both the client
- * and the server side of a cache fetch simultaneoulsy abort the
- * connection.  While I haven't really studied the code to figure out how
- * it happens, the snippet below may prevent the cache from exitting:
- * 
- * Call this from where the select loop fails.
- */
-static int
-examine_select(fd_set * readfds, fd_set * writefds)
-{
-    int fd = 0;
-    fd_set read_x;
-    fd_set write_x;
-    struct timeval tv;
-    close_handler *ch = NULL;
-    fde *F = NULL;
-    struct stat sb;
-    debug(5, 0) ("examine_select: Examining open file descriptors...\n");
-    for (fd = 0; fd < Squid_MaxFD; fd++) {
-	FD_ZERO(&read_x);
-	FD_ZERO(&write_x);
-	tv.tv_sec = tv.tv_usec = 0;
-	if (__WSAFDIsSet(fd_table[fd].win32.handle, readfds))
-	    FD_SET(fd, &read_x);
-	else if (__WSAFDIsSet(fd_table[fd].win32.handle, writefds))
-	    FD_SET(fd, &write_x);
-	else
-	    continue;
-	statCounter.syscalls.selects++;
-	errno = 0;
-	if (!fstat(fd, &sb)) {
-	    debug(5, 5) ("FD %d is valid.\n", fd);
-	    continue;
-	}
-	F = &fd_table[fd];
-	debug(5, 0) ("FD %d: %s\n", fd, xstrerror());
-	debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd);
-	debug(5, 0) ("FD %d is a %s called '%s'\n",
-	    fd,
-	    fdTypeStr[F->type],
-	    F->desc);
-	debug(5, 0) ("tmout:%p read:%p write:%p\n",
-	    F->timeout_handler,
-	    F->read_handler,
-	    F->write_handler);
-	for (ch = F->close_handler; ch; ch = ch->next)
-	    debug(5, 0) (" close handler: %p\n", ch->handler);
-	if (F->close_handler) {
-	    commCallCloseHandlers(fd);
-	} else if (F->timeout_handler) {
-	    debug(5, 0) ("examine_select: Calling Timeout Handler\n");
-	    F->timeout_handler(fd, F->timeout_data);
-	}
-	F->close_handler = NULL;
-	F->timeout_handler = NULL;
-	F->read_handler = NULL;
-	F->write_handler = NULL;
-	FD_CLR(fd, readfds);
-	FD_CLR(fd, writefds);
-    }
-    return 0;
-}
-
-static void
-commIncomingStats(StoreEntry * sentry)
-{
-    StatCounters *f = &statCounter;
-    storeAppendPrintf(sentry, "Current incoming_icp_interval: %d\n",
-	incoming_icp_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "Current incoming_dns_interval: %d\n",
-	incoming_dns_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "Current incoming_http_interval: %d\n",
-	incoming_http_interval >> INCOMING_FACTOR);
-    storeAppendPrintf(sentry, "\n");
-    storeAppendPrintf(sentry, "Histogram of events per incoming socket type\n");
-    storeAppendPrintf(sentry, "ICP Messages handled per comm_select_icp_incoming() call:\n");
-    statHistDump(&f->comm_icp_incoming, sentry, statHistIntDumper);
-    storeAppendPrintf(sentry, "DNS Messages handled per comm_select_dns_incoming() call:\n");
-    statHistDump(&f->comm_dns_incoming, sentry, statHistIntDumper);
-    storeAppendPrintf(sentry, "HTTP Messages handled per comm_select_http_incoming() call:\n");
-    statHistDump(&f->comm_http_incoming, sentry, statHistIntDumper);
-}
-
 void
 commSetEvents(int fd, int need_read, int need_write)
 {
@@ -729,59 +90,46 @@
 }
 
 static int
-commDeferRead(int fd)
-{
-    fde *F = &fd_table[fd];
-    if (F->defer_check == NULL)
-	return 0;
-    return F->defer_check(fd, F->defer_data);
-}
-
-static void
-checkTimeouts(void)
+do_comm_select(int msec)
 {
+    int num;
+    struct timeval tv;
+    fd_set readfds;
+    fd_set writefds;
+    fd_set errfds;
     int fd;
-    fde *F = NULL;
-    PF *callback;
-    for (fd = 0; fd <= Biggest_FD; fd++) {
-	F = &fd_table[fd];
-	if (!F->flags.open)
-	    continue;
-	if (F->timeout == 0)
-	    continue;
-	if (F->timeout > squid_curtime)
-	    continue;
-	debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
-	if (F->timeout_handler) {
-	    debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
-	    callback = F->timeout_handler;
-	    F->timeout_handler = NULL;
-	    callback(fd, F->timeout_data);
-	} else {
-	    debug(5, 5) ("checkTimeouts: FD %d: Forcing comm_close()\n", fd);
-	    comm_close(fd);
-	}
-    }
-}
 
+    if (nreadfds + nwritefds == 0) {
+	assert(shutting_down);
+	return COMM_SHUTDOWN;
+    }
+    memcpy(&readfds, &global_readfds, sizeof(fd_set));
+    memcpy(&writefds, &global_writefds, sizeof(fd_set));
+    memcpy(&errfds, &global_writefds, sizeof(fd_set));
+    tv.tv_sec = msec / 1000;
+    tv.tv_usec = (msec % 1000) * 1000;
+    statCounter.syscalls.selects++;
+    num = select(Biggest_FD + 1, &readfds, &writefds, &errfds, &tv);
+    statCounter.select_loops++;
 
-/* Called by async-io or diskd to speed up the polling */
-void
-comm_quick_poll_required(void)
-{
-    MAX_POLL_TIME = 10;
-}
+    if (num < 0) {
+	getCurrentTime();
+	if (ignoreErrno(errno))
+	    return COMM_OK;
 
-/* Defer reads from this fd */
-void
-commDeferFD(int fd)
-{
-    /* Not implemented */
-}
+	debug(5, 1) ("comm_select: select failure: %s\n", xstrerror());
+	return COMM_ERROR;
+    }
+    statHistCount(&statCounter.select_fds_hist, num);
 
-/* Resume reading from the given fd */
-void
-commResumeFD(int fd)
-{
-    /* Not implemented */
+    if (num == 0)
+	return COMM_TIMEOUT;
+
+    for (fd = 0; fd <= Biggest_FD; fd++) {
+	int read_event = __WSAFDIsSet(fd_table[fd].win32.handle, &readfds);
+	int write_event = __WSAFDIsSet(fd_table[fd].win32.handle, &writefds) || __WSAFDIsSet(fd_table[fd].win32.handle, &errfds);
+	if (read_event || write_event)
+	    comm_call_handlers(fd, read_event, write_event);
+    }
+    return COMM_OK;
 }
diff -ruN squid-2.6.STABLE4/src/delay_pools.c squid-2.6.STABLE5/src/delay_pools.c
--- squid-2.6.STABLE4/src/delay_pools.c	Wed Aug  2 15:33:51 2006
+++ squid-2.6.STABLE5/src/delay_pools.c	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: delay_pools.c,v 1.33 2006/08/02 21:33:51 hno Exp $
+ * $Id: delay_pools.c,v 1.34 2006/10/23 11:22:21 hno Exp $
  *
  * DEBUG: section 77    Delay Pools
  * AUTHOR: David Luyer <david@luyer.net>
@@ -145,7 +145,6 @@
 	return;
     delay_data = xcalloc(pools, sizeof(*delay_data));
     memory_used += pools * sizeof(*delay_data);
-    eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1);
     delay_id_ptr_hash = hash_create(delayIdPtrHashCmp, 256, delayIdPtrHash);
 }
 
@@ -164,7 +163,6 @@
 {
     if (!delay_id_ptr_hash)
 	return;
-    eventDelete(delayPoolsUpdate, NULL);
     safe_free(delay_data);
     memory_used -= pools * sizeof(*delay_data);
     hashFreeItems(delay_id_ptr_hash, delayIdZero);
@@ -546,7 +544,6 @@
     unsigned char class;
     if (!Config.Delay.pools)
 	return;
-    eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1);
     if (incr < 1)
 	return;
     delay_pools_last_update = squid_curtime;
@@ -682,6 +679,8 @@
     if (jmax >= 0 && jmax < (int) *read_sz) {
 	if (jmax == 0)
 	    jmax = 1;
+	if (jmax > 1460)
+	    jmax = 1460;
 	*read_sz = (size_t) jmax;
     }
     return d;
diff -ruN squid-2.6.STABLE4/src/enums.h squid-2.6.STABLE5/src/enums.h
--- squid-2.6.STABLE4/src/enums.h	Wed Jul 19 10:05:11 2006
+++ squid-2.6.STABLE5/src/enums.h	Sat Sep 30 15:10:48 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.234 2006/07/19 16:05:11 hno Exp $
+ * $Id: enums.h,v 1.235 2006/09/30 21:10:48 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -528,10 +528,8 @@
     ENTRY_VALIDATED,
     ENTRY_BAD_LENGTH,
     ENTRY_ABORTED,
-    ENTRY_DEFER_READ
-#if UNUSED_CODE
-    ENTRY_DONT_LOG
-#endif
+    ENTRY_DEFER_READ,
+    KEY_EARLY_PUBLIC
 };
 
 typedef enum {
@@ -742,6 +740,7 @@
     VARY_NONE,
     VARY_MATCH,
     VARY_OTHER,
+    VARY_RESTART,
     VARY_CANCEL
 };
 
diff -ruN squid-2.6.STABLE4/src/fd.c squid-2.6.STABLE5/src/fd.c
--- squid-2.6.STABLE4/src/fd.c	Sat Sep  9 06:45:06 2006
+++ squid-2.6.STABLE5/src/fd.c	Mon Oct 23 05:25:29 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fd.c,v 1.53 2006/09/09 12:45:06 serassio Exp $
+ * $Id: fd.c,v 1.55 2006/10/23 11:25:29 hno Exp $
  *
  * DEBUG: section 51    Filedescriptor Functions
  * AUTHOR: Duane Wessels
@@ -77,7 +77,7 @@
      * re-opening it
      */
     assert(!opening);
-    while (!fd_table[Biggest_FD].flags.open)
+    while (!fd_table[Biggest_FD].flags.open && Biggest_FD > 0)
 	Biggest_FD--;
 }
 
@@ -92,6 +92,10 @@
     debug(51, 3) ("fd_close FD %d %s\n", fd, F->desc);
     commSetEvents(fd, 0, 0);
     F->flags.open = 0;
+#if DELAY_POOLS
+    if (F->slow_id)
+	commRemoveSlow(fd);
+#endif
     fdUpdateBiggest(fd, 0);
     Number_FD--;
     memset(F, '\0', sizeof(fde));
@@ -194,6 +198,13 @@
 	F->bytes_read += len;
     else
 	F->bytes_written += len;
+}
+
+void
+fd_init(void)
+{
+    fd_table = xcalloc(Squid_MaxFD, sizeof(fde));
+    /* XXX account fd_table */
 }
 
 void
diff -ruN squid-2.6.STABLE4/src/forward.c squid-2.6.STABLE5/src/forward.c
--- squid-2.6.STABLE4/src/forward.c	Fri Aug 25 06:26:07 2006
+++ squid-2.6.STABLE5/src/forward.c	Sat Sep 30 15:10:48 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.c,v 1.116 2006/08/25 12:26:07 serassio Exp $
+ * $Id: forward.c,v 1.117 2006/09/30 21:10:48 hno Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -827,7 +827,8 @@
 	}
     }
     debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
-    e->mem_obj->request = requestLink(r);
+    if (!e->mem_obj->request)
+	e->mem_obj->request = requestLink(r);
 #if URL_CHECKSUM_DEBUG
     assert(e->mem_obj->chksum == url_checksum(e->mem_obj->url));
 #endif
diff -ruN squid-2.6.STABLE4/src/fs/Makefile.in squid-2.6.STABLE5/src/fs/Makefile.in
--- squid-2.6.STABLE4/src/fs/Makefile.in	Fri Sep 22 03:09:50 2006
+++ squid-2.6.STABLE5/src/fs/Makefile.in	Sun Oct 29 19:21:35 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.38 2006/09/22 09:09:50 hno Exp $
+#  $Id: Makefile.in,v 1.40 2006/10/30 02:21:35 hno Exp $
 #
 
 
@@ -155,7 +155,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -239,6 +238,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/src/fs/aufs/async_io.c squid-2.6.STABLE5/src/fs/aufs/async_io.c
--- squid-2.6.STABLE4/src/fs/aufs/async_io.c	Sat Sep  9 10:04:38 2006
+++ squid-2.6.STABLE5/src/fs/aufs/async_io.c	Sun Oct  8 01:43:31 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: async_io.c,v 1.21 2006/09/09 16:04:38 serassio Exp $
+ * $Id: async_io.c,v 1.22 2006/10/08 07:43:31 serassio Exp $
  *
  * DEBUG: section 32    Asynchronous Disk I/O
  * AUTHOR: Pete Bentley <pete@demon.net>
@@ -77,12 +77,14 @@
 
 static dlink_list used_list;
 static int initialised = 0;
+static int usage_count = 0;
 static OBJH aioStats;
 static MemPool *squidaio_ctrl_pool;
 
 void
 aioInit(void)
 {
+    usage_count++;
     if (initialised)
 	return;
     squidaio_ctrl_pool = memPoolCreate("aio_ctrl", sizeof(squidaio_ctrl_t));
@@ -94,6 +96,8 @@
 void
 aioDone(void)
 {
+    if (--usage_count > 0)
+	return;
     squidaio_shutdown();
     memPoolDestroy(squidaio_ctrl_pool);
     initialised = 0;
diff -ruN squid-2.6.STABLE4/src/fs/aufs/async_io.h squid-2.6.STABLE5/src/fs/aufs/async_io.h
--- squid-2.6.STABLE4/src/fs/aufs/async_io.h	Sat Jul 29 11:37:18 2006
+++ squid-2.6.STABLE5/src/fs/aufs/async_io.h	Mon Sep 25 13:31:34 2006
@@ -8,7 +8,6 @@
 #define __ASYNC_IO_H__
 
 extern int n_asyncufs_dirs;
-extern int n_coss_dirs;
 extern int squidaio_nthreads;
 extern int squidaio_magic1;
 extern int squidaio_magic2;
diff -ruN squid-2.6.STABLE4/src/fs/coss/coss-notes.txt squid-2.6.STABLE5/src/fs/coss/coss-notes.txt
--- squid-2.6.STABLE4/src/fs/coss/coss-notes.txt	Sat May 20 06:23:50 2006
+++ squid-2.6.STABLE5/src/fs/coss/coss-notes.txt	Thu Oct 26 13:29:38 2006
@@ -2,7 +2,7 @@
 
 Adrian Chadd <adrian@creative.net.au>
 
-$Id: coss-notes.txt,v 1.3 2006/05/20 12:23:50 adrian Exp $
+$Id: coss-notes.txt,v 1.4 2006/10/26 19:29:38 serassio Exp $
 
 
 COSS is a Cyclic Object storage system originally designed by
@@ -129,3 +129,8 @@
   sure the right options have been enabled. no compile or run-time checks
   are currently made to ensure the code has been compiled to support
   large filesystems.. at least yet.
+
+-- Notes: Guido Serassio, 26/October/2006
+
+* When using a regular file as container, COSS storage must be initialized
+  once using squid -z like UFS storage.
diff -ruN squid-2.6.STABLE4/src/fs/coss/store_coss.h squid-2.6.STABLE5/src/fs/coss/store_coss.h
--- squid-2.6.STABLE4/src/fs/coss/store_coss.h	Sat Sep 23 04:34:41 2006
+++ squid-2.6.STABLE5/src/fs/coss/store_coss.h	Mon Sep 25 14:14:41 2006
@@ -22,6 +22,8 @@
 #define COSS_ALLOC_ALLOCATE		1
 #define COSS_ALLOC_REALLOC		2
 
+#define SWAPDIR_COSS "coss"
+
 #if USE_AUFSOPS
 /* XXX a hack; the async ops should be broken out! */
 typedef void AIOCB(int fd, void *cbdata, const char *buf,
diff -ruN squid-2.6.STABLE4/src/fs/coss/store_dir_coss.c squid-2.6.STABLE5/src/fs/coss/store_dir_coss.c
--- squid-2.6.STABLE4/src/fs/coss/store_dir_coss.c	Sat Sep 23 04:34:41 2006
+++ squid-2.6.STABLE5/src/fs/coss/store_dir_coss.c	Thu Oct 26 14:00:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_coss.c,v 1.59 2006/09/23 10:34:41 serassio Exp $
+ * $Id: store_dir_coss.c,v 1.65 2006/10/26 20:00:21 serassio Exp $
  *
  * DEBUG: section 47    Store COSS Directory Routines
  * AUTHOR: Eric Stern
@@ -48,9 +48,8 @@
 #define STORE_META_BUFSZ 4096
 #define HITONLY_BUFS 2
 
-int n_coss_dirs = 0;
 int max_coss_dir_size = 0;
-/* static int last_coss_pick_index = -1; */
+static int last_coss_pick_index = -1;
 int coss_initialised = 0;
 MemPool *coss_state_pool = NULL;
 MemPool *coss_index_pool = NULL;
@@ -137,7 +136,8 @@
 	if (stat(sd->path, &st) == 0) {
 	    if (S_ISDIR(st.st_mode))
 		strcat(pathtmp, "/stripe");
-	}
+	} else
+	    fatalf("stripePath: Cannot stat %s.", sd->path);
 	cs->stripe_path = xstrdup(pathtmp);
     }
     return cs->stripe_path;
@@ -150,6 +150,8 @@
     LOCAL_ARRAY(char, pathtmp, SQUID_MAXPATHLEN);
     LOCAL_ARRAY(char, digit, 32);
     char *pathtmp2;
+    struct stat st;
+
     if (Config.Log.swap) {
 	xstrncpy(pathtmp, sd->path, SQUID_MAXPATHLEN - 64);
 	pathtmp2 = pathtmp;
@@ -165,8 +167,14 @@
 	    strncat(path, digit, 3);
 	}
     } else {
-	xstrncpy(path, sd->path, SQUID_MAXPATHLEN - 64);
-	strcat(path, "/swap.state");
+	if (stat(sd->path, &st) == 0) {
+	    if (S_ISDIR(st.st_mode)) {
+		xstrncpy(path, sd->path, SQUID_MAXPATHLEN - 64);
+		strcat(path, "/swap.state");
+	    } else
+		fatal("storeCossDirSwapLogFile: 'cache_swap_log' is needed in your COSS configuration.");
+	} else
+	    fatalf("storeCossDirSwapLogFile: Cannot stat %s.", sd->path);
     }
     if (ext)
 	strncat(path, ext, 16);
@@ -563,9 +571,55 @@
 }
 
 static void
-storeCossDirNewfs(SwapDir * sd)
+storeCossCreateStripe(SwapDir * SD, const char *path)
+{
+    char *block;
+    int swap;
+    int i;
+    CossInfo *cs = (CossInfo *) SD->fsdata;
+
+    debug(47, 1) ("Creating COSS stripe %s\n", path);
+    swap = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0600);
+    block = (char *) xcalloc(COSS_MEMBUF_SZ, 1);
+    for (i = 0; i < cs->numstripes; ++i) {
+	if (write(swap, block, COSS_MEMBUF_SZ) < COSS_MEMBUF_SZ) {
+	    fatalf("Failed to create COSS stripe %s\n", path);
+	}
+    }
+    close(swap);
+    xfree(block);
+}
+
+static void
+storeCossDirNewfs(SwapDir * SD)
+{
+    struct stat st;
+
+    if (stat(SD->path, &st) == 0) {
+	if (S_ISDIR(st.st_mode)) {
+	    if (stat(stripePath(SD), &st) != 0)
+		storeCossCreateStripe(SD, stripePath(SD));
+	}
+    } else
+	storeCossCreateStripe(SD, (const char *) SD->path);
+}
+
+/*
+ * Only "free" the filesystem specific stuff here
+ */
+static void
+storeCossDirFree(SwapDir * SD)
 {
-    debug(47, 3) ("Creating swap space in %s\n", stripePath(sd));
+    CossInfo *cs = (CossInfo *) SD->fsdata;
+    if (cs->swaplog_fd > -1) {
+	file_close(cs->swaplog_fd);
+	cs->swaplog_fd = -1;
+    }
+    xfree(cs->stripes);
+    xfree(cs->memstripes);
+    xfree(cs);
+    SD->fsdata = NULL;		/* Will aid debugging... */
+
 }
 
 /* we are shutting down, flush all membufs to disk */
@@ -575,10 +629,7 @@
     CossInfo *cs = (CossInfo *) SD->fsdata;
     debug(47, 1) ("COSS: %s: syncing\n", stripePath(SD));
 
-#if USE_AUFSOPS
-    aioSync(SD);
-#endif
-    storeCossSync(SD);		/* This'll call a_file_syncqueue() */
+    storeCossSync(SD);		/* This'll call a_file_syncqueue() or a aioSync() */
 #if !USE_AUFSOPS
     a_file_closequeue(&cs->aq);
 #endif
@@ -746,7 +797,7 @@
     sd->init = storeCossDirInit;
     sd->newfs = storeCossDirNewfs;
     sd->dump = storeCossDirDump;
-    sd->freefs = storeCossDirShutdown;
+    sd->freefs = storeCossDirFree;
     sd->dblcheck = NULL;
     sd->statfs = storeCossDirStats;
     sd->maintainfs = NULL;
@@ -809,13 +860,13 @@
      */
     max_offset = (off_t) 0xFFFFFF << cs->blksz_bits;
     if ((sd->max_size + (cs->nummemstripes * (COSS_MEMBUF_SZ >> 10))) > (unsigned long) (max_offset >> 10)) {
-	debug(47, 0) ("COSS block-size = %d bytes\n", 1 << cs->blksz_bits);
-	debug(47, 0) ("COSS largest file offset = %lu KB\n", (unsigned long) max_offset >> 10);
-	debug(47, 0) ("COSS cache_dir size = %d KB\n", sd->max_size);
+	debug(47, 1) ("COSS block-size = %d bytes\n", 1 << cs->blksz_bits);
+	debug(47, 1) ("COSS largest file offset = %lu KB\n", (unsigned long) max_offset >> 10);
+	debug(47, 1) ("COSS cache_dir size = %d KB\n", sd->max_size);
 	fatal("COSS cache_dir size exceeds largest offset\n");
     }
     cs->max_disk_nf = ((off_t) sd->max_size << 10) >> cs->blksz_bits;
-    debug(47, 0) ("COSS: max disk fileno is %d\n", cs->max_disk_nf);
+    debug(47, 2) ("COSS: max disk fileno is %d\n", cs->max_disk_nf);
 
     /* XXX todo checks */
 
@@ -824,7 +875,7 @@
     /* Ensure that the max size IS a multiple of the membuf size, or things
      * will get very fruity near the end of the disk. */
     cs->numstripes = (off_t) (((off_t) sd->max_size) << 10) / COSS_MEMBUF_SZ;
-    debug(47, 0) ("COSS: number of stripes: %d of %d bytes each\n", cs->numstripes, COSS_MEMBUF_SZ);
+    debug(47, 2) ("COSS: number of stripes: %d of %d bytes each\n", cs->numstripes, COSS_MEMBUF_SZ);
     cs->stripes = xcalloc(cs->numstripes, sizeof(struct _cossstripe));
     for (i = 0; i < cs->numstripes; i++) {
 	cs->stripes[i].id = i;
@@ -842,7 +893,7 @@
      */
     cs->hitonlyfullstripes = cs->maxfullstripes - HITONLY_BUFS;
 
-    debug(47, 0) ("COSS: number of memory-only stripes %d of %d bytes each\n", cs->nummemstripes, COSS_MEMBUF_SZ);
+    debug(47, 2) ("COSS: number of memory-only stripes %d of %d bytes each\n", cs->nummemstripes, COSS_MEMBUF_SZ);
     cs->memstripes = xcalloc(cs->nummemstripes, sizeof(struct _cossstripe));
     for (i = 0; i < cs->nummemstripes; i++) {
 	cs->memstripes[i].id = i;
@@ -1004,8 +1055,7 @@
     storeAppendPrintf(e, " block-size=%d", 1 << cs->blksz_bits);
 }
 
-#if OLD_UNUSED_CODE
-SwapDir *
+static SwapDir *
 storeCossDirPick(void)
 {
     int i, choosenext = 0;
@@ -1015,7 +1065,7 @@
 	return NULL;
     for (i = 0; i < Config.cacheSwap.n_configured; i++) {
 	SD = &Config.cacheSwap.swapDirs[i];
-	if (SD->type == SWAPDIR_COSS) {
+	if (strcmp(SD->type, SWAPDIR_COSS) == 0) {
 	    if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
 		last_coss_pick_index = i;
 		return SD;
@@ -1029,7 +1079,7 @@
     }
     for (i = 0; i < Config.cacheSwap.n_configured; i++) {
 	SD = &Config.cacheSwap.swapDirs[i];
-	if (SD->type == SWAPDIR_COSS) {
+	if (strcmp(SD->type, SWAPDIR_COSS) == 0) {
 	    if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
 		last_coss_pick_index = i;
 		return SD;
@@ -1043,7 +1093,6 @@
     }
     return NULL;
 }
-#endif
 
 /*
  * initial setup/done code
@@ -1051,6 +1100,13 @@
 static void
 storeCossDirDone(void)
 {
+    int i, n_dirs = n_coss_dirs;
+
+    for (i = 0; i < n_dirs; i++)
+	storeCossDirShutdown(storeCossDirPick());
+/* 
+ * TODO : check if others memPoolDestroy() of COSS objects are needed here
+ */
     memPoolDestroy(coss_state_pool);
     coss_initialised = 0;
 }
@@ -1099,7 +1155,7 @@
     coss_index_pool = memPoolCreate("COSS index data", sizeof(CossIndexNode));
     coss_realloc_pool = memPoolCreate("COSS pending realloc", sizeof(CossPendingReloc));
     coss_op_pool = memPoolCreate("COSS pending operation", sizeof(CossReadOp));
-    cachemgrRegister("coss", "COSS Stats", storeCossStats, 0, 1);
+    cachemgrRegister(SWAPDIR_COSS, "COSS Stats", storeCossStats, 0, 1);
     coss_initialised = 1;
 }
 
diff -ruN squid-2.6.STABLE4/src/globals.h squid-2.6.STABLE5/src/globals.h
--- squid-2.6.STABLE4/src/globals.h	Sun Jul 30 17:27:03 2006
+++ squid-2.6.STABLE5/src/globals.h	Mon Sep 25 13:31:34 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.121 2006/07/30 23:27:03 hno Exp $
+ * $Id: globals.h,v 1.122 2006/09/25 19:31:34 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -177,5 +177,6 @@
 extern int need_linux_tproxy;	/* 0 */
 #endif
 extern int opt_parse_cfg_only;	/* 0 */
+extern int n_coss_dirs;		/* 0 */
 
 #endif /* SQUID_GLOBALS_H */
diff -ruN squid-2.6.STABLE4/src/http.c squid-2.6.STABLE5/src/http.c
--- squid-2.6.STABLE4/src/http.c	Fri Aug 25 06:26:07 2006
+++ squid-2.6.STABLE5/src/http.c	Mon Oct 23 15:34:17 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.c,v 1.417 2006/08/25 12:26:07 serassio Exp $
+ * $Id: http.c,v 1.418 2006/10/23 21:34:17 hno Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -454,6 +454,8 @@
 	    return;		/* headers not complete */
 	}
     }
+    safe_free(entry->mem_obj->vary_headers);
+    safe_free(entry->mem_obj->vary_encoding);
     /* Cut away any excess body data (only needed for debug?) */
     memBufAppend(&httpState->reply_hdr, "\0", 1);
     httpState->reply_hdr.buf[hdr_size] = '\0';
@@ -489,7 +491,6 @@
 	    goto no_cache;
 	}
 	entry->mem_obj->vary_headers = xstrdup(vary);
-	safe_free(entry->mem_obj->vary_encoding);
 	if (strBuf(httpState->orig_request->vary_encoding))
 	    entry->mem_obj->vary_encoding = xstrdup(strBuf(httpState->orig_request->vary_encoding));
     }
diff -ruN squid-2.6.STABLE4/src/main.c squid-2.6.STABLE5/src/main.c
--- squid-2.6.STABLE4/src/main.c	Sat Sep  2 08:16:10 2006
+++ squid-2.6.STABLE5/src/main.c	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.c,v 1.391 2006/09/02 14:16:10 hno Exp $
+ * $Id: main.c,v 1.392 2006/10/23 11:22:21 hno Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -671,8 +671,6 @@
 #endif
 
     debug_log = stderr;
-    if (FD_SETSIZE < Squid_MaxFD)
-	Squid_MaxFD = FD_SETSIZE;
 
 #ifdef _SQUID_WIN32_
     if ((WIN32_init_err = WIN32_Subsystem_Init(&argc, &argv)))
diff -ruN squid-2.6.STABLE4/src/protos.h squid-2.6.STABLE5/src/protos.h
--- squid-2.6.STABLE4/src/protos.h	Fri Sep 22 04:44:24 2006
+++ squid-2.6.STABLE5/src/protos.h	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.518 2006/09/22 10:44:24 hno Exp $
+ * $Id: protos.h,v 1.519 2006/10/23 11:22:21 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -166,6 +166,7 @@
 extern void commDeferFD(int fd);
 extern void commResumeFD(int fd);
 extern void commSetSelect(int, unsigned int, PF *, void *, time_t);
+extern void commRemoveSlow(int fd);
 extern void comm_add_close_handler(int fd, PF *, void *);
 extern void comm_remove_close_handler(int fd, PF *, void *);
 extern int comm_udp_sendto(int, const struct sockaddr_in *, int, const void *, int);
@@ -258,6 +259,7 @@
 extern void eventFreeMemory(void);
 extern int eventFind(EVH *, void *);
 
+extern void fd_init(void);
 extern void fd_close(int fd);
 extern void fd_open(int fd, unsigned int type, const char *);
 extern void fd_note(int fd, const char *);
diff -ruN squid-2.6.STABLE4/src/repl/Makefile.in squid-2.6.STABLE5/src/repl/Makefile.in
--- squid-2.6.STABLE4/src/repl/Makefile.in	Fri Sep 22 03:09:50 2006
+++ squid-2.6.STABLE5/src/repl/Makefile.in	Sun Oct 29 19:21:36 2006
@@ -16,7 +16,7 @@
 
 #  Makefile for storage modules in the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.35 2006/09/22 09:09:50 hno Exp $
+#  $Id: Makefile.in,v 1.37 2006/10/30 02:21:36 hno Exp $
 #
 
 srcdir = @srcdir@
@@ -119,7 +119,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -203,6 +202,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
diff -ruN squid-2.6.STABLE4/src/stat.c squid-2.6.STABLE5/src/stat.c
--- squid-2.6.STABLE4/src/stat.c	Mon Sep 18 16:54:39 2006
+++ squid-2.6.STABLE5/src/stat.c	Wed Nov  1 13:58:52 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.c,v 1.376 2006/09/18 22:54:39 hno Exp $
+ * $Id: stat.c,v 1.377 2006/11/01 20:58:52 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -696,7 +696,7 @@
 #endif
 }
 
-#define XAVG(X) (dt ? (double) (f->X - l->X) / dt : 0.0)
+#define XAVG(X) (dt ? (f->X > l->X ? ((double) (f->X - l->X) / dt) : 0.0) : 0.0)
 static void
 statAvgDump(StoreEntry * sentry, int minutes, int hours)
 {
diff -ruN squid-2.6.STABLE4/src/store.c squid-2.6.STABLE5/src/store.c
--- squid-2.6.STABLE4/src/store.c	Tue Aug 15 18:31:29 2006
+++ squid-2.6.STABLE5/src/store.c	Mon Oct  9 07:18:24 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.c,v 1.566 2006/08/16 00:31:29 hno Exp $
+ * $Id: store.c,v 1.568 2006/10/09 13:18:24 hno Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -967,8 +967,14 @@
     StoreEntry *e2 = NULL;
     const cache_key *newkey;
     MemObject *mem = e->mem_obj;
-    if (e->hash.key && !EBIT_TEST(e->flags, KEY_PRIVATE))
-	return;			/* is already public */
+    if (e->hash.key && !EBIT_TEST(e->flags, KEY_PRIVATE)) {
+	if (EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
+	    EBIT_CLR(e->flags, KEY_EARLY_PUBLIC);
+	    storeSetPrivateKey(e);	/* wasn't really public yet, reset the key */
+	} else {
+	    return;		/* is already public */
+	}
+    }
     assert(mem);
     /*
      * We can't make RELEASE_REQUEST objects public.  Depending on
@@ -1003,14 +1009,16 @@
 		    storeRelease(pe);
 	    }
 	    /* Make sure the request knows the variance status */
-	    if (!request->vary_headers) {
-		const char *vary = httpMakeVaryMark(request, mem->reply);
-		if (vary)
-		    request->vary_headers = xstrdup(vary);
+	    else if (!request->vary_headers) {
+		if (!httpMakeVaryMark(request, mem->reply)) {
+		    /* Release the object if we could not index the variance */
+		    storeReleaseRequest(e);
+		    return;
+		}
 	    }
 	}
 	newkey = storeKeyPublicByRequest(mem->request);
-	if (mem->vary_headers) {
+	if (mem->vary_headers && !EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
 	    String vary = StringNull;
 	    String varyhdr;
 	    varyhdr = httpHeaderGetList(&mem->reply->header, HDR_VARY);
@@ -1645,9 +1653,12 @@
     if (EBIT_TEST(e->flags, ENTRY_ABORTED))
 	return 0;
     /* Entries which seem to have got stuck is not valid to send to new clients */
-    if (e->store_status == STORE_PENDING)
+    if (e->store_status == STORE_PENDING) {
 	if (!e->mem_obj || e->mem_obj->refresh_timestamp + 30 < squid_curtime)
 	    return 0;
+	else
+	    return -1;
+    }
     return 1;
 }
 
diff -ruN squid-2.6.STABLE4/src/structs.h squid-2.6.STABLE5/src/structs.h
--- squid-2.6.STABLE4/src/structs.h	Wed Sep 20 22:14:46 2006
+++ squid-2.6.STABLE5/src/structs.h	Mon Oct 23 05:22:21 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.502 2006/09/21 04:14:46 swilton Exp $
+ * $Id: structs.h,v 1.504 2006/10/23 11:22:21 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -921,6 +921,9 @@
 	long handle;
     } win32;
 #endif
+#if DELAY_POOLS
+    int slow_id;
+#endif
 };
 
 struct _fileMap {
@@ -1822,6 +1825,7 @@
 #if LINUX_TPROXY
     unsigned int tproxy:1;
 #endif
+    unsigned int collapsed:1;	/* This request was collapsed. Don't trust the store entry to be valid */
 };
 
 struct _link_list {
diff -ruN squid-2.6.STABLE4/src/tools.c squid-2.6.STABLE5/src/tools.c
--- squid-2.6.STABLE4/src/tools.c	Fri Sep 22 04:47:42 2006
+++ squid-2.6.STABLE5/src/tools.c	Wed Nov  1 13:58:52 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.c,v 1.248 2006/09/22 10:47:42 hno Exp $
+ * $Id: tools.c,v 1.249 2006/11/01 20:58:52 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -987,6 +987,18 @@
     k->bytes += v;
     k->kb += (k->bytes >> 10);
     k->bytes &= 0x3FF;
+    if (k->kb < 0) {
+	/*
+	 * If kb overflows and becomes negative then add powers of
+	 * 2 until it becomes positive again.
+	 */
+	kb_t x;
+	x.kb = 1 << 31;
+	while (x.kb && ((k->kb + x.kb) < 0)) {
+	    x.kb <<= 1;
+	}
+	k->kb += x.kb;
+    }
 }
 
 void
diff -ruN squid-2.6.STABLE4/src/wccp2.c squid-2.6.STABLE5/src/wccp2.c
--- squid-2.6.STABLE4/src/wccp2.c	Wed Sep 20 22:14:46 2006
+++ squid-2.6.STABLE5/src/wccp2.c	Wed Oct 25 18:50:04 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wccp2.c,v 1.26 2006/09/21 04:14:46 swilton Exp $
+ * $Id: wccp2.c,v 1.28 2006/10/26 00:50:04 swilton Exp $
  *
  * DEBUG: section 80    WCCP Support
  * AUTHOR: Steven WIlton
@@ -622,7 +622,7 @@
 		wccp2_mask_identity_info.cache_identity.dest_ip_mask = 0;
 		wccp2_mask_identity_info.cache_identity.source_port_mask = 0;
 		wccp2_mask_identity_info.cache_identity.dest_port_mask = 0;
-	    } else if ((service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) {
+	    } else if ((service_list_ptr->info.service == WCCP2_SERVICE_STANDARD) || (service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) {
 		wccp2_mask_identity_info.cache_identity.source_ip_mask = 0;
 		wccp2_mask_identity_info.cache_identity.dest_ip_mask = htonl(0x00001741);
 		wccp2_mask_identity_info.cache_identity.source_port_mask = 0;
@@ -1447,7 +1447,7 @@
 		    mask_element->dest_ip_mask = 0;
 		    mask_element->source_port_mask = 0;
 		    mask_element->dest_port_mask = 0;
-		} else if ((service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) {
+		} else if ((service_list_ptr->info.service == WCCP2_SERVICE_STANDARD) || (service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) {
 		    mask_element->source_ip_mask = 0;
 		    mask_element->dest_ip_mask = htonl(0x00001741);
 		    mask_element->source_port_mask = 0;
@@ -1478,7 +1478,7 @@
 			value_element->dest_ip_value = 0;
 			value_element->source_port_value = 0;
 			value_element->dest_port_value = 0;
-		    } else if ((service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) {
+		    } else if ((service_list_ptr->info.service == WCCP2_SERVICE_STANDARD) || (service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) {
 			value_element->source_ip_value = 0;
 			value_element->dest_ip_value = htonl(value);
 			value_element->source_port_value = 0;
diff -ruN squid-2.6.STABLE4/src/win32.c squid-2.6.STABLE5/src/win32.c
--- squid-2.6.STABLE4/src/win32.c	Sat Sep 23 04:42:44 2006
+++ squid-2.6.STABLE5/src/win32.c	Sun Oct 29 01:21:50 2006
@@ -1,6 +1,6 @@
 
 /*
- * $Id: win32.c,v 1.16 2006/09/23 10:42:44 serassio Exp $
+ * $Id: win32.c,v 1.17 2006/10/29 08:21:50 serassio Exp $
  *
  * Windows support
  * AUTHOR: Guido Serassio <serassio@squid-cache.org>
@@ -225,12 +225,22 @@
 static unsigned int
 GetOSVersion()
 {
-    OSVERSIONINFO osvi;
+    OSVERSIONINFOEX osvi;
+    BOOL bOsVersionInfoEx;
 
     safe_free(WIN32_OS_string);
-    memset(&osvi, '\0', sizeof(OSVERSIONINFO));
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-    GetVersionEx((OSVERSIONINFO *) & osvi);
+    memset(&osvi, '\0', sizeof(OSVERSIONINFOEX));
+    /* Try calling GetVersionEx using the OSVERSIONINFOEX structure.
+     * If that fails, try using the OSVERSIONINFO structure.
+     */
+
+    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+
+    if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) & osvi))) {
+	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+	if (!GetVersionEx((OSVERSIONINFO *) & osvi))
+	    goto GetVerError;
+    }
     switch (osvi.dwPlatformId) {
     case VER_PLATFORM_WIN32_NT:
 	if (osvi.dwMajorVersion <= 4) {
@@ -250,7 +260,10 @@
 	    return _WIN_OS_WINNET;
 	}
 	if ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion == 0)) {
-	    WIN32_OS_string = xstrdup("Windows code name \"Longhorn\"");
+	    if (osvi.wProductType == VER_NT_WORKSTATION)
+		WIN32_OS_string = xstrdup("Windows Vista");
+	    else
+		WIN32_OS_string = xstrdup("Windows Server \"Longhorn\"");
 	    return _WIN_OS_WINLON;
 	}
 	break;
@@ -275,6 +288,7 @@
     default:
 	break;
     }
+  GetVerError:
     WIN32_OS_string = xstrdup("Unknown Windows system");
     return _WIN_OS_UNKNOWN;
 }
diff -ruN squid-2.6.STABLE4/tools/Makefile.in squid-2.6.STABLE5/tools/Makefile.in
--- squid-2.6.STABLE4/tools/Makefile.in	Fri Sep 22 03:09:50 2006
+++ squid-2.6.STABLE5/tools/Makefile.in	Sun Oct 29 19:21:36 2006
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.9 2006/09/22 09:09:50 hno Exp $
+#  $Id: Makefile.in,v 1.11 2006/10/30 02:21:36 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -140,7 +140,6 @@
 ENABLE_UNLINKD_TRUE = @ENABLE_UNLINKD_TRUE@
 ENABLE_WIN32SPECIFIC_FALSE = @ENABLE_WIN32SPECIFIC_FALSE@
 ENABLE_WIN32SPECIFIC_TRUE = @ENABLE_WIN32SPECIFIC_TRUE@
-EPOLL_LIBS = @EPOLL_LIBS@
 ERR_DEFAULT_LANGUAGE = @ERR_DEFAULT_LANGUAGE@
 ERR_LANGUAGES = @ERR_LANGUAGES@
 EXEEXT = @EXEEXT@
@@ -224,6 +223,8 @@
 USE_POLL_FALSE = @USE_POLL_FALSE@
 USE_POLL_TRUE = @USE_POLL_TRUE@
 USE_SELECT_FALSE = @USE_SELECT_FALSE@
+USE_SELECT_SIMPLE_FALSE = @USE_SELECT_SIMPLE_FALSE@
+USE_SELECT_SIMPLE_TRUE = @USE_SELECT_SIMPLE_TRUE@
 USE_SELECT_TRUE = @USE_SELECT_TRUE@
 USE_SELECT_WIN32_FALSE = @USE_SELECT_WIN32_FALSE@
 USE_SELECT_WIN32_TRUE = @USE_SELECT_WIN32_TRUE@
