diff -ruN squid-2.6.STABLE9/ChangeLog squid-2.6.STABLE10/ChangeLog
--- squid-2.6.STABLE9/ChangeLog Tue Jan 23 19:06:04 2007
+++ squid-2.6.STABLE10/ChangeLog Sat Mar 3 11:43:44 2007
@@ -1,3 +1,33 @@
+Changes to squid-2.6.STABLE10 (Mar 4 2007)
+
+ - Upgrade HTTP/0.9 responses to our HTTP version (HTTP/1.0)
+ - various diskd bugfixes
+ - In the access.log hierarchy field log the unique peer name
+ instead of the host name
+ - unlinkdClose() should be called after (not before) storeDirSync()
+ - CLEAN_BUF_SZ was defined, but never used anywhere
+ - logging HTTP-request size
+ - Fix icmp pinger communication on FreeBSD and other not supporing
+ large dgram AF_UNIX sockets
+ - Release objects on swapin failure
+ - Bug #1787: Objects stuck in cache if origin server clock in future
+ - Bug #1420: 302 responses with an Expires header is always cached
+ - Primitive support for HTTP/1.1 chunked encoding, working around
+ broken servers
+ - Clean up relations between TCP probing and DNS checks of peers with
+ no known addresses.
+ - Fix a minor HTML coding error in ftp directory listings with // in
+ the path
+ - Bug #1875, #1420. Cleanup of refresh logics when dealing with
+ non-refreshable content
+ - Negotiate authentication fixed again. Broken since STABLE7 by the
+ patch for Bug #1792.
+ - Bug #1892: COSS tries to shut down the same directory twice on exit
+ - Bug #1908: store*DirRebuildFromSwapLog() ignores some SWAP_LOG_DEL
+ entries
+ - Added support for Subversion HTTP request methods MKACTIVITY,
+ CHECKOUT and MERGE.
+
Changes to squid-2.6.STABLE9 (Jan 24 2007)
- Bug #1878: If-Modified-Since broken in 2.6.STABLE8
diff -ruN squid-2.6.STABLE9/RELEASENOTES.html squid-2.6.STABLE10/RELEASENOTES.html
--- squid-2.6.STABLE9/RELEASENOTES.html Tue Jan 23 19:08:14 2007
+++ squid-2.6.STABLE10/RELEASENOTES.html Sat Mar 3 14:56:36 2007
@@ -2,12 +2,12 @@
- Squid 2.6.STABLE8 release notes
+ Squid 2.6.STABLE10 release notes
-Squid 2.6.STABLE8 release notes
+Squid 2.6.STABLE10 release notes
-Squid Developers
$Id: release-2.6.html,v 1.44.2.2 2007/01/24 02:06:05 hno Exp $
+Squid Developers
$Id: release-2.6.html,v 1.44.2.4 2007/03/03 21:37:29 hno Exp $
This document contains the release notes for version 2.6 of Squid.
Squid is a WWW Cache application developed by the Web Caching community.
@@ -54,6 +54,9 @@
+
+
+
@@ -470,7 +473,7 @@
Bug #1673: cache digests not served to other caches
Bug #1684: xstrdup: tried to dup a NULL pointer!
Bug #1688: Assertion failure in HttpHeader.c in some header_access configurations
-Bug #1696, Bug #1700 and more: WCCP2 fixes
+Bug #1696, Bug #1700 and more: WCCP2 fixes
Bug #1677: Duplicate etags in the If-None-Match in cache validations causing lighttpd to fail with error 400
Added ARP acl support for OpenBSD and ARP fixes for Windows
Bug #1681: All ntlmauthenticator processes are busy
@@ -600,6 +603,23 @@
Bug #1877 diskd bug in storeDiskdIOCallback()
See the list of
squid-2.6.STABLE9 changes and the
+ChangeLog file for details.
+
+
+
+
+
+
+
+- Upgrade HTTP/0.9 responses to our HTTP version (HTTP/1.0)
+- various diskd bugfixes
+- In the access.log hierarchy field log the unique peer name
+instead of the host name
+- logging format for HTTP-request size
+- Primitive support for HTTP/1.1 chunked encoding, working around
+broken servers
+- a number of other minor and cosmetic bugfixes. See the list of
+squid-2.6.STABLE10 changes and the
ChangeLog file for details.
diff -ruN squid-2.6.STABLE9/configure squid-2.6.STABLE10/configure
--- squid-2.6.STABLE9/configure Tue Jan 23 19:07:43 2007
+++ squid-2.6.STABLE10/configure Sat Mar 3 14:56:03 2007
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.in Revision: 1.416.2.2 .
+# From configure.in Revision: 1.416.2.5 .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE9.
+# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE10.
#
# Report bugs to .
#
@@ -270,8 +270,8 @@
# Identity of this package.
PACKAGE_NAME='Squid Web Proxy'
PACKAGE_TARNAME='squid'
-PACKAGE_VERSION='2.6.STABLE9'
-PACKAGE_STRING='Squid Web Proxy 2.6.STABLE9'
+PACKAGE_VERSION='2.6.STABLE10'
+PACKAGE_STRING='Squid Web Proxy 2.6.STABLE10'
PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/'
ac_default_prefix=/usr/local/squid
@@ -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.STABLE9 to adapt to many kinds of systems.
+\`configure' configures Squid Web Proxy 2.6.STABLE10 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.STABLE9:";;
+ short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE10:";;
esac
cat <<\_ACEOF
@@ -1158,7 +1158,7 @@
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-Squid Web Proxy configure 2.6.STABLE9
+Squid Web Proxy configure 2.6.STABLE10
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1172,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.STABLE9, which was
+It was created by Squid Web Proxy $as_me 2.6.STABLE10, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1818,7 +1818,7 @@
# Define the identity of the package.
PACKAGE='squid'
- VERSION='2.6.STABLE9'
+ VERSION='2.6.STABLE10'
cat >>confdefs.h <<_ACEOF
@@ -16449,6 +16449,128 @@
fi
+echo "$as_me:$LINENO: checking if AF_UNIX dgram sockets support large packets" >&5
+echo $ECHO_N "checking if AF_UNIX dgram sockets support large packets... $ECHO_C" >&6
+if test "${ac_cv_af_unix_large_dgram+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include
+#include
+#if HAVE_SYS_SELECT_H
+#include
+#else
+#include
+#endif
+#include
+#include
+#include
+
+#define BUFSIZE 16384
+ void consumer(int s, int p)
+ {
+ fd_set fds;
+ char buf[BUFSIZE];
+ int len;
+ int nfds = p > s ? p + 1 : s + 1;
+ int rc;
+ FD_ZERO(&fds);
+ FD_SET(s, &fds);
+ FD_SET(p, &fds);
+ rc = select(nfds, &fds, NULL, NULL, NULL);
+ if (rc < 0)
+ exit(1);
+ if (FD_ISSET(s, &fds))
+ len = recv(s, buf, sizeof(buf), 0);
+ }
+
+ void sender(int s, int p)
+ {
+ char buf[BUFSIZE];
+ int len = sizeof(buf);
+ int rc = send(s, buf, len, 0);
+ if (rc < 0) {
+ perror("send");
+ exit(1);
+ }
+ if (rc != len) {
+ fprintf(stderr, "Short send %d of %d\n", rc, len);
+ exit(1);
+ }
+ }
+
+ int main(int argc, char **argv)
+ {
+ int s[2];
+ int p[2];
+ pid_t pid;
+ socketpair(AF_UNIX, SOCK_DGRAM, 0, s);
+ pipe(p);
+ pid = fork();
+ if (pid < 0) {
+ perror("fork");
+ exit(0);
+ }
+ if (pid == 0) {
+ close(s[0]);
+ close(p[0]);
+ consumer(s[1],p[1]);
+ } else {
+ close(s[1]);
+ close(p[1]);
+ sender(s[0],p[0]);
+ }
+ return 0;
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./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_af_unix_large_dgram="yes"
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_af_unix_large_dgram="no"
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_af_unix_large_dgram" >&5
+echo "${ECHO_T}$ac_cv_af_unix_large_dgram" >&6
+if test "$ac_cv_af_unix_large_dgram" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SUPPORTS_LARGE_AF_UNIX_DGRAM 1
+_ACEOF
+
+fi
+
echo "$as_me:$LINENO: checking if setresuid is implemented" >&5
echo $ECHO_N "checking if setresuid is implemented... $ECHO_C" >&6
if test "${ac_cv_func_setresuid+set}" = set; then
@@ -18494,7 +18616,7 @@
} >&5
cat >&5 <<_CSEOF
-This file was extended by Squid Web Proxy $as_me 2.6.STABLE9, which was
+This file was extended by Squid Web Proxy $as_me 2.6.STABLE10, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18557,7 +18679,7 @@
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-Squid Web Proxy config.status 2.6.STABLE9
+Squid Web Proxy config.status 2.6.STABLE10
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff -ruN squid-2.6.STABLE9/configure.in squid-2.6.STABLE10/configure.in
--- squid-2.6.STABLE9/configure.in Tue Jan 23 19:07:43 2007
+++ squid-2.6.STABLE10/configure.in Sat Mar 3 14:56:03 2007
@@ -1,16 +1,16 @@
dnl
dnl Configuration input file for Squid
dnl
-dnl $Id: configure.in,v 1.416.2.2 2007/01/24 02:06:04 hno Exp $
+dnl $Id: configure.in,v 1.416.2.5 2007/03/03 21:53:31 hno Exp $
dnl
dnl
dnl
-AC_INIT(Squid Web Proxy, 2.6.STABLE9, http://www.squid-cache.org/bugs/, squid)
+AC_INIT(Squid Web Proxy, 2.6.STABLE10, http://www.squid-cache.org/bugs/, squid)
AC_PREREQ(2.52)
AM_CONFIG_HEADER(include/autoconf.h)
AC_CONFIG_AUX_DIR(cfgaux)
AM_INIT_AUTOMAKE
-AC_REVISION($Revision: 1.416.2.2 $)dnl
+AC_REVISION($Revision: 1.416.2.5 $)dnl
AC_PREFIX_DEFAULT(/usr/local/squid)
AM_MAINTAINER_MODE
@@ -2429,6 +2429,84 @@
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])
+
+dnl Hmm.. some OS:es (i.e. FreeBSD) can't handle large AF_UNIX dgram packets.
+dnl Verify that at least 16K is supported, if not fall back on using
+dnl IP dgram sockets for IPC.
+AC_CACHE_CHECK(if AF_UNIX dgram sockets support large packets, ac_cv_af_unix_large_dgram,
+ AC_TRY_RUN([
+#include
+#include
+#if HAVE_SYS_SELECT_H
+#include
+#else
+#include
+#endif
+#include
+#include
+#include
+
+#define BUFSIZE 16384
+ void consumer(int s, int p)
+ {
+ fd_set fds;
+ char buf[[BUFSIZE]];
+ int len;
+ int nfds = p > s ? p + 1 : s + 1;
+ int rc;
+ FD_ZERO(&fds);
+ FD_SET(s, &fds);
+ FD_SET(p, &fds);
+ rc = select(nfds, &fds, NULL, NULL, NULL);
+ if (rc < 0)
+ exit(1);
+ if (FD_ISSET(s, &fds))
+ len = recv(s, buf, sizeof(buf), 0);
+ }
+
+ void sender(int s, int p)
+ {
+ char buf[[BUFSIZE]];
+ int len = sizeof(buf);
+ int rc = send(s, buf, len, 0);
+ if (rc < 0) {
+ perror("send");
+ exit(1);
+ }
+ if (rc != len) {
+ fprintf(stderr, "Short send %d of %d\n", rc, len);
+ exit(1);
+ }
+ }
+
+ int main(int argc, char **argv)
+ {
+ int s[[2]];
+ int p[[2]];
+ pid_t pid;
+ socketpair(AF_UNIX, SOCK_DGRAM, 0, s);
+ pipe(p);
+ pid = fork();
+ if (pid < 0) {
+ perror("fork");
+ exit(0);
+ }
+ if (pid == 0) {
+ close(s[[0]]);
+ close(p[[0]]);
+ consumer(s[[1]],p[[1]]);
+ } else {
+ close(s[[1]]);
+ close(p[[1]]);
+ sender(s[[0]],p[[0]]);
+ }
+ return 0;
+ }
+ ], ac_cv_af_unix_large_dgram="yes",ac_cv_af_unix_large_dgram="no")
+)
+if test "$ac_cv_af_unix_large_dgram" = "yes" ; then
+ AC_DEFINE(SUPPORTS_LARGE_AF_UNIX_DGRAM, 1, [Supports large dgram sockets over AF_UNIX sockets])
+fi
dnl Yay! Another Linux brokenness. Its not good enough
dnl to know that setresuid() exists, because RedHat 5.0 declares
diff -ruN squid-2.6.STABLE9/helpers/basic_auth/mswin_sspi/valid.h squid-2.6.STABLE10/helpers/basic_auth/mswin_sspi/valid.h
--- squid-2.6.STABLE9/helpers/basic_auth/mswin_sspi/valid.h Sat May 27 02:58:28 2006
+++ squid-2.6.STABLE10/helpers/basic_auth/mswin_sspi/valid.h Sat Mar 3 11:27:18 2007
@@ -76,7 +76,7 @@
#include
static char *__foo;
#define debug(X...) if (debug_enabled) { \
- fprintf(stderr,"nt_auth[%d](%s:%d): ", getpid(), \
+ fprintf(stderr,"mswin_auth[%d](%s:%d): ", getpid(), \
((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\
__LINE__);\
fprintf(stderr,X); }
@@ -93,7 +93,7 @@
va_list args;
va_start(args, format);
- fprintf(stderr, "nt_auth[%d]: ", getpid());
+ fprintf(stderr, "mswin_auth[%d]: ", getpid());
vfprintf(stderr, format, args);
va_end(args);
}
diff -ruN squid-2.6.STABLE9/helpers/negotiate_auth/mswin_sspi/negotiate.h squid-2.6.STABLE10/helpers/negotiate_auth/mswin_sspi/negotiate.h
--- squid-2.6.STABLE9/helpers/negotiate_auth/mswin_sspi/negotiate.h Sat May 27 02:58:30 2006
+++ squid-2.6.STABLE10/helpers/negotiate_auth/mswin_sspi/negotiate.h Sat Mar 3 11:27:18 2007
@@ -52,7 +52,7 @@
#include
static char *__foo;
#define debug(X...) if (debug_enabled) { \
- fprintf(stderr,"ntlm-auth[%d](%s:%d): ", getpid(), \
+ fprintf(stderr,"mswin_negotiate_auth[%d](%s:%d): ", getpid(), \
((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\
__LINE__);\
fprintf(stderr,X); }
@@ -73,7 +73,7 @@
va_list args;
va_start(args, format);
- fprintf(stderr, "negotiate-auth[%d]: ", getpid());
+ fprintf(stderr, "mswin_negotiate_auth[%d]: ", getpid());
vfprintf(stderr, format, args);
va_end(args);
#if FAIL_DEBUG
diff -ruN squid-2.6.STABLE9/helpers/ntlm_auth/SMB/ntlm.h squid-2.6.STABLE10/helpers/ntlm_auth/SMB/ntlm.h
--- squid-2.6.STABLE9/helpers/ntlm_auth/SMB/ntlm.h Tue May 17 10:56:33 2005
+++ squid-2.6.STABLE10/helpers/ntlm_auth/SMB/ntlm.h Sat Mar 3 11:27:19 2007
@@ -53,7 +53,7 @@
static const char *__foo;
extern char debug_enabled;
#define debug(X...) if (debug_enabled) { \
- fprintf(stderr,"ntlm-auth[%ld](%s:%d): ", (long)getpid(), \
+ fprintf(stderr,"ntlm_auth[%ld](%s:%d): ", (long)getpid(), \
((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\
__LINE__);\
fprintf(stderr,X); }
diff -ruN squid-2.6.STABLE9/helpers/ntlm_auth/fakeauth/ntlm.h squid-2.6.STABLE10/helpers/ntlm_auth/fakeauth/ntlm.h
--- squid-2.6.STABLE9/helpers/ntlm_auth/fakeauth/ntlm.h Mon Aug 28 03:19:29 2006
+++ squid-2.6.STABLE10/helpers/ntlm_auth/fakeauth/ntlm.h Sat Mar 3 11:27:21 2007
@@ -1,5 +1,5 @@
/*
- * $Id: ntlm.h,v 1.7 2006/08/28 09:19:29 serassio Exp $
+ * $Id: ntlm.h,v 1.7.2.1 2007/03/03 18:27:21 hno Exp $
*
* AUTHOR: Andrew Doran
*
@@ -121,7 +121,7 @@
#include
static const char *__foo;
#define debug(X...) if (debug_enabled) { \
- fprintf(stderr,"ntlm-auth[%ld](%s:%d): ", (long)getpid(), \
+ fprintf(stderr,"fakeauth_auth[%ld](%s:%d): ", (long)getpid(), \
((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\
__LINE__);\
fprintf(stderr,X); }
@@ -142,7 +142,7 @@
va_list args;
va_start(args, format);
- fprintf(stderr, "ntlm-auth[%ld]: ", (long)getpid());
+ fprintf(stderr, "fakeauth_auth[%ld]: ", (long)getpid());
vfprintf(stderr, format, args);
va_end(args);
#if FAIL_DEBUG
diff -ruN squid-2.6.STABLE9/helpers/ntlm_auth/mswin_sspi/ntlm.h squid-2.6.STABLE10/helpers/ntlm_auth/mswin_sspi/ntlm.h
--- squid-2.6.STABLE9/helpers/ntlm_auth/mswin_sspi/ntlm.h Sat May 27 02:58:30 2006
+++ squid-2.6.STABLE10/helpers/ntlm_auth/mswin_sspi/ntlm.h Sat Mar 3 11:27:22 2007
@@ -52,7 +52,7 @@
#include
static char *__foo;
#define debug(X...) if (debug_enabled) { \
- fprintf(stderr,"ntlm-auth[%d](%s:%d): ", getpid(), \
+ fprintf(stderr,"mswin_ntlm_auth[%d](%s:%d): ", getpid(), \
((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\
__LINE__);\
fprintf(stderr,X); }
@@ -73,7 +73,7 @@
va_list args;
va_start(args, format);
- fprintf(stderr, "ntlm-auth[%d]: ", getpid());
+ fprintf(stderr, "mswin_ntlm_auth[%d]: ", getpid());
vfprintf(stderr, format, args);
va_end(args);
#if FAIL_DEBUG
diff -ruN squid-2.6.STABLE9/include/autoconf.h.in squid-2.6.STABLE10/include/autoconf.h.in
--- squid-2.6.STABLE9/include/autoconf.h.in Sun Dec 10 06:41:18 2006
+++ squid-2.6.STABLE10/include/autoconf.h.in Mon Feb 5 14:36:44 2007
@@ -755,6 +755,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Supports large dgram sockets over AF_UNIX sockets */
+#undef SUPPORTS_LARGE_AF_UNIX_DGRAM
+
/* Define this to include code which lets you specify access control elements
based on ethernet hardware addresses. This code uses functions found in 4.4
BSD derviations (e.g. FreeBSD, ?). */
diff -ruN squid-2.6.STABLE9/include/version.h squid-2.6.STABLE10/include/version.h
--- squid-2.6.STABLE9/include/version.h Tue Jan 23 19:07:43 2007
+++ squid-2.6.STABLE10/include/version.h Sat Mar 3 14:56:03 2007
@@ -9,5 +9,5 @@
*/
#ifndef SQUID_RELEASE_TIME
-#define SQUID_RELEASE_TIME 1169604460
+#define SQUID_RELEASE_TIME 1172958959
#endif
diff -ruN squid-2.6.STABLE9/src/HttpHeader.c squid-2.6.STABLE10/src/HttpHeader.c
--- squid-2.6.STABLE9/src/HttpHeader.c Sun Jan 21 03:26:44 2007
+++ squid-2.6.STABLE10/src/HttpHeader.c Mon Feb 26 15:41:46 2007
@@ -1,6 +1,6 @@
/*
- * $Id: HttpHeader.c,v 1.91.2.1 2007/01/21 10:26:44 hno Exp $
+ * $Id: HttpHeader.c,v 1.91.2.2 2007/02/26 22:41:46 hno Exp $
*
* DEBUG: section 55 HTTP Header
* AUTHOR: Alex Rousskov
@@ -113,12 +113,14 @@
{"Retry-After", HDR_RETRY_AFTER, ftStr}, /* for now (ftDate_1123 or ftInt!) */
{"Server", HDR_SERVER, ftStr},
{"Set-Cookie", HDR_SET_COOKIE, ftStr},
- {"Title", HDR_TITLE, ftStr},
{"Transfer-Encoding", HDR_TRANSFER_ENCODING, ftStr},
+ {"Te", HDR_TE, ftStr},
+ {"Trailer", HDR_TRAILER, ftStr},
{"Upgrade", HDR_UPGRADE, ftStr}, /* for now */
{"User-Agent", HDR_USER_AGENT, ftStr},
{"Vary", HDR_VARY, ftStr}, /* for now */
{"Via", HDR_VIA, ftStr}, /* for now */
+ {"Expect", HDR_EXPECT, ftStr},
{"Warning", HDR_WARNING, ftStr}, /* for now */
{"WWW-Authenticate", HDR_WWW_AUTHENTICATE, ftStr},
{"Authentication-Info", HDR_AUTHENTICATION_INFO, ftStr},
@@ -157,6 +159,8 @@
HDR_LINK, HDR_PRAGMA,
HDR_PROXY_CONNECTION,
HDR_PROXY_SUPPORT,
+ HDR_TE,
+ HDR_TRAILER,
HDR_TRANSFER_ENCODING,
HDR_UPGRADE,
HDR_VARY,
@@ -165,7 +169,7 @@
HDR_WWW_AUTHENTICATE,
HDR_AUTHENTICATION_INFO,
HDR_PROXY_AUTHENTICATION_INFO,
- /* HDR_EXPECT, HDR_TE, HDR_TRAILER */
+ HDR_EXPECT,
#if X_ACCELERATOR_VARY
HDR_X_ACCELERATOR_VARY,
#endif
@@ -177,8 +181,8 @@
{
HDR_CACHE_CONTROL, HDR_CONNECTION, HDR_DATE, HDR_PRAGMA,
HDR_TRANSFER_ENCODING,
+ HDR_TRAILER,
HDR_UPGRADE,
- /* HDR_TRAILER, */
HDR_VIA
};
@@ -216,7 +220,7 @@
HDR_IF_MATCH, HDR_IF_MODIFIED_SINCE, HDR_IF_NONE_MATCH,
HDR_IF_RANGE, HDR_MAX_FORWARDS, HDR_PROXY_CONNECTION,
HDR_PROXY_AUTHORIZATION, HDR_RANGE, HDR_REFERER, HDR_REQUEST_RANGE,
- HDR_USER_AGENT, HDR_X_FORWARDED_FOR
+ HDR_USER_AGENT, HDR_X_FORWARDED_FOR, HDR_TE, HDR_EXPECT
};
/* header accounting */
diff -ruN squid-2.6.STABLE9/src/access_log.c squid-2.6.STABLE10/src/access_log.c
--- squid-2.6.STABLE9/src/access_log.c Thu Jan 18 17:19:26 2007
+++ squid-2.6.STABLE10/src/access_log.c Sat Feb 3 14:59:24 2007
@@ -1,6 +1,6 @@
/*
- * $Id: access_log.c,v 1.95 2007/01/19 00:19:26 hno Exp $
+ * $Id: access_log.c,v 1.95.2.1 2007/02/03 21:59:24 hno Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
@@ -300,7 +300,7 @@
/*LFT_REQUEST_QUERY, * // * this is not needed. see strip_query_terms */
LFT_REQUEST_VERSION,
-/*LFT_REQUEST_SIZE_TOTAL, */
+ LFT_REQUEST_SIZE_TOTAL,
/*LFT_REQUEST_SIZE_LINE, */
/*LFT_REQUEST_SIZE_HEADERS, */
/*LFT_REQUEST_SIZE_BODY, */
@@ -312,6 +312,8 @@
/*LFT_REPLY_SIZE_BODY, */
/*LFT_REPLY_SIZE_BODY_NO_TE, */
+ LFT_IO_SIZE_TOTAL,
+
LFT_EXT_LOG,
LFT_PERCENT /* special string cases for escaped chars */
@@ -402,20 +404,22 @@
{">v", LFT_REQUEST_VERSION},
{"rv", LFT_REQUEST_VERSION},
-/*{ ">st", LFT_REQUEST_SIZE_TOTAL }, */
+ {">st", LFT_REQUEST_SIZE_TOTAL},
/*{ ">sl", LFT_REQUEST_SIZE_LINE }, * / / * the request line "GET ... " */
/*{ ">sh", LFT_REQUEST_SIZE_HEADERS }, */
/*{ ">sb", LFT_REQUEST_SIZE_BODY }, */
/*{ ">sB", LFT_REQUEST_SIZE_BODY_NO_TE }, */
- {"ea", LFT_EXT_LOG},
-
{"cache.rq_size;
+ doint = 1;
+ break;
/*case LFT_REQUEST_SIZE_LINE: */
/*case LFT_REQUEST_SIZE_HEADERS: */
/*case LFT_REQUEST_SIZE_BODY: */
@@ -648,6 +655,11 @@
/*case LFT_REPLY_SIZE_HEADERS: */
/*case LFT_REPLY_SIZE_BODY: */
/*case LFT_REPLY_SIZE_BODY_NO_TE: */
+
+ case LFT_IO_SIZE_TOTAL:
+ outint = al->cache.size + al->cache.rq_size;
+ doint = 1;
+ break;
case LFT_EXT_LOG:
if (al->request)
diff -ruN squid-2.6.STABLE9/src/auth/negotiate/auth_negotiate.c squid-2.6.STABLE10/src/auth/negotiate/auth_negotiate.c
--- squid-2.6.STABLE9/src/auth/negotiate/auth_negotiate.c Sat Jan 20 14:13:28 2007
+++ squid-2.6.STABLE10/src/auth/negotiate/auth_negotiate.c Tue Feb 27 15:43:52 2007
@@ -1,6 +1,6 @@
/*
- * $Id: auth_negotiate.c,v 1.7 2007/01/20 21:13:28 hno Exp $
+ * $Id: auth_negotiate.c,v 1.7.2.1 2007/02/27 22:43:52 hno Exp $
*
* DEBUG: section 29 Negotiate Authenticator
* AUTHOR: Robert Collins
@@ -85,6 +85,7 @@
static auth_negotiate_config *negotiateConfig = NULL;
static void authenticateNegotiateReleaseServer(negotiate_request_t * negotiate_request);
+static int authenticateNegotiatecmpUsername(negotiate_user_t * u1, negotiate_user_t * u2);
/*
*
* Private Functions
@@ -104,12 +105,10 @@
helperStatefulFree(negotiateauthenticators);
negotiateauthenticators = NULL;
if (negotiate_request_pool) {
- assert(memPoolInUseCount(negotiate_request_pool) == 0);
memPoolDestroy(negotiate_request_pool);
negotiate_request_pool = NULL;
}
if (negotiate_user_pool) {
- assert(memPoolInUseCount(negotiate_user_pool) == 0);
memPoolDestroy(negotiate_user_pool);
negotiate_user_pool = NULL;
}
@@ -215,8 +214,7 @@
* Negotiate when the client sends a second request on an Negotiate
* connection before the authenticate challenge is sent. With
* this patch, the client may fail to authenticate, but squid's
- * state will be preserved. Caveats: this should be a post-parse
- * test, but that can wait for the modular parser to be integrated.
+ * state will be preserved.
*/
if (negotiateConfig->authenticate && Config.onoff.pipeline_prefetch != 0) {
debug(29, 1) ("pipeline prefetching incompatile with Negotiate authentication. Disabling pipeline_prefetch\n");
@@ -287,7 +285,6 @@
return 1;
case AUTHENTICATE_STATE_FAILED:
return -2;
- case AUTHENTICATE_STATE_FINISHED: /* do nothing.. */
case AUTHENTICATE_STATE_DONE: /* do nothing.. */
return 0;
case AUTHENTICATE_STATE_INITIAL:
@@ -306,8 +303,6 @@
authenticateNegotiateFixErrorHeader(auth_user_request_t * auth_user_request, HttpReply * rep, http_hdr_type type, request_t * request)
{
negotiate_request_t *negotiate_request;
- if (!request->flags.proxy_keepalive)
- return;
if (!negotiateConfig->authenticate)
return;
/* New request, no user details */
@@ -339,7 +334,6 @@
safe_free(negotiate_request->server_blob);
request->flags.must_keepalive = 1;
break;
- case AUTHENTICATE_STATE_FINISHED:
case AUTHENTICATE_STATE_DONE:
/* Special case when authentication finished, but not allowed by ACL */
if (negotiate_request->server_blob) {
@@ -488,6 +482,7 @@
auth_user_request->message = xstrdup("Authentication in progress");
debug(29, 4) ("authenticateNegotiateHandleReply: Need to challenge the client with a server blob '%s'\n", blob);
} else if (strncasecmp(reply, "AF ", 3) == 0 && arg != NULL) {
+ auth_user_hash_pointer *usernamehash;
/* we're finished, release the helper */
if (arg)
*arg++ = '\0';
@@ -498,8 +493,31 @@
safe_free(negotiate_request->server_blob);
negotiate_request->server_blob = xstrdup(blob);
debug(29, 4) ("authenticateNegotiateHandleReply: Successfully validated user via Negotiate. Username '%s'\n", arg);
+ /* this connection is authenticated */
+ debug(29, 4) ("authenticated user %s\n", negotiate_user->username);
+ /* see if this is an existing user with a different proxy_auth
+ * string */
+ usernamehash = hash_lookup(proxy_auth_username_cache, negotiate_user->username);
+ if (usernamehash) {
+ while (usernamehash && (usernamehash->auth_user->auth_type != auth_user->auth_type || authenticateNegotiatecmpUsername(usernamehash->auth_user->scheme_data, negotiate_user) != 0))
+ usernamehash = usernamehash->next;
+ }
+ if (usernamehash) {
+ /* we can't seamlessly recheck the username due to the
+ * challenge nature of the protocol. Just free the
+ * temporary auth_user */
+ authenticateAuthUserMerge(auth_user, usernamehash->auth_user);
+ auth_user = usernamehash->auth_user;
+ auth_user_request->auth_user = auth_user;
+ } else {
+ /* store user in hash's */
+ authenticateUserNameCacheAdd(auth_user);
+ }
+ /* set these to now because this is either a new login from an
+ * existing user or a new user */
+ auth_user->expiretime = current_time.tv_sec;
authenticateNegotiateReleaseServer(negotiate_request);
- negotiate_request->auth_state = AUTHENTICATE_STATE_FINISHED;
+ negotiate_request->auth_state = AUTHENTICATE_STATE_DONE;
} else if (strncasecmp(reply, "NA ", 3) == 0 && arg != NULL) {
if (arg)
*arg++ = '\0';
@@ -573,10 +591,11 @@
r->data = data;
r->auth_user_request = auth_user_request;
authenticateAuthUserRequestLock(r->auth_user_request);
- if (negotiate_request->auth_state == AUTHENTICATE_STATE_INITIAL)
+ if (negotiate_request->auth_state == AUTHENTICATE_STATE_INITIAL) {
snprintf(buf, 8192, "YR %s\n", sent_string);
- else
+ } else {
snprintf(buf, 8192, "KK %s\n", sent_string);
+ }
negotiate_request->waiting = 1;
safe_free(negotiate_request->client_blob);
helperStatefulSubmit(negotiateauthenticators, buf, authenticateNegotiateHandleReply, r, negotiate_request->authserver);
@@ -663,7 +682,6 @@
authenticateNegotiateAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData * conn, http_hdr_type type)
{
const char *proxy_auth, *blob;
- auth_user_hash_pointer *usernamehash;
auth_user_t *auth_user;
negotiate_request_t *negotiate_request;
negotiate_user_t *negotiate_user;
@@ -730,33 +748,6 @@
negotiate_request->client_blob = xstrdup(blob);
return;
break;
- case AUTHENTICATE_STATE_FINISHED:
- /* this connection is authenticated */
- debug(29, 4) ("authenticated user %s\n", negotiate_user->username);
- /* see if this is an existing user with a different proxy_auth
- * string */
- usernamehash = hash_lookup(proxy_auth_username_cache, negotiate_user->username);
- if (usernamehash) {
- while (usernamehash && (usernamehash->auth_user->auth_type != auth_user->auth_type || authenticateNegotiatecmpUsername(usernamehash->auth_user->scheme_data, negotiate_user) != 0))
- usernamehash = usernamehash->next;
- }
- if (usernamehash) {
- /* we can't seamlessly recheck the username due to the
- * challenge nature of the protocol. Just free the
- * temporary auth_user */
- authenticateAuthUserMerge(auth_user, usernamehash->auth_user);
- auth_user = usernamehash->auth_user;
- auth_user_request->auth_user = auth_user;
- } else {
- /* store user in hash's */
- authenticateUserNameCacheAdd(auth_user);
- }
- /* set these to now because this is either a new login from an
- * existing user or a new user */
- auth_user->expiretime = current_time.tv_sec;
- authenticateNegotiateReleaseServer(negotiate_request);
- negotiate_request->auth_state = AUTHENTICATE_STATE_DONE;
- return;
case AUTHENTICATE_STATE_DONE:
fatal("authenticateNegotiateAuthenticateUser: unexpect auth state DONE! Report a bug to the squid developers.\n");
break;
diff -ruN squid-2.6.STABLE9/src/auth/negotiate/auth_negotiate.h squid-2.6.STABLE10/src/auth/negotiate/auth_negotiate.h
--- squid-2.6.STABLE9/src/auth/negotiate/auth_negotiate.h Mon May 15 16:06:49 2006
+++ squid-2.6.STABLE10/src/auth/negotiate/auth_negotiate.h Tue Feb 27 15:43:52 2007
@@ -12,7 +12,6 @@
AUTHENTICATE_STATE_NONE,
AUTHENTICATE_STATE_INITIAL,
AUTHENTICATE_STATE_NEGOTIATE,
- AUTHENTICATE_STATE_FINISHED,
AUTHENTICATE_STATE_DONE,
AUTHENTICATE_STATE_FAILED
} auth_state_t; /* connection level auth state */
diff -ruN squid-2.6.STABLE9/src/auth/ntlm/auth_ntlm.c squid-2.6.STABLE10/src/auth/ntlm/auth_ntlm.c
--- squid-2.6.STABLE9/src/auth/ntlm/auth_ntlm.c Sat Jan 20 14:13:28 2007
+++ squid-2.6.STABLE10/src/auth/ntlm/auth_ntlm.c Tue Feb 27 15:43:52 2007
@@ -1,6 +1,6 @@
/*
- * $Id: auth_ntlm.c,v 1.37 2007/01/20 21:13:28 hno Exp $
+ * $Id: auth_ntlm.c,v 1.37.2.1 2007/02/27 22:43:52 hno Exp $
*
* DEBUG: section 29 NTLM Authenticator
* AUTHOR: Robert Collins
@@ -84,6 +84,7 @@
static auth_ntlm_config *ntlmConfig = NULL;
static void authenticateNTLMReleaseServer(ntlm_request_t * ntlm_request);
+static int authenticateNTLMcmpUsername(ntlm_user_t * u1, ntlm_user_t * u2);
/*
*
* Private Functions
@@ -282,7 +283,6 @@
return 1;
case AUTHENTICATE_STATE_FAILED:
return -2;
- case AUTHENTICATE_STATE_FINISHED: /* do nothing.. */
case AUTHENTICATE_STATE_DONE: /* do nothing.. */
return 0;
case AUTHENTICATE_STATE_INITIAL:
@@ -332,7 +332,6 @@
safe_free(ntlm_request->server_blob);
request->flags.must_keepalive = 1;
break;
- case AUTHENTICATE_STATE_FINISHED:
case AUTHENTICATE_STATE_DONE:
/* Special case when authentication finished, but not allowed by ACL */
debug(29, 9) ("authenticateNTLMFixErrorHeader: Sending type:%d header: 'NTLM'\n", type);
@@ -450,14 +449,38 @@
auth_user_request->message = xstrdup("Authentication in progress");
debug(29, 4) ("authenticateNTLMHandleReply: Need to challenge the client with a server blob '%s'\n", blob);
} else if (strncasecmp(reply, "AF ", 3) == 0) {
+ auth_user_hash_pointer *usernamehash;
/* we're finished, release the helper */
safe_free(ntlm_user->username);
ntlm_user->username = xstrdup(blob);
safe_free(auth_user_request->message);
auth_user_request->message = xstrdup("Login successful");
debug(29, 4) ("authenticateNTLMHandleReply: Successfully validated user via NTLM. Username '%s'\n", blob);
+ /* this connection is authenticated */
+ debug(29, 4) ("authenticated user %s\n", ntlm_user->username);
+ /* see if this is an existing user with a different proxy_auth
+ * string */
+ usernamehash = hash_lookup(proxy_auth_username_cache, ntlm_user->username);
+ if (usernamehash) {
+ while (usernamehash && (usernamehash->auth_user->auth_type != auth_user->auth_type || authenticateNTLMcmpUsername(usernamehash->auth_user->scheme_data, ntlm_user) != 0))
+ usernamehash = usernamehash->next;
+ }
+ if (usernamehash) {
+ /* we can't seamlessly recheck the username due to the
+ * challenge nature of the protocol. Just free the
+ * temporary auth_user */
+ authenticateAuthUserMerge(auth_user, usernamehash->auth_user);
+ auth_user = usernamehash->auth_user;
+ auth_user_request->auth_user = auth_user;
+ } else {
+ /* store user in hash's */
+ authenticateUserNameCacheAdd(auth_user);
+ }
+ /* set these to now because this is either a new login from an
+ * existing user or a new user */
+ auth_user->expiretime = current_time.tv_sec;
authenticateNTLMReleaseServer(ntlm_request);
- ntlm_request->auth_state = AUTHENTICATE_STATE_FINISHED;
+ ntlm_request->auth_state = AUTHENTICATE_STATE_DONE;
} else if (strncasecmp(reply, "NA ", 3) == 0) {
safe_free(auth_user_request->message);
auth_user_request->message = xstrdup(blob);
@@ -618,7 +641,6 @@
authenticateNTLMAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData * conn, http_hdr_type type)
{
const char *proxy_auth, *blob;
- auth_user_hash_pointer *usernamehash;
auth_user_t *auth_user;
ntlm_request_t *ntlm_request;
ntlm_user_t *ntlm_user;
@@ -685,33 +707,6 @@
ntlm_request->client_blob = xstrdup(blob);
return;
break;
- case AUTHENTICATE_STATE_FINISHED:
- /* this connection is authenticated */
- debug(29, 4) ("authenticated user %s\n", ntlm_user->username);
- /* see if this is an existing user with a different proxy_auth
- * string */
- usernamehash = hash_lookup(proxy_auth_username_cache, ntlm_user->username);
- if (usernamehash) {
- while (usernamehash && (usernamehash->auth_user->auth_type != auth_user->auth_type || authenticateNTLMcmpUsername(usernamehash->auth_user->scheme_data, ntlm_user) != 0))
- usernamehash = usernamehash->next;
- }
- if (usernamehash) {
- /* we can't seamlessly recheck the username due to the
- * challenge nature of the protocol. Just free the
- * temporary auth_user */
- authenticateAuthUserMerge(auth_user, usernamehash->auth_user);
- auth_user = usernamehash->auth_user;
- auth_user_request->auth_user = auth_user;
- } else {
- /* store user in hash's */
- authenticateUserNameCacheAdd(auth_user);
- }
- /* set these to now because this is either a new login from an
- * existing user or a new user */
- auth_user->expiretime = current_time.tv_sec;
- authenticateNTLMReleaseServer(ntlm_request);
- ntlm_request->auth_state = AUTHENTICATE_STATE_DONE;
- return;
case AUTHENTICATE_STATE_DONE:
fatal("authenticateNTLMAuthenticateUser: unexpect auth state DONE! Report a bug to the squid developers.\n");
break;
diff -ruN squid-2.6.STABLE9/src/auth/ntlm/auth_ntlm.h squid-2.6.STABLE10/src/auth/ntlm/auth_ntlm.h
--- squid-2.6.STABLE9/src/auth/ntlm/auth_ntlm.h Sat Jun 10 18:27:36 2006
+++ squid-2.6.STABLE10/src/auth/ntlm/auth_ntlm.h Tue Feb 27 15:43:52 2007
@@ -12,7 +12,6 @@
AUTHENTICATE_STATE_NONE,
AUTHENTICATE_STATE_INITIAL,
AUTHENTICATE_STATE_NEGOTIATE,
- AUTHENTICATE_STATE_FINISHED,
AUTHENTICATE_STATE_DONE,
AUTHENTICATE_STATE_FAILED
} auth_state_t; /* connection level auth state */
diff -ruN squid-2.6.STABLE9/src/cache_cf.c squid-2.6.STABLE10/src/cache_cf.c
--- squid-2.6.STABLE9/src/cache_cf.c Thu Jan 18 16:19:14 2007
+++ squid-2.6.STABLE10/src/cache_cf.c Mon Feb 26 15:45:24 2007
@@ -1,6 +1,6 @@
/*
- * $Id: cache_cf.c,v 1.463 2007/01/18 23:19:14 hno Exp $
+ * $Id: cache_cf.c,v 1.463.2.1 2007/02/26 22:45:24 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
@@ -1765,7 +1765,6 @@
if (p->weight < 1)
p->weight = 1;
p->icp.version = ICP_VERSION_CURRENT;
- p->tcp_up = PEER_TCP_MAGIC_COUNT;
p->test_fd = -1;
#if USE_CACHE_DIGESTS
if (!p->options.no_digest) {
diff -ruN squid-2.6.STABLE9/src/cf.data.pre squid-2.6.STABLE10/src/cf.data.pre
--- squid-2.6.STABLE9/src/cf.data.pre Fri Jan 19 15:03:03 2007
+++ squid-2.6.STABLE10/src/cf.data.pre Sat Feb 3 14:59:24 2007
@@ -1,6 +1,6 @@
#
-# $Id: cf.data.pre,v 1.382 2007/01/19 22:03:03 hno Exp $
+# $Id: cf.data.pre,v 1.382.2.1 2007/02/03 21:59:24 hno Exp $
#
#
# SQUID Web Proxy Cache http://www.squid-cache.org/
@@ -1273,6 +1273,8 @@
rv Request protocol version
ea Log string returned by external acl
st Request size including HTTP headers
+ st Request+Reply size including HTTP headers
% a literal % character
logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %entry->mem_obj->reply->sline.status == HTTP_OK;
debug(33, 3) ("clientProcessExpired: '%s'\n", http->uri);
/*
* check if we are allowed to contact other servers
@@ -841,18 +842,21 @@
/* delay_id is already set on original store client */
delaySetStoreClient(http->sc, delayClient(http));
#endif
- if (http->old_entry->lastmod > 0)
+ if (can_revalidate && http->old_entry->lastmod > 0) {
http->request->lastmod = http->old_entry->lastmod;
- else if (http->old_entry->mem_obj && http->old_entry->mem_obj->reply)
- http->request->lastmod = http->old_entry->mem_obj->reply->date;
- else
+ http->request->flags.cache_validation = 1;
+ } else
http->request->lastmod = -1;
debug(33, 5) ("clientProcessExpired: lastmod %ld\n", (long int) entry->lastmod);
http->entry = entry;
http->out.offset = 0;
- etag = httpHeaderGetStr(&http->old_entry->mem_obj->reply->header, HDR_ETAG);
- if (etag)
- http->request->etag = xstrdup(etag);
+ if (can_revalidate) {
+ etag = httpHeaderGetStr(&http->old_entry->mem_obj->reply->header, HDR_ETAG);
+ if (etag) {
+ http->request->etag = xstrdup(etag);
+ http->request->flags.cache_validation = 1;
+ }
+ }
if (!hit)
fwdStart(http->conn->fd, http->entry, http->request);
/* Register with storage manager to receive updates when data comes in. */
@@ -880,6 +884,12 @@
debug(33, 3) ("clientGetsOldEntry: YES, failure reply=%d\n", status);
return 1;
}
+ /* If the reply is not to a cache validation conditional then
+ * we should forward it to the client */
+ if (!request->flags.cache_validation) {
+ debug(33, 5) ("clientGetsOldEntry: NO, not a cache validation\n");
+ return 0;
+ }
/* If the reply is anything but "Not Modified" then
* we must forward it to the client */
if (HTTP_NOT_MODIFIED != status) {
@@ -995,7 +1005,6 @@
http->sc = http->old_sc;
storeUnlockObject(entry);
entry = http->entry = oldentry;
- entry->timestamp = squid_curtime;
if (unlink_request) {
requestUnlink(entry->mem_obj->request);
entry->mem_obj->request = NULL;
@@ -1010,6 +1019,9 @@
storeTimestampsSet(http->old_entry);
http->log_type = LOG_TCP_REFRESH_HIT;
}
+ /* Get rid of the old entry if not a cache validation */
+ if (!http->request->flags.cache_validation)
+ storeRelease(http->old_entry);
storeClientUnregister(http->old_sc, http->old_entry, http);
storeUnlockObject(http->old_entry);
recopy = 0;
@@ -1037,8 +1049,6 @@
MemObject *mem = entry->mem_obj;
time_t mod_time = entry->lastmod;
debug(33, 3) ("modifiedSince: '%s'\n", storeUrl(entry));
- if (mod_time < 0)
- mod_time = entry->timestamp;
debug(33, 3) ("modifiedSince: mod_time = %ld\n", (long int) mod_time);
if (mod_time < 0)
return 1;
@@ -1276,7 +1286,9 @@
http->al.cache.size = http->out.size;
http->al.cache.code = http->log_type;
http->al.cache.msec = tvSubMsec(http->start, current_time);
+ http->al.cache.rq_size = http->req_sz;
if (request) {
+ http->al.cache.rq_size += request->content_length;
if (Config.onoff.log_mime_hdrs) {
Packer p;
MemBuf mb;
@@ -1842,6 +1854,9 @@
/* remove Set-Cookie if a hit */
if (http->flags.hit)
httpHeaderDelById(hdr, HDR_SET_COOKIE);
+ httpHeaderDelById(hdr, HDR_TRAILER);
+ httpHeaderDelById(hdr, HDR_TRANSFER_ENCODING);
+ httpHeaderDelById(hdr, HDR_UPGRADE);
/* handle Connection header */
if (httpHeaderHas(hdr, HDR_CONNECTION)) {
/* anything that matches Connection list member will be deleted */
@@ -1900,6 +1915,10 @@
} else if (http->entry->timestamp < squid_curtime)
httpHeaderPutInt(hdr, HDR_AGE,
squid_curtime - http->entry->timestamp);
+ if (!httpHeaderHas(hdr, HDR_CONTENT_LENGTH) && http->entry->mem_obj && http->entry->store_status == STORE_OK) {
+ rep->content_length = contentLen(http->entry);
+ httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, rep->content_length);
+ }
}
/* Filter unproxyable authentication types */
if (http->log_type != LOG_TCP_DENIED &&
@@ -1967,9 +1986,9 @@
}
/* Append Via */
{
- LOCAL_ARRAY(char, bbuf, MAX_URL + 32);
+ char bbuf[MAX_URL + 32];
String strVia = httpHeaderGetList(hdr, HDR_VIA);
- snprintf(bbuf, sizeof(bbuf), "%d.%d %s",
+ snprintf(bbuf, MAX_URL + 32, "%d.%d %s",
rep->sline.version.major,
rep->sline.version.minor, ThisCache);
strListAdd(&strVia, bbuf, ',');
@@ -2177,23 +2196,16 @@
return;
}
if (httpHeaderHas(&r->header, HDR_IF_MATCH)) {
- String req_etags;
const char *rep_etag = httpHeaderGetStr(&e->mem_obj->reply->header, HDR_ETAG);
- int has_etag;
- if (!rep_etag) {
- /* The cached object does not have a entity tag. This cannot
- * be a hit for the requested object.
- */
- http->log_type = LOG_TCP_MISS;
- clientProcessMiss(http);
- return;
+ int has_etag = 0;
+ if (rep_etag) {
+ String req_etags = httpHeaderGetList(&http->request->header, HDR_IF_MATCH);
+ has_etag = strListIsMember(&req_etags, rep_etag, ',');
+ stringClean(&req_etags);
}
- req_etags = httpHeaderGetList(&http->request->header, HDR_IF_MATCH);
- has_etag = strListIsMember(&req_etags, rep_etag, ',');
- stringClean(&req_etags);
if (!has_etag) {
- /* The entity tags does not match. This cannot be a
- * hit for this object. Query the origin.
+ /* The entity tags does not match. This cannot be a hit for this object.
+ * Query the origin to see what should be done.
*/
http->log_type = LOG_TCP_MISS;
clientProcessMiss(http);
@@ -2225,17 +2237,7 @@
}
}
}
- if (r->flags.ims) {
- /*
- * Handle If-Modified-Since requests from the client
- */
- if (mem->reply->sline.status != HTTP_OK) {
- debug(33, 4) ("clientCacheHit: Reply code %d != 200\n",
- mem->reply->sline.status);
- http->log_type = LOG_TCP_MISS;
- clientProcessMiss(http);
- return;
- }
+ if (r->flags.ims && mem->reply->sline.status == HTTP_OK) {
if (modifiedSince(e, http->request)) {
debug(33, 4) ("clientCacheHit: If-Modified-Since modified\n");
is_modified = 1;
@@ -2273,16 +2275,6 @@
* both have a stale version of the object.
*/
r->flags.need_validation = 1;
-#if 0
- if (e->lastmod < 0) {
- /*
- * Previous reply didn't have a Last-Modified header,
- * we cannot revalidate it.
- */
- http->log_type = LOG_TCP_MISS;
- clientProcessMiss(http);
- } else
-#endif
if (r->flags.nocache) {
/*
* This did not match a refresh pattern that overrides no-cache
@@ -3112,10 +3104,7 @@
} else if ((done = clientCheckTransferDone(http)) != 0 || size == 0) {
debug(33, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd);
/* We're finished case */
- if (httpReplyBodySize(http->request->method, entry->mem_obj->reply) < 0) {
- debug(33, 5) ("clientWriteComplete: closing, content_length < 0\n");
- comm_close(fd);
- } else if (!done) {
+ if (!done) {
debug(33, 5) ("clientWriteComplete: closing, !done\n");
comm_close(fd);
} else if (clientGotNotEnough(http)) {
@@ -3479,6 +3468,7 @@
http->uri = xstrdup(uri);
http->log_uri = xstrndup(uri, MAX_URL);
http->range_iter.boundary = StringNull;
+ httpBuildVersion(&http->http_ver, 1, 0);
dlinkAdd(http, &http->active, &ClientActiveRequests);
return http;
}
@@ -4783,7 +4773,8 @@
{
squid_off_t cl = httpReplyBodySize(http->request->method, http->entry->mem_obj->reply);
int hs = http->entry->mem_obj->reply->hdr_sz;
- assert(cl >= 0);
+ if (cl < 0)
+ return 0;
if (http->out.offset != cl + hs)
return 1;
return 0;
diff -ruN squid-2.6.STABLE9/src/defines.h squid-2.6.STABLE10/src/defines.h
--- squid-2.6.STABLE9/src/defines.h Wed Nov 29 08:58:52 2006
+++ squid-2.6.STABLE10/src/defines.h Sat Feb 3 15:58:20 2007
@@ -1,6 +1,6 @@
/*
- * $Id: defines.h,v 1.122 2006/11/29 15:58:52 adrian Exp $
+ * $Id: defines.h,v 1.122.2.1 2007/02/03 22:58:20 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
@@ -216,11 +216,21 @@
#if HAVE_SOCKETPAIR && defined (AF_UNIX)
#define IPC_STREAM IPC_UNIX_STREAM
-#define IPC_DGRAM IPC_UNIX_DGRAM
#else
#define IPC_STREAM IPC_TCP_SOCKET
+#endif
+
+/*
+ * Do NOT use IPC_UNIX_DGRAM here because you can't
+ * send() more than 4096 bytes on a socketpair() socket
+ * at least on FreeBSD
+ */
+#if HAVE_SOCKETPAIR && defined (AF_UNIX) && SUPPORTS_LARGE_AF_UNIX_DGRAM
+#define IPC_DGRAM IPC_UNIX_DGRAM
+#else
#define IPC_DGRAM IPC_UDP_SOCKET
#endif
+
#define STORE_META_KEY STORE_META_KEY_MD5
diff -ruN squid-2.6.STABLE9/src/enums.h squid-2.6.STABLE10/src/enums.h
--- squid-2.6.STABLE9/src/enums.h Sun Jan 21 03:26:44 2007
+++ squid-2.6.STABLE10/src/enums.h Sat Mar 3 11:34:13 2007
@@ -1,6 +1,6 @@
/*
- * $Id: enums.h,v 1.237.2.1 2007/01/21 10:26:44 hno Exp $
+ * $Id: enums.h,v 1.237.2.3 2007/03/03 18:34:13 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
@@ -209,6 +209,9 @@
HDR_CONTENT_MD5,
HDR_CONTENT_RANGE,
HDR_CONTENT_TYPE,
+ HDR_TE,
+ HDR_TRANSFER_ENCODING,
+ HDR_TRAILER,
HDR_COOKIE,
HDR_DATE,
HDR_ETAG,
@@ -236,12 +239,11 @@
HDR_RETRY_AFTER,
HDR_SERVER,
HDR_SET_COOKIE,
- HDR_TITLE,
- HDR_TRANSFER_ENCODING,
HDR_UPGRADE,
HDR_USER_AGENT,
HDR_VARY,
HDR_VIA,
+ HDR_EXPECT,
HDR_WARNING,
HDR_WWW_AUTHENTICATE,
HDR_AUTHENTICATION_INFO,
@@ -416,6 +418,9 @@
METHOD_UNSUBSCRIBE,
METHOD_POLL,
METHOD_REPORT,
+ METHOD_MKACTIVITY,
+ METHOD_CHECKOUT,
+ METHOD_MERGE,
/* Extension methods must be last, Add any new methods before this line */
METHOD_EXT00,
METHOD_EXT01,
diff -ruN squid-2.6.STABLE9/src/forward.c squid-2.6.STABLE10/src/forward.c
--- squid-2.6.STABLE9/src/forward.c Thu Jan 18 17:21:01 2007
+++ squid-2.6.STABLE10/src/forward.c Sat Feb 3 14:53:38 2007
@@ -1,6 +1,6 @@
/*
- * $Id: forward.c,v 1.120 2007/01/19 00:21:01 hno Exp $
+ * $Id: forward.c,v 1.120.2.1 2007/02/03 21:53:38 hno Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
@@ -530,7 +530,7 @@
fwdState->origin_tries++;
comm_add_close_handler(fd, fwdServerClosed, fwdState);
if (fs->peer)
- hierarchyNote(&fwdState->request->hier, fs->code, fs->peer->host);
+ hierarchyNote(&fwdState->request->hier, fs->code, fs->peer->name);
else if (Config.onoff.log_ip_on_direct && fs->code == HIER_DIRECT)
hierarchyNote(&fwdState->request->hier, fs->code, fd_table[fd].ipaddr);
else
@@ -588,7 +588,7 @@
fwdConnectTimeout,
fwdState);
if (fs->peer) {
- hierarchyNote(&fwdState->request->hier, fs->code, fs->peer->host);
+ hierarchyNote(&fwdState->request->hier, fs->code, fs->peer->name);
} else {
#if LINUX_TPROXY
if (fwdState->request->flags.tproxy) {
diff -ruN squid-2.6.STABLE9/src/fs/aufs/store_dir_aufs.c squid-2.6.STABLE10/src/fs/aufs/store_dir_aufs.c
--- squid-2.6.STABLE9/src/fs/aufs/store_dir_aufs.c Sat Nov 25 13:07:41 2006
+++ squid-2.6.STABLE10/src/fs/aufs/store_dir_aufs.c Sat Mar 3 06:34:51 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_dir_aufs.c,v 1.67 2006/11/25 20:07:41 serassio Exp $
+ * $Id: store_dir_aufs.c,v 1.67.2.1 2007/03/03 13:34:51 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
@@ -598,7 +598,7 @@
(void) 0;
} else if (s.op == SWAP_LOG_DEL) {
/* Delete unless we already have a newer copy */
- if ((e = storeGet(s.key)) != NULL && s.lastref > e->lastref) {
+ if ((e = storeGet(s.key)) != NULL && s.lastref >= e->lastref) {
/*
* Make sure we don't unlink the file, it might be
* in use by a subsequent entry. Also note that
@@ -746,7 +746,7 @@
(void) 0;
} else if (s.op == SWAP_LOG_DEL) {
/* Delete unless we already have a newer copy */
- if ((e = storeGet(s.key)) != NULL && s.lastref > e->lastref) {
+ if ((e = storeGet(s.key)) != NULL && s.lastref >= e->lastref) {
/*
* Make sure we don't unlink the file, it might be
* in use by a subsequent entry. Also note that
diff -ruN squid-2.6.STABLE9/src/fs/coss/store_dir_coss.c squid-2.6.STABLE10/src/fs/coss/store_dir_coss.c
--- squid-2.6.STABLE9/src/fs/coss/store_dir_coss.c Sun Nov 5 14:14:32 2006
+++ squid-2.6.STABLE10/src/fs/coss/store_dir_coss.c Sat Mar 3 06:32:44 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_dir_coss.c,v 1.66 2006/11/05 21:14:32 hno Exp $
+ * $Id: store_dir_coss.c,v 1.66.2.1 2007/03/03 13:32:44 hno Exp $
*
* DEBUG: section 47 Store COSS Directory Routines
* AUTHOR: Eric Stern
@@ -627,6 +627,8 @@
storeCossDirShutdown(SwapDir * SD)
{
CossInfo *cs = (CossInfo *) SD->fsdata;
+ if (cs->fd == -1)
+ return;
debug(47, 1) ("COSS: %s: syncing\n", stripePath(SD));
storeCossSync(SD); /* This'll call a_file_syncqueue() or a aioSync() */
@@ -1066,28 +1068,17 @@
for (i = 0; i < Config.cacheSwap.n_configured; i++) {
SD = &Config.cacheSwap.swapDirs[i];
if (strcmp(SD->type, SWAPDIR_COSS) == 0) {
- if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
- last_coss_pick_index = i;
- return SD;
- } else if (choosenext) {
- last_coss_pick_index = i;
- return SD;
- } else if (last_coss_pick_index == i) {
- choosenext = 1;
- }
- }
- }
- for (i = 0; i < Config.cacheSwap.n_configured; i++) {
- SD = &Config.cacheSwap.swapDirs[i];
- if (strcmp(SD->type, SWAPDIR_COSS) == 0) {
- if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
- last_coss_pick_index = i;
- return SD;
- } else if (choosenext) {
- last_coss_pick_index = i;
- return SD;
- } else if (last_coss_pick_index == i) {
- choosenext = 1;
+ CossInfo *cs = (CossInfo *) SD->fsdata;
+ if (cs->fd != -1) {
+ if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) {
+ last_coss_pick_index = i;
+ return SD;
+ } else if (choosenext) {
+ last_coss_pick_index = i;
+ return SD;
+ } else if (last_coss_pick_index == i) {
+ choosenext = 1;
+ }
}
}
}
diff -ruN squid-2.6.STABLE9/src/fs/diskd/diskd.c squid-2.6.STABLE10/src/fs/diskd/diskd.c
--- squid-2.6.STABLE9/src/fs/diskd/diskd.c Tue May 17 10:56:43 2005
+++ squid-2.6.STABLE10/src/fs/diskd/diskd.c Sat Feb 3 14:48:16 2007
@@ -1,5 +1,5 @@
/*
- * $Id: diskd.c,v 1.11 2005/05/17 16:56:43 hno Exp $
+ * $Id: diskd.c,v 1.11.2.1 2007/02/03 21:48:16 hno Exp $
*
* DEBUG: section -- External DISKD process implementation.
* AUTHOR: Harvest Derived
@@ -221,9 +221,12 @@
{
char *buf = NULL;
s->mtype = r->mtype;
+ s->id = r->id;
+ s->seq_no = r->seq_no; /* optional, debugging */
s->callback_data = r->callback_data;
+ s->size = 0; /* optional, debugging */
+ s->offset = 0; /* optional, debugging */
s->shm_offset = r->shm_offset;
- s->id = r->id;
if (s->shm_offset > -1)
buf = shmbuf + s->shm_offset;
switch (r->mtype) {
diff -ruN squid-2.6.STABLE9/src/fs/diskd/store_dir_diskd.c squid-2.6.STABLE10/src/fs/diskd/store_dir_diskd.c
--- squid-2.6.STABLE9/src/fs/diskd/store_dir_diskd.c Sun Nov 5 14:32:12 2006
+++ squid-2.6.STABLE10/src/fs/diskd/store_dir_diskd.c Sat Mar 3 06:34:51 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_dir_diskd.c,v 1.87 2006/11/05 21:32:12 hno Exp $
+ * $Id: store_dir_diskd.c,v 1.87.2.1 2007/03/03 13:34:51 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
@@ -789,7 +789,7 @@
}
} else if (s.op == SWAP_LOG_DEL) {
/* Delete unless we already have a newer copy */
- if ((e = storeGet(s.key)) != NULL && s.lastref > e->lastref) {
+ if ((e = storeGet(s.key)) != NULL && s.lastref >= e->lastref) {
/*
* Make sure we don't unlink the file, it might be
* in use by a subsequent entry. Also note that
@@ -962,7 +962,7 @@
}
} else if (s.op == SWAP_LOG_DEL) {
/* Delete unless we already have a newer copy */
- if ((e = storeGet(s.key)) != NULL && s.lastref > e->lastref) {
+ if ((e = storeGet(s.key)) != NULL && s.lastref >= e->lastref) {
/*
* Make sure we don't unlink the file, it might be
* in use by a subsequent entry. Also note that
diff -ruN squid-2.6.STABLE9/src/fs/diskd/store_io_diskd.c squid-2.6.STABLE10/src/fs/diskd/store_io_diskd.c
--- squid-2.6.STABLE9/src/fs/diskd/store_io_diskd.c Tue Jan 23 18:54:48 2007
+++ squid-2.6.STABLE10/src/fs/diskd/store_io_diskd.c Sat Feb 3 14:54:16 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_io_diskd.c,v 1.33.2.1 2007/01/24 01:54:48 hno Exp $
+ * $Id: store_io_diskd.c,v 1.33.2.4 2007/02/03 21:54:16 hno Exp $
*
* DEBUG: section 79 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
@@ -443,6 +443,9 @@
}
return;
}
+ /* set errno passed from diskd. makes debugging more meaningful */
+ if (M->status < 0)
+ errno = -M->status;
switch (M->mtype) {
case _MQD_OPEN:
storeDiskdOpenDone(M);
@@ -469,7 +472,7 @@
storeDiskdIOCallback(storeIOState * sio, int errflag)
{
void *p = sio->callback_data;
- debug(79, 3) ("storeUfsIOCallback: errflag=%d\n", errflag);
+ debug(79, 3) ("storeDiskdIOCallback: errflag=%d\n", errflag);
if (cbdataValid(p))
sio->callback(p, errflag, sio);
cbdataUnlock(p);
@@ -485,6 +488,9 @@
static int last_seq_no = 0;
static int seq_no = 0;
diskdinfo_t *diskdinfo = sd->fsdata;
+ struct timeval delay =
+ {0, 1};
+
M.mtype = mtype;
M.callback_data = sio;
M.size = size;
@@ -497,35 +503,42 @@
cbdataLock(M.callback_data);
if (M.seq_no < last_seq_no)
debug(79, 1) ("WARNING: sequencing out of order\n");
- x = msgsnd(diskdinfo->smsgid, &M, msg_snd_rcv_sz, IPC_NOWAIT);
- last_seq_no = M.seq_no;
- if (0 == x) {
- diskd_stats.sent_count++;
- diskdinfo->away++;
- } else {
- debug(79, 1) ("storeDiskdSend: msgsnd: %s\n", xstrerror());
- if (M.callback_data)
- cbdataUnlock(M.callback_data);
- assert(++send_errors < 100);
- }
+
/*
* We have to drain the queue here if necessary. If we don't,
* then we can have a lot of messages in the queue (probably
* up to 2*magic1) and we can run out of shared memory buffers.
*/
/*
+ * NOTE that it is important that we call storeDirCallback AFTER
+ * locking the callback data M.callback_data because we need
+ * to make sure the cbdata lock count doesn't go to zero (and
+ * get freed) before we have a chance to send the current message
+ * M!
+ */
+ /*
* Note that we call storeDirCallback (for all SDs), rather
* than storeDiskdDirCallback for just this SD, so that while
* we're "blocking" on this SD we can also handle callbacks
* from other SDs that might be ready.
*/
while (diskdinfo->away > diskdinfo->magic2) {
- struct timeval delay =
- {0, 1};
select(0, NULL, NULL, NULL, &delay);
storeDirCallback();
if (delay.tv_usec < 1000000)
delay.tv_usec <<= 1;
+ }
+
+ x = msgsnd(diskdinfo->smsgid, &M, msg_snd_rcv_sz, IPC_NOWAIT);
+ last_seq_no = M.seq_no;
+ if (0 == x) {
+ diskd_stats.sent_count++;
+ diskdinfo->away++;
+ } else {
+ debug(79, 1) ("storeDiskdSend: msgsnd: %s\n", xstrerror());
+ if (M.callback_data)
+ cbdataUnlock(M.callback_data);
+ assert(++send_errors < 100);
}
return x;
}
diff -ruN squid-2.6.STABLE9/src/fs/ufs/store_dir_ufs.c squid-2.6.STABLE10/src/fs/ufs/store_dir_ufs.c
--- squid-2.6.STABLE9/src/fs/ufs/store_dir_ufs.c Sun Nov 5 14:32:13 2006
+++ squid-2.6.STABLE10/src/fs/ufs/store_dir_ufs.c Sat Mar 3 06:34:52 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_dir_ufs.c,v 1.63 2006/11/05 21:32:13 hno Exp $
+ * $Id: store_dir_ufs.c,v 1.63.2.1 2007/03/03 13:34:52 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
@@ -603,7 +603,7 @@
(void) 0;
} else if (s.op == SWAP_LOG_DEL) {
/* Delete unless we already have a newer copy */
- if ((e = storeGet(s.key)) != NULL && s.lastref > e->lastref) {
+ if ((e = storeGet(s.key)) != NULL && s.lastref >= e->lastref) {
/*
* Make sure we don't unlink the file, it might be
* in use by a subsequent entry. Also note that
@@ -751,7 +751,7 @@
(void) 0;
} else if (s.op == SWAP_LOG_DEL) {
/* Delete unless we already have a newer copy */
- if ((e = storeGet(s.key)) != NULL && s.lastref > e->lastref) {
+ if ((e = storeGet(s.key)) != NULL && s.lastref >= e->lastref) {
/*
* Make sure we don't unlink the file, it might be
* in use by a subsequent entry. Also note that
diff -ruN squid-2.6.STABLE9/src/ftp.c squid-2.6.STABLE10/src/ftp.c
--- squid-2.6.STABLE9/src/ftp.c Thu Jan 18 17:52:49 2007
+++ squid-2.6.STABLE10/src/ftp.c Mon Feb 26 15:48:48 2007
@@ -1,6 +1,6 @@
/*
- * $Id: ftp.c,v 1.342 2007/01/19 00:52:49 hno Exp $
+ * $Id: ftp.c,v 1.342.2.1 2007/02/26 22:48:48 hno Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
@@ -393,18 +393,14 @@
assert(strLen(ftpState->title_url) >= 6);
k = 6 + strcspn(&title[6], "/");
for (i = 6, j = 0; title[i]; j = i) {
- storeAppendPrintf(e, " j) {
char *url = xstrdup(title);
url[i] = '\0';
- storeAppendPrintf(e, "%s", html_quote(url + k));
- storeAppendPrintf(e, "/");
- storeAppendPrintf(e, "\">");
+ storeAppendPrintf(e, "", html_quote(url + k));
rfc1738_unescape(url + j);
- storeAppendPrintf(e, "%s", html_quote(url + j));
+ storeAppendPrintf(e, "%s", html_quote(url + j));
safe_free(url);
- storeAppendPrintf(e, "");
}
storeAppendPrintf(e, "/");
if (title[i] == '/')
diff -ruN squid-2.6.STABLE9/src/gopher.c squid-2.6.STABLE10/src/gopher.c
--- squid-2.6.STABLE9/src/gopher.c Fri Aug 25 06:26:07 2006
+++ squid-2.6.STABLE10/src/gopher.c Mon Feb 26 16:53:44 2007
@@ -1,6 +1,6 @@
/*
- * $Id: gopher.c,v 1.178 2006/08/25 12:26:07 serassio Exp $
+ * $Id: gopher.c,v 1.178.2.1 2007/02/26 23:53:44 hno Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
@@ -89,7 +89,6 @@
} GopherStateData;
static PF gopherStateFree;
-static void gopher_mime_content(MemBuf * mb, const char *name, const char *def);
static void gopherMimeCreate(GopherStateData *);
static void gopher_request_parse(const request_t * req,
char *type_id,
@@ -101,9 +100,6 @@
static CWCB gopherSendComplete;
static PF gopherSendRequest;
-static char def_gopher_bin[] = "www/unknown";
-static char def_gopher_text[] = "text/plain";
-
static void
gopherStateFree(int fdnotused, void *data)
{
@@ -122,71 +118,65 @@
}
-/* figure out content type from file extension */
-static void
-gopher_mime_content(MemBuf * mb, const char *name, const char *def_ctype)
-{
- char *ctype = mimeGetContentType(name);
- char *cenc = mimeGetContentEncoding(name);
- if (cenc)
- memBufPrintf(mb, "Content-Encoding: %s\r\n", cenc);
- memBufPrintf(mb, "Content-Type: %s\r\n",
- ctype ? ctype : def_ctype);
-}
-
-
-
/* create MIME Header for Gopher Data */
static void
gopherMimeCreate(GopherStateData * gopherState)
{
- MemBuf mb;
-
- memBufDefInit(&mb);
-
- memBufPrintf(&mb,
- "HTTP/1.0 200 OK Gatewaying\r\n"
- "Server: Squid/%s\r\n"
- "Date: %s\r\n",
- version_string, mkrfc1123(squid_curtime));
+ StoreEntry *e = gopherState->entry;
+ HttpReply *reply = e->mem_obj->reply;
+ http_version_t version;
+ const char *mime_type = NULL;
+ const char *mime_enc = NULL;
switch (gopherState->type_id) {
-
case GOPHER_DIRECTORY:
case GOPHER_INDEX:
case GOPHER_HTML:
case GOPHER_WWW:
case GOPHER_CSO:
- memBufPrintf(&mb, "Content-Type: text/html\r\n");
+ mime_type = "text/html";
break;
case GOPHER_GIF:
case GOPHER_IMAGE:
case GOPHER_PLUS_IMAGE:
- memBufPrintf(&mb, "Content-Type: image/gif\r\n");
+ mime_type = "image/gif";
break;
case GOPHER_SOUND:
case GOPHER_PLUS_SOUND:
- memBufPrintf(&mb, "Content-Type: audio/basic\r\n");
+ mime_type = "audio/basic";
break;
case GOPHER_PLUS_MOVIE:
- memBufPrintf(&mb, "Content-Type: video/mpeg\r\n");
+ mime_type = "video/mpeg";
break;
case GOPHER_MACBINHEX:
+ mime_type = "application/macbinary";
+ break;
case GOPHER_DOSBIN:
case GOPHER_UUENCODED:
case GOPHER_BIN:
- /* Rightnow We have no idea what it is. */
- gopher_mime_content(&mb, gopherState->request, def_gopher_bin);
- break;
case GOPHER_FILE:
default:
- gopher_mime_content(&mb, gopherState->request, def_gopher_text);
+ /* Rightnow We have no idea what it is. */
+ mime_type = mimeGetContentType(gopherState->request);
+ mime_enc = mimeGetContentEncoding(gopherState->request);
break;
}
- memBufPrintf(&mb, "\r\n");
+
+ storeBuffer(e);
+ httpReplyReset(reply);
EBIT_CLR(gopherState->entry->flags, ENTRY_FWD_HDR_WAIT);
- storeAppend(gopherState->entry, mb.buf, mb.size);
- memBufClean(&mb);
+ httpBuildVersion(&version, 1, 0);
+ httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying", mime_type, -1, -1, -1);
+ if (mime_enc)
+ httpHeaderPutStr(&reply->header, HDR_CONTENT_ENCODING, mime_enc);
+ httpReplySwapOut(reply, e);
+ reply->hdr_sz = e->mem_obj->inmem_hi;
+ storeTimestampsSet(e);
+ if (EBIT_TEST(e->flags, ENTRY_CACHABLE)) {
+ storeSetPublicKey(e);
+ } else {
+ storeRelease(e);
+ }
}
/* Parse a gopher request into components. By Anawat. */
@@ -504,7 +494,7 @@
} else {
/* Standard link */
snprintf(tmpbuf, TEMP_BUF_SIZE, " %s\n",
- icon_url, host, gtype, escaped_selector, html_quote(name));
+ icon_url, host, gtype, rfc1738_escape(selector), html_quote(name));
}
}
safe_free(escaped_selector);
diff -ruN squid-2.6.STABLE9/src/http.c squid-2.6.STABLE10/src/http.c
--- squid-2.6.STABLE9/src/http.c Sun Jan 21 03:26:44 2007
+++ squid-2.6.STABLE10/src/http.c Mon Feb 26 15:41:46 2007
@@ -1,6 +1,6 @@
/*
- * $Id: http.c,v 1.419.2.2 2007/01/21 10:26:44 hno Exp $
+ * $Id: http.c,v 1.419.2.5 2007/02/26 22:41:46 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
@@ -80,6 +80,7 @@
requestUnlink(httpState->orig_request);
httpState->request = NULL;
httpState->orig_request = NULL;
+ stringClean(&httpState->chunkhdr);
cbdataFree(httpState);
}
@@ -298,7 +299,7 @@
break;
/* Responses that only are cacheable if the server says so */
case HTTP_MOVED_TEMPORARILY:
- if (rep->expires > -1)
+ if (rep->expires > rep->date && rep->date > 0)
return 1;
else
return 0;
@@ -409,12 +410,14 @@
}
/* rewrite this later using new interfaces @?@ */
-static void
+static size_t
httpProcessReplyHeader(HttpStateData * httpState, const char *buf, int size)
{
StoreEntry *entry = httpState->entry;
size_t hdr_len;
size_t hdr_size;
+ size_t old_size;
+ size_t done;
HttpReply *reply = entry->mem_obj->reply;
Ctx ctx = ctx_enter(entry->mem_obj->url);
debug(11, 3) ("httpProcessReplyHeader: key '%s'\n",
@@ -422,28 +425,30 @@
if (memBufIsNull(&httpState->reply_hdr))
memBufDefInit(&httpState->reply_hdr);
assert(httpState->reply_hdr_state == 0);
+ old_size = httpState->reply_hdr.size;
memBufAppend(&httpState->reply_hdr, buf, size);
hdr_len = httpState->reply_hdr.size;
if (hdr_len > 4 && strncmp(httpState->reply_hdr.buf, "HTTP/", 5)) {
debug(11, 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", httpState->reply_hdr.buf);
httpState->reply_hdr_state += 2;
+ httpState->chunk_size = -1; /* Terminated by EOF */
memBufClean(&httpState->reply_hdr);
httpBuildVersion(&reply->sline.version, 0, 9);
reply->sline.status = HTTP_INVALID_HEADER;
ctx_exit(ctx);
- return;
+ return 0;
}
hdr_size = headersEnd(httpState->reply_hdr.buf, hdr_len);
if (hdr_size)
hdr_len = hdr_size;
if (hdr_len > Config.maxReplyHeaderSize) {
debug(11, 1) ("httpProcessReplyHeader: Too large reply header\n");
- if (!memBufIsNull(&httpState->reply_hdr))
- memBufClean(&httpState->reply_hdr);
+ storeAppend(entry, httpState->reply_hdr.buf, httpState->reply_hdr.size);
+ memBufClean(&httpState->reply_hdr);
reply->sline.status = HTTP_HEADER_TOO_LARGE;
httpState->reply_hdr_state += 2;
ctx_exit(ctx);
- return;
+ return size;
}
/* headers can be incomplete only if object still arriving */
if (!hdr_size) {
@@ -451,7 +456,7 @@
hdr_size = hdr_len;
else {
ctx_exit(ctx);
- return; /* headers not complete */
+ return size; /* headers not complete */
}
}
safe_free(entry->mem_obj->vary_headers);
@@ -467,17 +472,48 @@
/* Parse headers into reply structure */
/* what happens if we fail to parse here? */
httpReplyParse(reply, httpState->reply_hdr.buf, hdr_size);
+ storeAppend(entry, httpState->reply_hdr.buf, hdr_size);
+ done = hdr_size - old_size;
if (reply->sline.status >= HTTP_INVALID_HEADER) {
debug(11, 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", httpState->reply_hdr.buf);
memBufClean(&httpState->reply_hdr);
ctx_exit(ctx);
- return;
+ return done;
}
if (!peer_supports_connection_pinning(httpState))
httpState->orig_request->flags.no_connection_auth = 1;
storeTimestampsSet(entry);
/* Check if object is cacheable or not based on reply code */
debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", reply->sline.status);
+ if (httpHeaderHas(&reply->header, HDR_TRANSFER_ENCODING)) {
+ String tr = httpHeaderGetList(&reply->header, HDR_TRANSFER_ENCODING);
+ const char *pos = NULL;
+ const char *item = NULL;
+ int ilen = 0;
+ if (strListGetItem(&tr, ',', &item, &ilen, &pos)) {
+ if (ilen == 7 && strncasecmp(item, "chunked", ilen) == 0) {
+ httpState->flags.chunked = 1;
+ if (!strListGetItem(&tr, ',', &item, &ilen, &pos))
+ item = NULL;
+ }
+ if (item) {
+ /* Can't handle other transfer-encodings */
+ debug(11, 1) ("Unexpected transfer encoding '%s'\n", strBuf(tr));
+ reply->sline.status = HTTP_INVALID_HEADER;
+ return done;
+ }
+ }
+ stringClean(&tr);
+ if (httpState->flags.chunked && reply->content_length >= 0) {
+ /* Can't have a content-length in chunked encoding */
+ reply->sline.status = HTTP_INVALID_HEADER;
+ return done;
+ }
+ }
+ if (!httpState->flags.chunked) {
+ /* non-chunked. Handle as one single big chunk (-1 if terminated by EOF) */
+ httpState->chunk_size = httpReplyBodySize(httpState->orig_request->method, reply);
+ }
if (httpHeaderHas(&reply->header, HDR_VARY)
#if X_ACCELERATOR_VARY
|| httpHeaderHas(&reply->header, HDR_X_ACCELERATOR_VARY)
@@ -488,7 +524,7 @@
vary = httpMakeVaryMark(httpState->orig_request, reply);
if (!vary) {
httpMakePrivate(entry);
- goto no_cache;
+ goto no_cache; /* XXX Would be better if this was used by the swicht statement below */
}
entry->mem_obj->vary_headers = xstrdup(vary);
if (strBuf(httpState->orig_request->vary_encoding))
@@ -543,36 +579,7 @@
#if HEADERS_LOG
headersLog(1, 0, httpState->request->method, reply);
#endif
-}
-
-static int
-httpPconnTransferDone(HttpStateData * httpState)
-{
- /* return 1 if we got the last of the data on a persistent connection */
- MemObject *mem = httpState->entry->mem_obj;
- HttpReply *reply = mem->reply;
- squid_off_t clen;
- debug(11, 3) ("httpPconnTransferDone: FD %d\n", httpState->fd);
- debug(11, 5) ("httpPconnTransferDone: content_length=%" PRINTF_OFF_T "\n",
- reply->content_length);
- /* If we haven't seen the end of reply headers, we are not done */
- if (httpState->reply_hdr_state < 2)
- return 0;
- clen = httpReplyBodySize(httpState->request->method, reply);
- /* If the body size is unknown we must wait for EOF */
- if (clen < 0)
- return 0;
- /* Barf if we got more than we asked for */
- if (mem->inmem_hi > clen + reply->hdr_sz)
- return -1;
- /* If there is no message body, we can be persistent */
- if (0 == clen)
- return 1;
- /* If the body size is known, we must wait until we've gotten all of it. */
- if (mem->inmem_hi < clen + reply->hdr_sz)
- return 0;
- /* We got it all */
- return 1;
+ return done;
}
/* Small helper function to verify if connection pinning is supported or not
@@ -615,6 +622,193 @@
return rc;
}
+static void
+httpAppendBody(HttpStateData * httpState, const char *buf, ssize_t len, int buffer_filled)
+{
+ StoreEntry *entry = httpState->entry;
+ const request_t *request = httpState->request;
+ const request_t *orig_request = httpState->orig_request;
+ struct in_addr *client_addr = NULL;
+ u_short client_port = 0;
+ int fd = httpState->fd;
+ int complete = httpState->eof;
+ int keep_alive = !httpState->eof;
+ while (len > 0) {
+ if (httpState->chunk_size > 0) {
+ size_t size = len;
+ if (size > httpState->chunk_size)
+ size = httpState->chunk_size;
+ httpState->chunk_size -= size;
+ storeAppend(httpState->entry, buf, size);
+ buf += size;
+ len -= size;
+ } else if (httpState->chunk_size < 0) {
+ /* non-chunked without content-length */
+ storeAppend(httpState->entry, buf, len);
+ len = 0;
+ } else if (httpState->flags.chunked) {
+ char *eol = memchr(buf, '\n', len);
+ size_t size = eol - buf + 1;
+ if (!eol)
+ size = len;
+ stringAppend(&httpState->chunkhdr, buf, size);
+ buf += size;
+ len -= size;
+ if (strLen(httpState->chunkhdr) > 256) {
+ debug(11, 1) ("Oversized chunk header on port %d, url %s\n", comm_local_port(fd), entry->mem_obj->url);
+ comm_close(fd);
+ return;
+ }
+ if (eol) {
+ if (!httpState->flags.trailer) {
+ /* chunk header */
+ char *end = NULL;
+ int badchunk = 0;
+ debug(11, 3) ("Chunk header '%s'\n", strBuf(httpState->chunkhdr));
+ httpState->chunk_size = strto_off_t(strBuf(httpState->chunkhdr), &end, 16);
+ if (end == strBuf(httpState->chunkhdr))
+ badchunk = 1;
+ while (end && (*end == '\r' || *end == ' ' || *end == '\t'))
+ end++;
+ if (httpState->chunk_size < 0 || !end || (*end != '\n' && *end == ';')) {
+ debug(11, 0) ("Invalid chunk header '%s'\n", strBuf(httpState->chunkhdr));
+ comm_close(fd);
+ return;
+ }
+ if (badchunk)
+ continue; /* Skip blank lines */
+ debug(11, 2) ("Chunk size %" PRINTF_OFF_T "\n", httpState->chunk_size);
+ if (httpState->chunk_size == 0) {
+ debug(11, 3) ("Processing trailer\n");
+ httpState->flags.trailer = 1;
+ }
+ } else {
+ /* trailer */
+ const char *p = strBuf(httpState->chunkhdr);
+ while (*p == '\r')
+ p++;
+ if (*p == '\n') {
+ complete = 1;
+ debug(11, 2) ("Chunked response complete\n");
+ }
+ }
+ stringReset(&httpState->chunkhdr, NULL);
+ }
+ } else {
+ /* Don't know what to do with this data. Bail out */
+ break;
+ }
+ if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
+ /*
+ * the above storeAppend() call could ABORT this entry,
+ * in that case, the server FD should already be closed.
+ * there's nothing for us to do.
+ */
+ return;
+ }
+ }
+ if (!httpState->chunk_size && !httpState->flags.chunked)
+ complete = 1;
+ if (!complete && len == 0) {
+ /* Wait for more data or EOF condition */
+ if (httpState->flags.keepalive_broken) {
+ commSetTimeout(fd, 10, NULL, NULL);
+ } else {
+ commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
+ }
+ commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
+ return;
+ }
+ /* Is it a incomplete reply? */
+ if (httpState->chunk_size > 0) {
+ debug(11, 1) ("Short response on port %d. Expecting %" PRINTF_OFF_T " octets more\n", comm_local_port(fd), httpState->chunk_size);
+ comm_close(fd);
+ return;
+ }
+ /*
+ * Verify that the connection is clean
+ */
+ if (len == 0 && buffer_filled >= 0) {
+ char buf2[4];
+ statCounter.syscalls.sock.reads++;
+ len = FD_READ_METHOD(fd, buf2, sizeof(buf2));
+ if ((len < 0 && !ignoreErrno(errno)) || len == 0) {
+ keep_alive = 0;
+ }
+ }
+ if (len > 0) {
+ debug(11, Config.onoff.relaxed_header_parser <= 0 || keep_alive ? 1 : 2)
+ ("httpReadReply: Excess data from \"%s %s\"\n",
+ RequestMethodStr[orig_request->method],
+ storeUrl(entry));
+ comm_close(fd);
+ return;
+ }
+ /*
+ * Verified and done with the reply
+ */
+
+ /*
+ * If we didn't send a keep-alive request header, then this
+ * can not be a persistent connection.
+ */
+ if (!httpState->flags.keepalive)
+ keep_alive = 0;
+ /*
+ * If we haven't sent the whole request then this can not be a persistent
+ * connection.
+ */
+ if (!httpState->flags.request_sent) {
+ debug(11, 1) ("httpReadReply: Request not yet fully sent \"%s %s\"\n",
+ RequestMethodStr[orig_request->method],
+ storeUrl(entry));
+ keep_alive = 0;
+ }
+ /*
+ * What does the reply have to say about keep-alive?
+ */
+ if (!entry->mem_obj->reply->keep_alive)
+ keep_alive = 0;
+ if (keep_alive) {
+ int pinned = 0;
+#if LINUX_TPROXY
+ if (orig_request->flags.tproxy) {
+ client_addr = &httpState->request->client_addr;
+ }
+#endif
+ /* yes we have to clear all these! */
+ commSetDefer(fd, NULL, NULL);
+ commSetTimeout(fd, -1, NULL, NULL);
+ commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0);
+#if DELAY_POOLS
+ delayClearNoDelay(fd);
+#endif
+ comm_remove_close_handler(fd, httpStateFree, httpState);
+ fwdUnregister(fd, httpState->fwd);
+ if (request->flags.pinned) {
+ pinned = 1;
+ } else if (request->flags.connection_auth && request->flags.auth_sent) {
+ pinned = 1;
+ }
+ if (orig_request->pinned_connection && pinned) {
+ clientPinConnection(orig_request->pinned_connection, fd, orig_request, httpState->peer, request->flags.connection_auth);
+ } else if (httpState->peer) {
+ if (httpState->peer->options.originserver)
+ pconnPush(fd, httpState->peer->name, httpState->peer->http_port, httpState->orig_request->host, client_addr, client_port);
+ else
+ pconnPush(fd, httpState->peer->name, httpState->peer->http_port, NULL, client_addr, client_port);
+ } else {
+ pconnPush(fd, request->host, request->port, NULL, client_addr, client_port);
+ }
+ fwdComplete(httpState->fwd);
+ httpState->fd = -1;
+ httpStateFree(fd, httpState);
+ } else {
+ fwdComplete(httpState->fwd);
+ comm_close(fd);
+ }
+}
+
/* This will be called when data is ready to be read from fd. Read until
* error or connection closed. */
/* XXX this function is too long! */
@@ -622,19 +816,17 @@
httpReadReply(int fd, void *data)
{
HttpStateData *httpState = data;
- LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF);
+ LOCAL_ARRAY(char, buf, SQUID_TCP_SO_RCVBUF + 1);
StoreEntry *entry = httpState->entry;
- const request_t *request = httpState->request;
- const request_t *orig_request = httpState->orig_request;
- int len;
+ ssize_t len;
int bin;
int clen;
+ int done = 0;
size_t read_sz = SQUID_TCP_SO_RCVBUF;
- struct in_addr *client_addr = NULL;
- u_short client_port = 0;
#if DELAY_POOLS
delay_id delay_id;
#endif
+ int buffer_filled;
if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
comm_close(fd);
@@ -651,7 +843,8 @@
errno = 0;
statCounter.syscalls.sock.reads++;
len = FD_READ_METHOD(fd, buf, read_sz);
- debug(11, 5) ("httpReadReply: FD %d: len %d.\n", fd, len);
+ buffer_filled = len == read_sz;
+ debug(11, 5) ("httpReadReply: FD %d: len %d.\n", fd, (int) len);
if (len > 0) {
fd_bytes(fd, len, FD_READ);
#if DELAY_POOLS
@@ -663,6 +856,7 @@
for (clen = len - 1, bin = 0; clen; bin++)
clen >>= 1;
IOStats.Http.read_hist[bin]++;
+ buf[len] = '\0';
}
if (!httpState->reply_hdr.size && len > 0 && fd_table[fd].uses > 1) {
/* Skip whitespace */
@@ -711,13 +905,14 @@
fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY, httpState->fwd->request));
httpState->fwd->flags.dont_retry = 1;
} else {
- fwdComplete(httpState->fwd);
+ httpAppendBody(httpState, NULL, 0, -1); /* EOF */
+ return;
}
comm_close(fd);
return;
} else {
if (httpState->reply_hdr_state < 2) {
- httpProcessReplyHeader(httpState, buf, len);
+ done = httpProcessReplyHeader(httpState, buf, len);
if (httpState->reply_hdr_state == 2) {
http_status s = entry->mem_obj->reply->sline.status;
if (s == HTTP_HEADER_TOO_LARGE) {
@@ -734,6 +929,18 @@
httpState->fwd->flags.dont_retry = 1;
comm_close(fd);
return;
+ } else if (s == HTTP_INVALID_HEADER) {
+ MemBuf mb;
+ HttpReply *reply = entry->mem_obj->reply;
+ httpReplyReset(reply);
+ httpBuildVersion(&reply->sline.version, 1, 0);
+ reply->sline.status = HTTP_OK;
+ httpHeaderPutTime(&reply->header, HDR_DATE, squid_curtime);
+ mb = httpReplyPack(reply);
+ storeAppend(entry, mb.buf, mb.size);
+ httpReplyReset(reply);
+ httpReplyParse(reply, mb.buf, mb.size);
+ memBufClean(&mb);
}
#if WIP_FWD_LOG
fwdStatus(httpState->fwd, s);
@@ -744,121 +951,14 @@
*/
if (!fwdReforwardableStatus(s))
EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
- }
- }
- storeAppend(entry, buf, len);
- if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
- /*
- * the above storeAppend() call could ABORT this entry,
- * in that case, the server FD should already be closed.
- * there's nothing for us to do.
- */
- return;
- }
- switch (httpPconnTransferDone(httpState)) {
- case 1:
- {
- int keep_alive = 1;
- /*
- * If we didn't send a keep-alive request header, then this
- * can not be a persistent connection.
- */
- if (!httpState->flags.keepalive)
- keep_alive = 0;
- /*
- * If we haven't sent the whole request then this can not be a persistent
- * connection.
- */
- if (!httpState->flags.request_sent) {
- debug(11, 1) ("httpReadReply: Request not yet fully sent \"%s %s\"\n",
- RequestMethodStr[orig_request->method],
- storeUrl(entry));
- keep_alive = 0;
- }
- /*
- * What does the reply have to say about keep-alive?
- */
- if (!entry->mem_obj->reply->keep_alive)
- keep_alive = 0;
- /*
- * Verify that the connection is clean
- */
- if (len == read_sz) {
- statCounter.syscalls.sock.reads++;
- len = FD_READ_METHOD(fd, buf, SQUID_TCP_SO_RCVBUF);
- if ((len < 0 && !ignoreErrno(errno)) || len == 0) {
- keep_alive = 0;
- } else if (len > 0) {
- debug(11, Config.onoff.relaxed_header_parser <= 0 || keep_alive ? 1 : 2)
- ("httpReadReply: Excess data from \"%s %s\"\n",
- RequestMethodStr[orig_request->method],
- storeUrl(entry));
- storeAppend(entry, buf, len);
- keep_alive = 0;
- }
- }
- if (keep_alive) {
- int pinned = 0;
-#if LINUX_TPROXY
- if (orig_request->flags.tproxy) {
- client_addr = &httpState->request->client_addr;
- }
-#endif
- /* yes we have to clear all these! */
- commSetDefer(fd, NULL, NULL);
- commSetTimeout(fd, -1, NULL, NULL);
- commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0);
-#if DELAY_POOLS
- delayClearNoDelay(fd);
-#endif
- comm_remove_close_handler(fd, httpStateFree, httpState);
- fwdUnregister(fd, httpState->fwd);
- if (request->flags.pinned) {
- pinned = 1;
- } else if (request->flags.connection_auth && request->flags.auth_sent) {
- pinned = 1;
- }
- if (orig_request->pinned_connection && pinned) {
- clientPinConnection(orig_request->pinned_connection, fd, orig_request, httpState->peer, request->flags.connection_auth);
- } else if (httpState->peer) {
- if (httpState->peer->options.originserver)
- pconnPush(fd, httpState->peer->name, httpState->peer->http_port, httpState->orig_request->host, client_addr, client_port);
- else
- pconnPush(fd, httpState->peer->name, httpState->peer->http_port, NULL, client_addr, client_port);
- } else {
- pconnPush(fd, request->host, request->port, NULL, client_addr, client_port);
- }
- fwdComplete(httpState->fwd);
- httpState->fd = -1;
- httpStateFree(fd, httpState);
- } else {
- fwdComplete(httpState->fwd);
- comm_close(fd);
- }
- }
- return;
- case 0:
- /* Wait for more data or EOF condition */
- if (httpState->flags.keepalive_broken) {
- commSetTimeout(fd, 10, NULL, NULL);
} else {
commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
+ commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
+ return;
}
- commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
- return;
- case -1:
- /* Server is nasty on us. Shut down */
- debug(11, Config.onoff.relaxed_header_parser <= 0 || entry->mem_obj->reply->keep_alive ? 1 : 2)
- ("httpReadReply: Excess data from \"%s %s\"\n",
- RequestMethodStr[orig_request->method],
- storeUrl(entry));
- fwdComplete(httpState->fwd);
- comm_close(fd);
- return;
- default:
- fatal("Unexpected httpPconnTransferDone() status\n");
- break;
}
+ httpAppendBody(httpState, buf + done, len - done, buffer_filled);
+ return;
}
}
@@ -970,7 +1070,7 @@
debug(11, 5) ("httpBuildRequestHeader: %s: %s\n",
strBuf(e->name), strBuf(e->value));
if (!httpRequestHdrAllowed(e, &strConnection)) {
- debug(11, 2) ("'%s' header denied by anonymize_headers configuration\n",
+ debug(11, 2) ("'%s' header is a hop-by-hop connections header\n",
strBuf(e->name));
continue;
}
@@ -1059,8 +1159,18 @@
if (!Config.onoff.via)
httpHeaderAddEntry(hdr_out, httpHeaderEntryClone(e));
break;
- case HDR_PROXY_CONNECTION:
case HDR_CONNECTION:
+ case HDR_KEEP_ALIVE:
+ /* case HDR_PROXY_AUTHORIZATION: is special and handled above */
+ case HDR_PROXY_AUTHENTICATE:
+ case HDR_TE:
+ case HDR_TRAILER:
+ case HDR_TRANSFER_ENCODING:
+ case HDR_UPGRADE:
+ case HDR_PROXY_CONNECTION:
+ case HDR_EXPECT:
+ /* hop-by-hop headers. Don't forward */
+ break;
case HDR_CACHE_CONTROL:
/* append these after the loop if needed */
break;
diff -ruN squid-2.6.STABLE9/src/main.c squid-2.6.STABLE10/src/main.c
--- squid-2.6.STABLE9/src/main.c Sat Jan 13 09:10:14 2007
+++ squid-2.6.STABLE10/src/main.c Sat Feb 3 14:55:42 2007
@@ -1,6 +1,6 @@
/*
- * $Id: main.c,v 1.393 2007/01/13 16:10:14 hno Exp $
+ * $Id: main.c,v 1.393.2.1 2007/02/03 21:55:42 hno Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
@@ -1094,13 +1094,13 @@
releaseServerSockets();
commCloseAllSockets();
authenticateShutdown();
-#if USE_UNLINKD
- unlinkdClose();
-#endif
#if defined(USE_WIN32_SERVICE) && defined(_SQUID_WIN32_)
WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000);
#endif
storeDirSync(); /* Flush pending object writes/unlinks */
+#if USE_UNLINKD
+ unlinkdClose(); /* after storeDirSync! */
+#endif
storeDirWriteCleanLogs(0);
PrintRusage();
dumpMallocStats();
diff -ruN squid-2.6.STABLE9/src/neighbors.c squid-2.6.STABLE10/src/neighbors.c
--- squid-2.6.STABLE9/src/neighbors.c Thu Jan 18 17:19:26 2007
+++ squid-2.6.STABLE10/src/neighbors.c Mon Feb 26 15:45:24 2007
@@ -1,6 +1,6 @@
/*
- * $Id: neighbors.c,v 1.313 2007/01/19 00:19:26 hno Exp $
+ * $Id: neighbors.c,v 1.313.2.1 2007/02/26 22:45:24 hno Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
@@ -1014,6 +1014,7 @@
debug(0, 0) ("WARNING: No IP address found for '%s'!\n", p->host);
return;
}
+ p->tcp_up = PEER_TCP_MAGIC_COUNT;
for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; j++) {
p->addresses[j] = ia->in_addrs[j];
debug(15, 2) ("--> IP address #%d: %s\n", j, inet_ntoa(p->addresses[j]));
@@ -1081,6 +1082,8 @@
neighborTypeStr(p), p->name);
peerMonitorNow(p);
p->stats.logged_state = PEER_ALIVE;
+ if (!p->n_addresses)
+ ipcache_nbgethostbyname(p->host, peerDNSConfigure, p);
}
p->tcp_up = PEER_TCP_MAGIC_COUNT;
}
diff -ruN squid-2.6.STABLE9/src/ssl.c squid-2.6.STABLE10/src/ssl.c
--- squid-2.6.STABLE9/src/ssl.c Fri Aug 25 06:26:07 2006
+++ squid-2.6.STABLE10/src/ssl.c Sat Feb 3 14:53:38 2007
@@ -1,6 +1,6 @@
/*
- * $Id: ssl.c,v 1.134 2006/08/25 12:26:07 serassio Exp $
+ * $Id: ssl.c,v 1.134.2.1 2007/02/03 21:53:38 hno Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
@@ -414,7 +414,7 @@
ErrorState *err = NULL;
if (sslState->servers->peer)
hierarchyNote(&sslState->request->hier, sslState->servers->code,
- sslState->servers->peer->host);
+ sslState->servers->peer->name);
else if (Config.onoff.log_ip_on_direct)
hierarchyNote(&sslState->request->hier, sslState->servers->code,
fd_table[sslState->server.fd].ipaddr);
@@ -462,7 +462,7 @@
ErrorState *err = NULL;
if (sslState->servers->peer)
hierarchyNote(&sslState->request->hier, sslState->servers->code,
- sslState->servers->peer->host);
+ sslState->servers->peer->name);
else if (Config.onoff.log_ip_on_direct)
hierarchyNote(&sslState->request->hier, sslState->servers->code,
fd_table[sslState->server.fd].ipaddr);
diff -ruN squid-2.6.STABLE9/src/store.c squid-2.6.STABLE10/src/store.c
--- squid-2.6.STABLE9/src/store.c Thu Jan 18 17:21:01 2007
+++ squid-2.6.STABLE10/src/store.c Tue Feb 6 17:39:49 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store.c,v 1.570 2007/01/19 00:21:01 hno Exp $
+ * $Id: store.c,v 1.570.2.2 2007/02/07 00:39:49 hno Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
@@ -1689,7 +1689,10 @@
if (age > squid_curtime - served_date)
if (squid_curtime > age)
served_date = squid_curtime - age;
- entry->expires = reply->expires;
+ if (reply->expires > 0 && reply->date > -1)
+ entry->expires = served_date + (reply->expires - reply->date);
+ else
+ entry->expires = reply->expires;
entry->lastmod = reply->last_modified;
entry->timestamp = served_date;
}
diff -ruN squid-2.6.STABLE9/src/store_dir.c squid-2.6.STABLE10/src/store_dir.c
--- squid-2.6.STABLE9/src/store_dir.c Mon Sep 18 16:54:39 2006
+++ squid-2.6.STABLE10/src/store_dir.c Sat Feb 3 14:56:56 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_dir.c,v 1.143 2006/09/18 22:54:39 hno Exp $
+ * $Id: store_dir.c,v 1.143.2.1 2007/02/03 21:56:56 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
@@ -403,7 +403,6 @@
* the run. Thanks goes to Eric Stern, since this solution
* came out of his COSS code.
*/
-#define CLEAN_BUF_SZ 16384
int
storeDirWriteCleanLogs(int reopen)
{
@@ -472,7 +471,6 @@
dt, (double) n / (dt > 0.0 ? dt : 1.0));
return n;
}
-#undef CLEAN_BUF_SZ
/*
* sync all avaliable fs'es ..
diff -ruN squid-2.6.STABLE9/src/store_swapin.c squid-2.6.STABLE10/src/store_swapin.c
--- squid-2.6.STABLE9/src/store_swapin.c Tue Jun 6 10:37:24 2006
+++ squid-2.6.STABLE10/src/store_swapin.c Sat Feb 3 16:26:46 2007
@@ -1,6 +1,6 @@
/*
- * $Id: store_swapin.c,v 1.33 2006/06/06 16:37:24 hno Exp $
+ * $Id: store_swapin.c,v 1.33.2.1 2007/02/03 23:26:46 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapin Functions
* AUTHOR: Duane Wessels
@@ -75,6 +75,8 @@
sio, errflag);
cbdataUnlock(sio);
sc->swapin_sio = NULL;
+ if (errflag < 0)
+ storeRelease(sc->entry);
if ((callback = sc->callback)) {
void *cbdata = sc->callback_data;
assert(errflag <= 0);
diff -ruN squid-2.6.STABLE9/src/structs.h squid-2.6.STABLE10/src/structs.h
--- squid-2.6.STABLE9/src/structs.h Sun Jan 21 03:26:44 2007
+++ squid-2.6.STABLE10/src/structs.h Mon Feb 26 18:20:01 2007
@@ -1,6 +1,6 @@
/*
- * $Id: structs.h,v 1.507.2.1 2007/01/21 10:26:44 hno Exp $
+ * $Id: structs.h,v 1.507.2.4 2007/02/27 01:20:01 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
@@ -1093,6 +1093,8 @@
unsigned int request_sent:1;
unsigned int front_end_https:2;
unsigned int originpeer:1;
+ unsigned int chunked:1;
+ unsigned int trailer:1;
};
struct _HttpStateData {
@@ -1108,6 +1110,8 @@
FwdState *fwd;
char *body_buf;
int body_buf_sz;
+ squid_off_t chunk_size;
+ String chunkhdr;
};
struct _icpUdpData {
@@ -1160,6 +1164,7 @@
struct {
struct in_addr caddr;
squid_off_t size;
+ size_t rq_size;
log_type code;
int msec;
const char *rfc931;
@@ -1832,6 +1837,7 @@
unsigned int tproxy:1;
#endif
unsigned int collapsed:1; /* This request was collapsed. Don't trust the store entry to be valid */
+ unsigned int cache_validation:1; /* This request is an internal cache validation */
};
struct _link_list {
diff -ruN squid-2.6.STABLE9/src/url.c squid-2.6.STABLE10/src/url.c
--- squid-2.6.STABLE9/src/url.c Sat Jun 17 17:31:03 2006
+++ squid-2.6.STABLE10/src/url.c Sat Mar 3 11:34:13 2007
@@ -1,6 +1,6 @@
/*
- * $Id: url.c,v 1.144 2006/06/17 23:31:03 hno Exp $
+ * $Id: url.c,v 1.144.2.1 2007/03/03 18:34:13 hno Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
@@ -64,6 +64,9 @@
"UNSUBSCRIBE",
"POLL",
"REPORT",
+ "MKACTIVITY",
+ "CHECKOUT",
+ "MERGE",
"%EXT00",
"%EXT01",
"%EXT02",