diff -u -r -N squid-3.1.0.5/bootstrap.sh squid-3.1.0.6/bootstrap.sh --- squid-3.1.0.5/bootstrap.sh 2009-02-03 14:15:27.000000000 +1300 +++ squid-3.1.0.6/bootstrap.sh 2009-03-03 12:06:22.000000000 +1300 @@ -59,15 +59,20 @@ # instead of manualy moving files from ltdl to lib/libLtdl if egrep -q '^[[:space:]]*AC_LIBLTDL_' configure.in then - extras="--ltdl" + if libtoolize$ltver --help | grep -q -- --ltdl.=; then + ltdl="--ltdl=lib/libLtdl" + else + ltdl="--ltdl" + copy_libltdl=1 + fi else - extras="" + ltdl="" fi - bootstrap libtoolize$ltver $extras --force --copy --automake + bootstrap libtoolize$ltver $ltdl --force --copy --automake # customize generated libltdl, if any - if test -d libltdl + if test -d libltdl && [ $copy_libltdl ] then src=libltdl diff -u -r -N squid-3.1.0.5/ChangeLog squid-3.1.0.6/ChangeLog --- squid-3.1.0.5/ChangeLog 2009-02-03 14:15:27.000000000 +1300 +++ squid-3.1.0.6/ChangeLog 2009-03-03 12:06:21.000000000 +1300 @@ -1,3 +1,19 @@ +Changes to squid-3.1.0.6 (02 Mar 2009): + + - Regresion Fix: Support HTTP/0.9 in accelerator mode + - Regression bug 2608: Build broken by Linux basename() implementation. + - Bug 2601: Hack. Convert IPv4 netmasks to CIDR in IPv6-enabled mode + - Bug 2593: Compile errors on Solaris 10 + - Bug 2591: adaptation_access does not work + - Bug 2588: coredump in rDNS lookup + - Bug 2526: default ALLOW when no list specified. + - Bug 2287: Send a 505 on requests with unsupported HTTP versions + - Bug 419: Hop by Hop headers MUST NOT be forwarded + - Fix external_acl_type handling of SSL certificate details + - Obsolete: dependency on nss_common.h and nss.h + - Support libtool2 + - ... and various documentation and code polish + Changes to squid-3.1.0.5 (03 Feb 2009): - Bug 2583: Fixed issue in content adaptation @@ -92,6 +108,39 @@ - Bug #2223: Follow XFF extensions added - ... and many code and documentation cleanups +Changes to squid-3.0.STABLE13 (03 Feb 2009): + + - Fix several issues in request parsing + - Fix memory leak from logformat parsing + - Fix various ESI build errors + - ... and some documentation updates + +Changes to squid-3.0.STABLE12 (21 Jan 2009): + + - Bug 2533: Solaris (sparc) 64-bit build breaks with gcc/g++ + - Bug 2542: ICAP filters break download resume + - Bug 2556: HTCP fails without icp_port + - Bug 2564: logformat '%tl' field not working as advertised + - Port from 3.1: TestBed basic build consistency checks + - Policy: Change half_closed_clients default to off + - Policy: Removed -V command line option, deprecated by 2.6 + - ... and several other minor code cleanups + +Changes to squid-3.0.STABLE11 (24 Dec 2008): + + - Bug 2424: filedescriptors being left unnecessary opened + - Bug 2545: fault passing ICAP filtered traffic to peers + - Bug 2227: Sefgaults in MemBuf::reset during idnsSendQuery + - ... and some minor admin and debug cleanups. + +Changes to squid-3.0.STABLE11-RC1 (3 Dec 2008): + + - Removes patch causing cache of bad objects + - Bug 2526: bad security default in ACLChecklist + - Fixes regression: access.log request size tag + - Fixes cache_peer forceddomainname=X option + - ... and many minor documentation cleanups + Changes to squid-3.0.STABLE10 (14 Oct 2008): - Bug 2391: Regression: bad assert in forwarding diff -u -r -N squid-3.1.0.5/configure squid-3.1.0.6/configure --- squid-3.1.0.5/configure 2009-02-03 14:16:21.000000000 +1300 +++ squid-3.1.0.6/configure 2009-03-03 12:07:14.000000000 +1300 @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision: 1.497 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for Squid Web Proxy 3.1.0.5. +# Generated by GNU Autoconf 2.62 for Squid Web Proxy 3.1.0.6. # # Report bugs to . # @@ -751,8 +751,8 @@ # Identity of this package. PACKAGE_NAME='Squid Web Proxy' PACKAGE_TARNAME='squid' -PACKAGE_VERSION='3.1.0.5' -PACKAGE_STRING='Squid Web Proxy 3.1.0.5' +PACKAGE_VERSION='3.1.0.6' +PACKAGE_STRING='Squid Web Proxy 3.1.0.6' PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/' ac_unique_file="src/main.cc" @@ -1682,7 +1682,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Squid Web Proxy 3.1.0.5 to adapt to many kinds of systems. +\`configure' configures Squid Web Proxy 3.1.0.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1752,7 +1752,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Squid Web Proxy 3.1.0.5:";; + short | recursive ) echo "Configuration of Squid Web Proxy 3.1.0.6:";; esac cat <<\_ACEOF @@ -2074,7 +2074,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Squid Web Proxy configure 3.1.0.5 +Squid Web Proxy configure 3.1.0.6 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -2088,7 +2088,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Squid Web Proxy $as_me 3.1.0.5, which was +It was created by Squid Web Proxy $as_me 3.1.0.6, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -2786,7 +2786,7 @@ # Define the identity of the package. PACKAGE='squid' - VERSION='3.1.0.5' + VERSION='3.1.0.6' cat >>confdefs.h <<_ACEOF @@ -4856,11 +4856,6 @@ -CFLAGS="-DDEFAULT_SQUID_DATA_DIR=\\\"$datadir\\\" $CFLAGS" -CXXFLAGS="-DDEFAULT_SQUID_DATA_DIR=\\\"$datadir\\\" $CXXFLAGS" -CFLAGS="-DDEFAULT_SQUID_CONFIG_DIR=\\\"$sysconfdir\\\" $CFLAGS" -CXXFLAGS="-DDEFAULT_SQUID_CONFIG_DIR=\\\"$sysconfdir\\\" $CXXFLAGS" - new_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir" ac_configure_args="$new_configure_args" @@ -5652,7 +5647,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5655 "configure"' > conftest.$ac_ext + echo '#line 5650 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8274,11 +8269,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8277: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8272: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8281: \$? = $ac_status" >&5 + echo "$as_me:8276: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8564,11 +8559,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8567: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8562: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8571: \$? = $ac_status" >&5 + echo "$as_me:8566: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8668,11 +8663,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8671: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8666: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8675: \$? = $ac_status" >&5 + echo "$as_me:8670: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11068,7 +11063,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13575: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13584: \$? = $ac_status" >&5 + echo "$as_me:13579: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13681,11 +13676,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13684: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13679: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13688: \$? = $ac_status" >&5 + echo "$as_me:13683: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15264,11 +15259,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15267: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15262: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15271: \$? = $ac_status" >&5 + echo "$as_me:15266: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15368,11 +15363,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15371: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15366: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15375: \$? = $ac_status" >&5 + echo "$as_me:15370: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17583,11 +17578,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17586: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17581: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17590: \$? = $ac_status" >&5 + echo "$as_me:17585: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17873,11 +17868,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17876: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17871: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17880: \$? = $ac_status" >&5 + echo "$as_me:17875: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17977,11 +17972,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17980: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17975: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17984: \$? = $ac_status" >&5 + echo "$as_me:17979: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -26750,6 +26745,76 @@ fi +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -26791,6 +26856,22 @@ fi +if test "$ac_cv_path_PERL" = "none"; then + { { $as_echo "$as_me:$LINENO: error: Perl is required to compile Squid. Please install Perl and then re-run configure +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: Perl is required to compile Squid. Please install Perl and then re-run configure +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +case "$host" in + *-hp-hpux*) + { $as_echo "$as_me:$LINENO: Disabling 'ranlib' for HP-UX..." >&5 +$as_echo "$as_me: Disabling 'ranlib' for HP-UX..." >&6;} + RANLIB=":" + ;; +esac + # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -26832,23 +26913,6 @@ fi - -if test "$ac_cv_path_PERL" = "none"; then - { { $as_echo "$as_me:$LINENO: error: Perl is required to compile Squid. Please install Perl and then re-run configure -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: Perl is required to compile Squid. Please install Perl and then re-run configure -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -case "$host" in - *-hp-hpux*) - { $as_echo "$as_me:$LINENO: Disabling 'ranlib' for HP-UX..." >&5 -$as_echo "$as_me: Disabling 'ranlib' for HP-UX..." >&6;} - RANLIB=":" - ;; -esac - AR_R="$AR r" case "$host" in *-next-nextstep3) @@ -27370,7 +27434,6 @@ - for ac_header in \ arpa/inet.h \ arpa/nameser.h \ @@ -27392,6 +27455,7 @@ ip_nat.h \ ipl.h \ libc.h \ + libgen.h \ limits.h \ malloc.h \ math.h \ @@ -27450,8 +27514,6 @@ stdint.h \ inttypes.h \ grp.h \ - nss_common.h \ - nss.h \ db.h \ db_185.h \ sys/capability.h @@ -47452,6 +47514,7 @@ /* end confdefs.h. */ #include + #include void f (int i, ...) { va_list args1, args2; va_start (args1, i); @@ -47534,6 +47597,7 @@ /* end confdefs.h. */ #include + #include void f (int i, ...) { va_list args1, args2; va_start (args1, i); @@ -47833,6 +47897,9 @@ #if HAVE_UNISTD_H #include #endif +#if HAVE_STDLIB_H +#include +#endif #if HAVE_SYS_TIME_H #include #endif @@ -47926,6 +47993,7 @@ #include #include +#include #include /* needed on FreeBSD */ #include #include @@ -49938,7 +50006,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Squid Web Proxy $as_me 3.1.0.5, which was +This file was extended by Squid Web Proxy $as_me 3.1.0.6, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -49991,7 +50059,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Squid Web Proxy config.status 3.1.0.5 +Squid Web Proxy config.status 3.1.0.6 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -u -r -N squid-3.1.0.5/configure.in squid-3.1.0.6/configure.in --- squid-3.1.0.5/configure.in 2009-02-03 14:16:21.000000000 +1300 +++ squid-3.1.0.6/configure.in 2009-03-03 12:07:14.000000000 +1300 @@ -2,7 +2,7 @@ dnl dnl $Id$ dnl -AC_INIT(Squid Web Proxy, 3.1.0.5, http://www.squid-cache.org/bugs/, squid) +AC_INIT(Squid Web Proxy, 3.1.0.6, http://www.squid-cache.org/bugs/, squid) AC_PREREQ(2.52) AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) @@ -27,14 +27,6 @@ AC_LANG_CPLUSPLUS AC_CANONICAL_HOST -dnl Make location configure settings available to the code -dnl Pass squid data directory (icons, errors etc) base location to code files as a compiler define -CFLAGS="-DDEFAULT_SQUID_DATA_DIR=\\\"$datadir\\\" $CFLAGS" -CXXFLAGS="-DDEFAULT_SQUID_DATA_DIR=\\\"$datadir\\\" $CXXFLAGS" -dnl Pass squid.conf directory base location to code files as a compiler define -CFLAGS="-DDEFAULT_SQUID_CONFIG_DIR=\\\"$sysconfdir\\\" $CFLAGS" -CXXFLAGS="-DDEFAULT_SQUID_CONFIG_DIR=\\\"$sysconfdir\\\" $CXXFLAGS" - dnl Make the squid top srcdir available to sub-packages as --with-squid=PATH new_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir" ac_configure_args="$new_configure_args" @@ -2198,10 +2190,10 @@ AC_PATH_PROG(MV, mv, $FALSE) AC_PATH_PROG(MKDIR, mkdir, $FALSE) AC_PATH_PROG(LN, ln, cp) -AC_PATH_PROG(PERL, perl, none) dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE) -AC_PATH_PROG(AR, ar, $FALSE) +AC_PROG_EGREP +AC_PATH_PROG(PERL, perl, none) if test "$ac_cv_path_PERL" = "none"; then AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ]) fi @@ -2214,6 +2206,7 @@ esac dnl set $(AR) +AC_PATH_PROG(AR, ar, $FALSE) AR_R="$AR r" case "$host" in *-next-nextstep3) @@ -2247,6 +2240,7 @@ ip_nat.h \ ipl.h \ libc.h \ + libgen.h \ limits.h \ malloc.h \ math.h \ @@ -2305,8 +2299,6 @@ stdint.h \ inttypes.h \ grp.h \ - nss_common.h \ - nss.h \ db.h \ db_185.h \ sys/capability.h @@ -3057,6 +3049,7 @@ AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy, AC_TRY_RUN([ #include + #include void f (int i, ...) { va_list args1, args2; va_start (args1, i); @@ -3081,6 +3074,7 @@ AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy, AC_TRY_RUN([ #include + #include void f (int i, ...) { va_list args1, args2; va_start (args1, i); @@ -3244,6 +3238,9 @@ #if HAVE_UNISTD_H #include #endif +#if HAVE_STDLIB_H +#include +#endif #if HAVE_SYS_TIME_H #include #endif @@ -3289,6 +3286,7 @@ AC_TRY_RUN([ #include #include +#include #include /* needed on FreeBSD */ #include #include diff -u -r -N squid-3.1.0.5/errors/ar/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/ar/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/ar/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/ar/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:29.000000000 +1300 @@ -0,0 +1 @@ + خطأ: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/az/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/az/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/az/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/az/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:34.000000000 +1300 @@ -0,0 +1 @@ + SƏHV: Sorğulanan URL ilə əlaqə yaradılmadı

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/bg/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/bg/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/bg/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/bg/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:38.000000000 +1300 @@ -0,0 +1 @@ + ГРЕШКА: Заявеният адрес е недостъпен.

ERROR

Unsupported HTTP version


Възникна следната грешка при опит за достъп до: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Вашият кеш администратор е %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/ca/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/ca/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/ca/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/ca/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:43.000000000 +1300 @@ -0,0 +1 @@ + ERROR: No es pot mostrar la URL que heu sol.licitat

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

L'administrador d'aquesta cache és %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/cs/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/cs/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/cs/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/cs/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:47.000000000 +1300 @@ -0,0 +1 @@ + CHYBA: Požadovaný dokument je nedostupný

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/da/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/da/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/da/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/da/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:52.000000000 +1300 @@ -0,0 +1 @@ + FEJL: Den angivne URL kunne ikke hentes

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/de/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/de/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/de/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/de/ERR_UNSUP_HTTPVERSION 2009-03-03 12:08:56.000000000 +1300 @@ -0,0 +1 @@ + FEHLER: Die angeforderte URL konnte nicht gefunden werden

ERROR

Unsupported HTTP version


Der folgende Fehler wurde beim Versuch die URL %U zu holen festgestellt:

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Ihr Cache Administrator ist %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/en/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/en/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/en/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/en/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:01.000000000 +1300 @@ -0,0 +1 @@ + ERROR: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/en-au/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/en-au/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/en-au/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/en-au/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:06.000000000 +1300 @@ -0,0 +1 @@ + ERROR: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/en-gb/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/en-gb/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/en-gb/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/en-gb/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:10.000000000 +1300 @@ -0,0 +1 @@ + ERROR: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/en-nz/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/en-nz/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/en-nz/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/en-nz/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:15.000000000 +1300 @@ -0,0 +1 @@ + ERROR: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/en-us/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/en-us/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/en-us/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/en-us/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:19.000000000 +1300 @@ -0,0 +1 @@ + ERROR: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/es/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/es/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/es/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/es/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:24.000000000 +1300 @@ -0,0 +1 @@ + ERROR: El URL solicitado no se ha podido conseguir

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Su administrador del caché es %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/et/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/et/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/et/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/et/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:29.000000000 +1300 @@ -0,0 +1 @@ + VIGA: Päring URLile ei saa vastust

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Teie teenusepakkuja aadress on %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/fi/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/fi/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/fi/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/fi/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:33.000000000 +1300 @@ -0,0 +1 @@ + VIRHE: Pyydettyä URL-osoitetta ei voitu hakea

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/fr/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/fr/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/fr/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/fr/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:38.000000000 +1300 @@ -0,0 +1 @@ + ERREUR: L'URL demandée n'a pu être chargée

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/Greek/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Greek/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Greek/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Greek/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:23.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/Hebrew/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Hebrew/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Hebrew/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Hebrew/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:23.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/Hungarian/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Hungarian/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Hungarian/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Hungarian/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:23.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/hy/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/hy/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/hy/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/hy/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:42.000000000 +1300 @@ -0,0 +1 @@ + ՍԽԱԼ: Պահանջվող URL չի կարող առաքվել

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Ձեր քեշի կառավարիչը %w է.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/id/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/id/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/id/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/id/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:47.000000000 +1300 @@ -0,0 +1 @@ + ERROR: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/it/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/it/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/it/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/it/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:52.000000000 +1300 @@ -0,0 +1 @@ + ERRORE: Non è stato possibile accedere alla URL richiesta.

ERROR

Unsupported HTTP version


Mentre si cercava di accedere alla URL %U si è manifestato il seguente errore:

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

L'amministratore del proxy è %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/ja/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/ja/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/ja/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/ja/ERR_UNSUP_HTTPVERSION 2009-03-03 12:09:56.000000000 +1300 @@ -0,0 +1 @@ + エラー: リクエストされた URL は取得できませんでした

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/Korean/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Korean/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Korean/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Korean/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:23.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/Lithuanian/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Lithuanian/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Lithuanian/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Lithuanian/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:23.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/Makefile.am squid-3.1.0.6/errors/Makefile.am --- squid-3.1.0.5/errors/Makefile.am 2009-02-03 14:15:28.000000000 +1300 +++ squid-3.1.0.6/errors/Makefile.am 2009-03-03 12:06:23.000000000 +1300 @@ -92,7 +92,8 @@ rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \ done; \ fi \ - done; \ + done; + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_STYLESHEET) rm -f $(DESTDIR)$(DEFAULT_STYLESHEET).default # undocumented hack. You can use this target to create multi-lingual diff -u -r -N squid-3.1.0.5/errors/Makefile.in squid-3.1.0.6/errors/Makefile.in --- squid-3.1.0.5/errors/Makefile.in 2009-02-03 14:15:51.000000000 +1300 +++ squid-3.1.0.6/errors/Makefile.in 2009-03-03 12:06:48.000000000 +1300 @@ -531,7 +531,8 @@ rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \ done; \ fi \ - done; \ + done; + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_STYLESHEET) rm -f $(DESTDIR)$(DEFAULT_STYLESHEET).default # undocumented hack. You can use this target to create multi-lingual diff -u -r -N squid-3.1.0.5/errors/nl/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/nl/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/nl/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/nl/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:01.000000000 +1300 @@ -0,0 +1 @@ + FOUT: De gevraagde URL kon niet worden opgehaald

ERROR

Unsupported HTTP version


De volgende fout is opgetreden tijdens het ophalen van URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

De beheerder van deze cache is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/Polish/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Polish/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Polish/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Polish/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:23.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/Portuguese/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Portuguese/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Portuguese/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Portuguese/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:24.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/pt-br/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/pt-br/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/pt-br/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/pt-br/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:06.000000000 +1300 @@ -0,0 +1 @@ + ERRO: A URL requisitada não pôde ser recuperada

ERROR

Unsupported HTTP version


O seguinte erro foi encontrado ao tentar recuperar a URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Seu administrador do cache é %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/ro/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/ro/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/ro/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/ro/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:10.000000000 +1300 @@ -0,0 +1 @@ + EROARE: URL-ul cerut nu a putut fi citit

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/ru/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/ru/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/ru/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/ru/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:15.000000000 +1300 @@ -0,0 +1 @@ + ОШИБКА: Запрошенный URL не может быть получен

ERROR

Unsupported HTTP version


При получении URL %U произошла следующая ошибка

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Администратор Вашего кэша: %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/Simplify_Chinese/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Simplify_Chinese/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Simplify_Chinese/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Simplify_Chinese/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:24.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/Slovak/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Slovak/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Slovak/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Slovak/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:24.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/sr/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/sr/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/sr/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/sr/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:19.000000000 +1300 @@ -0,0 +1 @@ + GREŠKA: Tražena adresa (URL) ne može da se dovuèe

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Vaš keš/proksi administrator je: %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/sv/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/sv/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/sv/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/sv/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:24.000000000 +1300 @@ -0,0 +1 @@ + FEL: Den begärda URL:en kunde inte hämtas

ERROR

Unsupported HTTP version


Följande fel påträffades vid hämtning av URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Din cacheserver administratör är %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/templates/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/templates/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/templates/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/templates/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:24.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/tr/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/tr/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/tr/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/tr/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:29.000000000 +1300 @@ -0,0 +1 @@ + HATA: İstenilen URL'e ulaşılamadı

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Your cache administrator is %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/Traditional_Chinese/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/Traditional_Chinese/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/Traditional_Chinese/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/Traditional_Chinese/ERR_UNSUP_HTTPVERSION 2009-03-03 12:06:24.000000000 +1300 @@ -0,0 +1,31 @@ + + + +ERROR: The requested URL could not be retrieved + + +
+

ERROR

+

Unsupported HTTP version

+
+
+ +
+

The following error was encountered while trying to retrieve the URL: %U

+ +
+

Unsupported HTTP version

+
+ +

This Squid does not accept the HTTP version you are attempting to use.

+ +

Your cache administrator is %w.

+
+
+ +
+ + diff -u -r -N squid-3.1.0.5/errors/uk/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/uk/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/uk/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/uk/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:33.000000000 +1300 @@ -0,0 +1 @@ + ПОМИЛКА: Запитаний URL не може бути отриманий.

ERROR

Unsupported HTTP version


Наступна помилка була отримана під час спроби отримання URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

Ваш адміністратор кешу цей чувак: %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/errors/zh-cn/ERR_UNSUP_HTTPVERSION squid-3.1.0.6/errors/zh-cn/ERR_UNSUP_HTTPVERSION --- squid-3.1.0.5/errors/zh-cn/ERR_UNSUP_HTTPVERSION 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/errors/zh-cn/ERR_UNSUP_HTTPVERSION 2009-03-03 12:10:38.000000000 +1300 @@ -0,0 +1 @@ + 错误: The requested URL could not be retrieved

ERROR

Unsupported HTTP version


The following error was encountered while trying to retrieve the URL: %U

Unsupported HTTP version

This Squid does not accept the HTTP version you are attempting to use.

缓存服务器的管理员 %w.



\ No newline at end of file diff -u -r -N squid-3.1.0.5/helpers/basic_auth/MSNT/Makefile.am squid-3.1.0.6/helpers/basic_auth/MSNT/Makefile.am --- squid-3.1.0.5/helpers/basic_auth/MSNT/Makefile.am 2009-02-03 14:15:29.000000000 +1300 +++ squid-3.1.0.6/helpers/basic_auth/MSNT/Makefile.am 2009-03-03 12:06:25.000000000 +1300 @@ -6,6 +6,7 @@ # Uncomment and customize the following to suit your needs: # +MSNTAUTH_CONF = $(sysconfdir)/msntauth.conf libexec_PROGRAMS = msnt_auth @@ -35,11 +36,13 @@ $(COMPILE) -DSYSCONFDIR=\"$(sysconfdir)\" -c $(srcdir)/confload.c -o $@ install-data-local: - @if test -f $(DESTDIR)$(sysconfdir)/msntauth.conf ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(sysconfdir)/msntauth.conf" ; \ + @if test -f $(DESTDIR)$(MSNTAUTH_CONF) ; then \ + echo "$@ will not overwrite existing $(DESTDIR)$(MSNTAUTH_CONF)" ; \ else \ - echo "$(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(sysconfdir)/msntauth.conf" ; \ - $(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(sysconfdir)/msntauth.conf ; \ + echo "$(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(MSNTAUTH_CONF)" ; \ + $(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(MSNTAUTH_CONF) ; \ fi - +uninstall-local: + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(MSNTAUTH_CONF) + $(RM) -f $(DESTDIR)$(MSNTAUTH_CONF).default diff -u -r -N squid-3.1.0.5/helpers/basic_auth/MSNT/Makefile.in squid-3.1.0.6/helpers/basic_auth/MSNT/Makefile.in --- squid-3.1.0.5/helpers/basic_auth/MSNT/Makefile.in 2009-02-03 14:15:52.000000000 +1300 +++ squid-3.1.0.6/helpers/basic_auth/MSNT/Makefile.in 2009-03-03 12:06:48.000000000 +1300 @@ -322,6 +322,7 @@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +MSNTAUTH_CONF = $(sysconfdir)/msntauth.conf msnt_auth_SOURCES = md4.c rfcnb-io.c rfcnb-util.c session.c msntauth.c \ msntauth.h smbdes.c smbencrypt.c smblib-util.c smblib.c \ valid.c denyusers.c allowusers.c confload.c \ @@ -632,7 +633,7 @@ ps-am: uninstall-am: uninstall-info-am uninstall-libexecPROGRAMS \ - uninstall-sysconfDATA + uninstall-local uninstall-sysconfDATA .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libexecPROGRAMS clean-libtool ctags distclean \ @@ -646,19 +647,23 @@ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am uninstall-libexecPROGRAMS \ - uninstall-sysconfDATA + uninstall-local uninstall-sysconfDATA confload.o: confload.c $(COMPILE) -DSYSCONFDIR=\"$(sysconfdir)\" -c $(srcdir)/confload.c -o $@ install-data-local: - @if test -f $(DESTDIR)$(sysconfdir)/msntauth.conf ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(sysconfdir)/msntauth.conf" ; \ + @if test -f $(DESTDIR)$(MSNTAUTH_CONF) ; then \ + echo "$@ will not overwrite existing $(DESTDIR)$(MSNTAUTH_CONF)" ; \ else \ - echo "$(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(sysconfdir)/msntauth.conf" ; \ - $(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(sysconfdir)/msntauth.conf ; \ + echo "$(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(MSNTAUTH_CONF)" ; \ + $(INSTALL_DATA) $(srcdir)/msntauth.conf.default $(DESTDIR)$(MSNTAUTH_CONF) ; \ fi + +uninstall-local: + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(MSNTAUTH_CONF) + $(RM) -f $(DESTDIR)$(MSNTAUTH_CONF).default # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -u -r -N squid-3.1.0.5/include/autoconf.h.in squid-3.1.0.6/include/autoconf.h.in --- squid-3.1.0.5/include/autoconf.h.in 2009-02-03 14:15:49.000000000 +1300 +++ squid-3.1.0.6/include/autoconf.h.in 2009-03-03 12:06:46.000000000 +1300 @@ -269,6 +269,9 @@ /* Define to 1 if you have the `epoll' library (-lepoll). */ #undef HAVE_LIBEPOLL +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGEN_H + /* Define to 1 if you have the `gnumalloc' library (-lgnumalloc). */ #undef HAVE_LIBGNUMALLOC @@ -408,12 +411,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NET_PFVAR_H -/* Define to 1 if you have the header file. */ -#undef HAVE_NSS_COMMON_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NSS_H - /* off_t is defined by the system headers */ #undef HAVE_OFF_T diff -u -r -N squid-3.1.0.5/include/fatal.h squid-3.1.0.6/include/fatal.h --- squid-3.1.0.5/include/fatal.h 2009-02-03 14:15:31.000000000 +1300 +++ squid-3.1.0.6/include/fatal.h 2009-03-03 12:06:27.000000000 +1300 @@ -4,12 +4,7 @@ #include "config.h" SQUIDCEXTERN void fatal(const char *message); -#if STDC_HEADERS -SQUIDCEXTERN void -fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; -#else -SQUIDCEXTERN void fatalf(); -#endif +SQUIDCEXTERN void fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; SQUIDCEXTERN void fatal_dump(const char *message); #endif diff -u -r -N squid-3.1.0.5/include/snmp_debug.h squid-3.1.0.6/include/snmp_debug.h --- squid-3.1.0.5/include/snmp_debug.h 2009-02-03 14:15:32.000000000 +1300 +++ squid-3.1.0.6/include/snmp_debug.h 2009-03-03 12:06:27.000000000 +1300 @@ -6,10 +6,6 @@ #include "config.h" -#if STDC_HEADERS SQUIDCEXTERN void snmplib_debug(int, const char *,...) PRINTF_FORMAT_ARG2; -#else -SQUIDCEXTERN void snmplib_debug(va_alist); -#endif #endif /* SQUID_SNMP_DEBUG_H */ diff -u -r -N squid-3.1.0.5/include/version.h squid-3.1.0.6/include/version.h --- squid-3.1.0.5/include/version.h 2009-02-03 14:16:21.000000000 +1300 +++ squid-3.1.0.6/include/version.h 2009-03-03 12:07:14.000000000 +1300 @@ -9,7 +9,7 @@ */ #ifndef SQUID_RELEASE_TIME -#define SQUID_RELEASE_TIME 1233623726 +#define SQUID_RELEASE_TIME 1236035180 #endif #ifndef APP_SHORTNAME diff -u -r -N squid-3.1.0.5/scripts/Makefile.am squid-3.1.0.6/scripts/Makefile.am --- squid-3.1.0.5/scripts/Makefile.am 2009-02-03 14:15:32.000000000 +1300 +++ squid-3.1.0.6/scripts/Makefile.am 2009-03-03 12:06:28.000000000 +1300 @@ -1,11 +1,7 @@ -# -# This file is a Makefile for compiling and installing Cache Manager. -# Cache Manager is a manager program for Internet Object Cache. -# - - bin_SCRIPTS = RunCache RunAccel EXTRA_DIST = AnnounceCache.pl access-log-matrix.pl cache-compare.pl \ cachetrace.pl check_cache.pl convert.configure.to.os2 \ fileno-to-pathname.pl flag_truncs.pl icp-test.pl \ icpserver.pl tcp-banger.pl udp-banger.pl upgrade-1.0-store.pl + +dist_noinst_SCRIPTS = remove-cfg.sh diff -u -r -N squid-3.1.0.5/scripts/Makefile.in squid-3.1.0.6/scripts/Makefile.in --- squid-3.1.0.5/scripts/Makefile.in 2009-02-03 14:15:58.000000000 +1300 +++ squid-3.1.0.6/scripts/Makefile.in 2009-03-03 12:06:55.000000000 +1300 @@ -14,11 +14,6 @@ @SET_MAKE@ -# -# This file is a Makefile for compiling and installing Cache Manager. -# Cache Manager is a manager program for Internet Object Cache. -# - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -42,8 +37,9 @@ build_triplet = @build@ host_triplet = @host@ subdir = scripts -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/RunAccel.in $(srcdir)/RunCache.in +DIST_COMMON = $(dist_noinst_SCRIPTS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/RunAccel.in \ + $(srcdir)/RunCache.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in @@ -54,7 +50,7 @@ CONFIG_CLEAN_FILES = RunCache RunAccel am__installdirs = "$(DESTDIR)$(bindir)" binSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(bin_SCRIPTS) +SCRIPTS = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS) SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -294,6 +290,7 @@ fileno-to-pathname.pl flag_truncs.pl icp-test.pl \ icpserver.pl tcp-banger.pl udp-banger.pl upgrade-1.0-store.pl +dist_noinst_SCRIPTS = remove-cfg.sh all: all-am .SUFFIXES: diff -u -r -N squid-3.1.0.5/scripts/remove-cfg.sh squid-3.1.0.6/scripts/remove-cfg.sh --- squid-3.1.0.5/scripts/remove-cfg.sh 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.1.0.6/scripts/remove-cfg.sh 2009-03-03 12:06:28.000000000 +1300 @@ -0,0 +1,28 @@ +#!/bin/sh + +# Removes an configuration file if it is identical to the default file, +# preventing "make distcheck" failures due to configuration leftovers. +# Intended to be used for installed configuration files. + +remover=$1 # the program to remove a file +prime=$2 # the configuration file to be removed, including path +default=$3 # the default configuration filename, including path + +# by default, use .default default extension +if test -z "$default" +then + default="$prime.default" +fi + +# is the primary configuration file present? +if test -f $prime +then + # is the primary config identical to the default? + if diff -q $default $prime > /dev/null + then + echo " $remover -f $prime"; + $remover -f $prime; + fi +fi + +exit 0 diff -u -r -N squid-3.1.0.5/snmplib/snmplib_debug.c squid-3.1.0.6/snmplib/snmplib_debug.c --- squid-3.1.0.5/snmplib/snmplib_debug.c 2009-02-03 14:15:33.000000000 +1300 +++ squid-3.1.0.6/snmplib/snmplib_debug.c 2009-03-03 12:06:28.000000000 +1300 @@ -5,38 +5,19 @@ #if HAVE_SYS_TYPES_H #include #endif -#if STDC_HEADERS #include -#else -#include -#endif #include "snmp_debug.h" -#if STDC_HEADERS void (*snmplib_debug_hook) (int, char *,...) = NULL; -#else -void (*snmplib_debug_hook) (va_alist) = NULL; -#endif extern void -#if STDC_HEADERS - snmplib_debug(int lvl, const char *fmt,...) +snmplib_debug(int lvl, const char *fmt,...) { char buf[BUFSIZ]; va_list args; va_start(args, fmt); -#else - snmplib_debug(va_alist) - va_dcl { - va_list args; - int lvl; - char char *fmt; - char buf[BUFSIZ]; - va_start(args); - lvl = va_arg(args, int); - fmt = va_arg(args, char *); -#endif + if (snmplib_debug_hook != NULL) { vsnprintf(buf, BUFSIZ, fmt, args); snmplib_debug_hook(lvl, buf); diff -u -r -N squid-3.1.0.5/src/access_log.cc squid-3.1.0.6/src/access_log.cc --- squid-3.1.0.5/src/access_log.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/access_log.cc 2009-03-03 12:06:32.000000000 +1300 @@ -625,7 +625,7 @@ if (al->request) sb = al->request->header.getByName(fmt->data.header.header); - out = sb.buf(); + out = sb.termedBuf(); quote = 1; @@ -635,7 +635,7 @@ if (al->reply) sb = al->reply->header.getByName(fmt->data.header.header); - out = sb.buf(); + out = sb.termedBuf(); quote = 1; @@ -645,7 +645,7 @@ if (al->request) sb = al->request->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator); - out = sb.buf(); + out = sb.termedBuf(); quote = 1; @@ -655,7 +655,7 @@ if (al->reply) sb = al->reply->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator); - out = sb.buf(); + out = sb.termedBuf(); quote = 1; @@ -764,7 +764,7 @@ case LFT_REQUEST_URLPATH: if (al->request) { - out = al->request->urlpath.buf(); + out = al->request->urlpath.termedBuf(); quote = 1; } break; @@ -810,7 +810,7 @@ case LFT_TAG: if (al->request) - out = al->request->tag.buf(); + out = al->request->tag.termedBuf(); quote = 1; @@ -823,7 +823,7 @@ case LFT_EXT_LOG: if (al->request) - out = al->request->extacl_log.buf(); + out = al->request->extacl_log.termedBuf(); quote = 1; diff -u -r -N squid-3.1.0.5/src/ACLChecklist.cc squid-3.1.0.6/src/ACLChecklist.cc --- squid-3.1.0.5/src/ACLChecklist.cc 2009-02-03 14:15:33.000000000 +1300 +++ squid-3.1.0.6/src/ACLChecklist.cc 2009-03-03 12:06:31.000000000 +1300 @@ -419,7 +419,7 @@ ConnStateData * -ACLChecklist::conn() +ACLChecklist::conn() const { return conn_; } @@ -480,6 +480,11 @@ return state_; } +/** + * Kick off a non-blocking (slow) ACL access list test + * + * NP: this should probably be made Async now. + */ void ACLChecklist::nonBlockingCheck(PF * callback_, void *callback_data_) { diff -u -r -N squid-3.1.0.5/src/ACLChecklist.h squid-3.1.0.6/src/ACLChecklist.h --- squid-3.1.0.5/src/ACLChecklist.h 2009-02-03 14:15:33.000000000 +1300 +++ squid-3.1.0.6/src/ACLChecklist.h 2009-03-03 12:06:31.000000000 +1300 @@ -33,12 +33,14 @@ #ifndef SQUID_ACLCHECKLIST_H #define SQUID_ACLCHECKLIST_H -#include "typedefs.h" -#include "client_side.h" -#include "structs.h" +//#include "typedefs.h" +//#include "client_side.h" +//#include "structs.h" -class ExternalACLEntry; +#include "ACL.h" +class AuthUserRequest; +class ExternalACLEntry; class ConnStateData; /// \ingroup ACLAPI @@ -86,40 +88,100 @@ }; +public: /* operators */ void *operator new(size_t); void operator delete(void *); ACLChecklist(); ~ACLChecklist(); - /* To cause link failures if assignment attempted */ + /** NP: To cause link failures if assignment attempted */ ACLChecklist (ACLChecklist const &); + /** NP: To cause link failures if assignment attempted */ ACLChecklist &operator=(ACLChecklist const &); +public: /* API methods */ + + /** + * Trigger off a non-blocking access check for a set of *_access options.. + * The callback specified will be called with true/false + * when the results of the ACL tests are known. + */ void nonBlockingCheck(PF * callback, void *callback_data); + + /** + * Trigger a blocking access check for a set of *_access options. + * + * ACLs which cannot be satisfied directly from available data are ignored. + * This means any proxy_auth, external_acl, DNS lookups, Ident lookups etc + * which have not already been performed and cached will not be checked. + * + * If there is no access list to check the default is to return DENIED. + * However callers should perform their own check and default based on local + * knowledge of the ACL usage rather than depend on this default. + * That will also save on work setting up ACLChecklist fields for a no-op. + * + * \retval 1/true Access Allowed + * \retval 0/false Access Denied + */ int fastCheck(); - void checkCallback(allow_t answer); - void preCheck(); + + /** + * Trigger a blocking access check for a single ACL line (a AND b AND c). + * + * ACLs which cannot be satisfied directly from available data are ignored. + * This means any proxy_auth, external_acl, DNS lookups, Ident lookups etc + * which have not already been performed and cached will not be checked. + * + * \retval 1/true Access Allowed + * \retval 0/false Access Denied + */ _SQUID_INLINE_ bool matchAclListFast(const ACLList * list); - ConnStateData * conn(); - int fd() const; // uses conn() if available - // set either conn or FD + /** + * Attempt to check the current checklist against current data. + * This is the core routine behind all ACL test routines. + * As much as possible of current tests are performed immediately + * and the result is maybe delayed to wait for async lookups. + * + * When all tests are done callback is presented with one of: + * \item ACCESS_ALLOWED Access explicitly Allowed + * \item ACCESS_DENIED Access explicitly Denied + */ + void check(); + + ConnStateData * conn() const; + + /// uses conn() if available + int fd() const; + + /// set either conn void conn(ConnStateData *); + /// set FD void fd(int aDescriptor); +/* Accessors used by internal ACL stuff */ + int authenticated(); bool asyncInProgress() const; void asyncInProgress(bool const); + bool finished() const; void markFinished(); - void check(); + allow_t const & currentAnswer() const; void currentAnswer(allow_t const); + + void changeState(AsyncState *); + AsyncState *asyncState() const; + +private: /* NP: only used internally */ + + void checkCallback(allow_t answer); void checkAccessList(); void checkForAsync(); - void changeState (AsyncState *); - AsyncState *asyncState() const; + +public: /* checklist available data */ const acl_access *accessList; @@ -132,6 +194,7 @@ struct peer *dst_peer; HttpRequest *request; + /* for acls that look at reply data */ HttpReply *reply; char rfc931[USER_IDENT_SZ]; @@ -148,17 +211,20 @@ PF *callback; void *callback_data; ExternalACLEntry *extacl_entry; + bool destinationDomainChecked() const; void markDestinationDomainChecked(); bool sourceDomainChecked() const; void markSourceDomainChecked(); -private: +private: /* internal methods */ + void preCheck(); void matchAclList(const ACLList * list, bool const fast); void matchAclListSlow(const ACLList * list); CBDATA_CLASS(ACLChecklist); - ConnStateData * conn_; /* hack for ident and NTLM */ - int fd_; // may be available when conn_ is not + + ConnStateData * conn_; /**< hack for ident and NTLM */ + int fd_; /**< may be available when conn_ is not */ bool async_; bool finished_; allow_t allow_; diff -u -r -N squid-3.1.0.5/src/ACLExtUser.cc squid-3.1.0.6/src/ACLExtUser.cc --- squid-3.1.0.5/src/ACLExtUser.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/ACLExtUser.cc 2009-03-03 12:06:31.000000000 +1300 @@ -79,7 +79,7 @@ ACLExtUser::match(ACLChecklist *checklist) { if (checklist->request->extacl_user.size()) { - return data->match(checklist->request->extacl_user.buf()); + return data->match(checklist->request->extacl_user.termedBuf()); } else { return -1; } diff -u -r -N squid-3.1.0.5/src/ACL.h squid-3.1.0.6/src/ACL.h --- squid-3.1.0.5/src/ACL.h 2009-02-03 14:15:33.000000000 +1300 +++ squid-3.1.0.6/src/ACL.h 2009-03-03 12:06:28.000000000 +1300 @@ -141,6 +141,13 @@ }; /// \ingroup ACLAPI +typedef enum { + ACCESS_DENIED, + ACCESS_ALLOWED, + ACCESS_REQ_PROXY_AUTH +} allow_t; + +/// \ingroup ACLAPI class acl_access { diff -u -r -N squid-3.1.0.5/src/ACLHTTPHeaderData.cc squid-3.1.0.6/src/ACLHTTPHeaderData.cc --- squid-3.1.0.5/src/ACLHTTPHeaderData.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/ACLHTTPHeaderData.cc 2009-03-03 12:06:31.000000000 +1300 @@ -63,18 +63,18 @@ if (hdr == NULL) return false; - debugs(28, 3, "aclHeaderData::match: checking '" << hdrName.buf() << "'"); + debugs(28, 3, "aclHeaderData::match: checking '" << hdrName << "'"); - String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.buf()); + String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.termedBuf()); - return regex_rule->match(value.buf()); + return regex_rule->match(value.termedBuf()); } wordlist * ACLHTTPHeaderData::dump() { wordlist *W = NULL; - wordlistAdd(&W, hdrName.buf()); + wordlistAdd(&W, hdrName.termedBuf()); wordlist * regex_dump = regex_rule->dump(); wordlistAddWl(&W, regex_dump); wordlistDestroy(®ex_dump); @@ -87,14 +87,14 @@ char* t = strtokFile(); assert (t != NULL); hdrName = t; - hdrId = httpHeaderIdByNameDef(hdrName.buf(), strlen(hdrName.buf())); + hdrId = httpHeaderIdByNameDef(hdrName.rawBuf(), hdrName.size()); regex_rule->parse(); } bool ACLHTTPHeaderData::empty() const { - return (hdrId == HDR_BAD_HDR && !hdrName.buf()) || regex_rule->empty(); + return (hdrId == HDR_BAD_HDR && hdrName.undefined()) || regex_rule->empty(); } ACLData * diff -u -r -N squid-3.1.0.5/src/ACLIP.cc squid-3.1.0.6/src/ACLIP.cc --- squid-3.1.0.5/src/ACLIP.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/ACLIP.cc 2009-03-03 12:06:31.000000000 +1300 @@ -132,6 +132,9 @@ /* apply netmask */ A.ApplyMask(q->mask); + debugs(28,9, "aclIpAddrNetworkCompare: compare: " << p->addr1 << "/" << q->mask << " (" << A << ") vs " << + q->addr1 << "-" << q->addr2 << "/" << q->mask); + if (q->addr2.IsAnyAddr()) { /* single address check */ return A.matchIPAddr( q->addr1 ); @@ -212,8 +215,24 @@ /* dotted notation */ /* assignment returns true if asc contained an IP address as text */ - if ((mask = asc)) + if ((mask = asc)) { +#if USE_IPV6 + /* HACK: IPv4 netmasks don't cleanly map to IPv6 masks. */ + debugs(28, DBG_IMPORTANT, "WARNING: Netmasks are deprecated. Please use CIDR masks instead."); + if(mask.IsIPv4()) { + /* locate what CIDR mask was _probably_ meant to be in its native protocol format. */ + /* this will completely crap out with a security fail-open if the admin is playing mask tricks */ + /* however, thats their fault, and we do warn. see bug 2601 for the effects if we don't do this. */ + unsigned int m = mask.GetCIDR(); + debugs(28, DBG_CRITICAL, "WARNING: IPv4 netmasks are particularly nasty when used to compare IPv6 to IPv4 ranges."); + debugs(28, DBG_CRITICAL, "WARNING: For now we assume you meant to write /" << m); + /* reset the mask completely, and crop to the CIDR boundary back properly. */ + mask.SetNoAddr(); + return mask.ApplyMask(m,AF_INET); + } +#endif /* USE_IPV6 */ return true; + } return false; } diff -u -r -N squid-3.1.0.5/src/ACLMyPortName.cc squid-3.1.0.6/src/ACLMyPortName.cc --- squid-3.1.0.5/src/ACLMyPortName.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/ACLMyPortName.cc 2009-03-03 12:06:31.000000000 +1300 @@ -39,6 +39,9 @@ #include "ACLStringData.h" #include "ACLChecklist.h" +/* for ConnStateData */ +#include "client_side.h" + ACL::Prototype ACLMyPortName::RegistryProtoype(&ACLMyPortName::RegistryEntry_, "myportname"); diff -u -r -N squid-3.1.0.5/src/ACLUrlPath.cc squid-3.1.0.6/src/ACLUrlPath.cc --- squid-3.1.0.5/src/ACLUrlPath.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/ACLUrlPath.cc 2009-03-03 12:06:31.000000000 +1300 @@ -47,7 +47,7 @@ int ACLUrlPathStrategy::match (ACLData * &data, ACLChecklist *checklist) { - char *esc_buf = xstrdup(checklist->request->urlpath.buf()); + char *esc_buf = xstrdup(checklist->request->urlpath.termedBuf()); rfc1738_unescape(esc_buf); int result = data->match(esc_buf); safe_free(esc_buf); diff -u -r -N squid-3.1.0.5/src/adaptation/AccessCheck.cc squid-3.1.0.6/src/adaptation/AccessCheck.cc --- squid-3.1.0.5/src/adaptation/AccessCheck.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/adaptation/AccessCheck.cc 2009-03-03 12:06:32.000000000 +1300 @@ -104,6 +104,7 @@ while (!candidates.empty()) { if (AccessRule *r = FindRule(topCandidate())) { + /* BUG 2526: what to do when r->acl is empty?? */ // XXX: we do not have access to conn->rfc931 here. acl_checklist = aclChecklistCreate(r->acl, req, dash_str); acl_checklist->reply = rep ? HTTPMSGLOCK(rep) : NULL; diff -u -r -N squid-3.1.0.5/src/adaptation/AccessRule.cc squid-3.1.0.6/src/adaptation/AccessRule.cc --- squid-3.1.0.5/src/adaptation/AccessRule.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/adaptation/AccessRule.cc 2009-03-03 12:06:32.000000000 +1300 @@ -10,7 +10,7 @@ int Adaptation::AccessRule::LastId = 0; -Adaptation::AccessRule::AccessRule(): id(++LastId), acl(NULL) +Adaptation::AccessRule::AccessRule(const String &aGroupId): id(++LastId), groupId(aGroupId), acl(NULL) { } @@ -22,7 +22,6 @@ void Adaptation::AccessRule::parse(ConfigParser &parser) { - ConfigParser::ParseString(&groupId); aclParseAccessLine(parser, &acl); } @@ -71,3 +70,15 @@ return NULL; } + +Adaptation::AccessRule * +Adaptation::FindRuleByGroupId(const String &groupId) +{ + typedef AccessRules::iterator ARI; + for (ARI i = AllRules().begin(); i != AllRules().end(); ++i) { + if ((*i)->groupId == groupId) + return *i; + } + + return NULL; +} diff -u -r -N squid-3.1.0.5/src/adaptation/AccessRule.h squid-3.1.0.6/src/adaptation/AccessRule.h --- squid-3.1.0.5/src/adaptation/AccessRule.h 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/adaptation/AccessRule.h 2009-03-03 12:06:32.000000000 +1300 @@ -15,7 +15,7 @@ class AccessRule { public: - AccessRule(); + AccessRule(const String &groupId); ~AccessRule(); void parse(ConfigParser &parser); @@ -37,6 +37,7 @@ typedef Vector AccessRules; extern AccessRules &AllRules(); extern AccessRule *FindRule(const AccessRule::Id &id); +extern AccessRule *FindRuleByGroupId(const String &groupId); } // namespace Adaptation diff -u -r -N squid-3.1.0.5/src/adaptation/Config.cc squid-3.1.0.6/src/adaptation/Config.cc --- squid-3.1.0.5/src/adaptation/Config.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/adaptation/Config.cc 2009-03-03 12:06:32.000000000 +1300 @@ -68,8 +68,11 @@ typedef Services::iterator SCI; for (SCI i = AllServices().begin(); i != AllServices().end(); ++i) { const ServiceConfig &cfg = (*i)->cfg(); - storeAppendPrintf(entry, "%s %s_%s %s %d %s\n", name, cfg.key.buf(), - cfg.methodStr(), cfg.vectPointStr(), cfg.bypass, cfg.uri.buf()); + storeAppendPrintf(entry, "%s " SQUIDSTRINGPH "_%s %s %d " SQUIDSTRINGPH "\n", + name, + SQUIDSTRINGPRINT(cfg.key), + cfg.methodStr(), cfg.vectPointStr(), cfg.bypass, + SQUIDSTRINGPRINT(cfg.uri)); } } @@ -141,15 +144,20 @@ { typedef Groups::iterator GI; for (GI i = AllGroups().begin(); i != AllGroups().end(); ++i) - storeAppendPrintf(entry, "%s %s\n", name, (*i)->id.buf()); + storeAppendPrintf(entry, "%s " SQUIDSTRINGPH "\n", name, SQUIDSTRINGPRINT((*i)->id)); } void Adaptation::Config::ParseAccess(ConfigParser &parser) { - AccessRule *r = new AccessRule; + String groupId; + ConfigParser::ParseString(&groupId); + AccessRule *r; + if (!(r=FindRuleByGroupId(groupId))) { + r = new AccessRule(groupId); + AllRules().push_back(r); + } r->parse(parser); - AllRules().push_back(r); } void @@ -168,7 +176,7 @@ typedef AccessRules::iterator CI; for (CI i = AllRules().begin(); i != AllRules().end(); ++i) { - snprintf(nom, 64, "%s %s", name, (*i)->groupId.buf()); + snprintf(nom, 64, "%s " SQUIDSTRINGPH, name, SQUIDSTRINGPRINT((*i)->groupId)); dump_acl_access(entry, nom, (*i)->acl); } } diff -u -r -N squid-3.1.0.5/src/adaptation/ServiceConfig.cc squid-3.1.0.6/src/adaptation/ServiceConfig.cc --- squid-3.1.0.5/src/adaptation/ServiceConfig.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/adaptation/ServiceConfig.cc 2009-03-03 12:06:32.000000000 +1300 @@ -63,7 +63,7 @@ ConfigParser::ParseString(&uri); debugs(3, 5, HERE << cfg_filename << ':' << config_lineno << ": " << - key.buf() << " " << method_point << " " << bypass); + key << " " << method_point << " " << bypass); method = parseMethod(method_point); point = parseVectPoint(method_point); @@ -75,15 +75,17 @@ // extract scheme and use it as the service_configConfig protocol const char *schemeSuffix = "://"; - if (const char *schemeEnd = uri.pos(schemeSuffix)) - protocol.limitInit(uri.buf(), schemeEnd - uri.buf()); + if (const String::size_type schemeEnd=uri.find(schemeSuffix)) + protocol=uri.substr(0,schemeEnd); + debugs(3, 5, HERE << cfg_filename << ':' << config_lineno << ": " << "service protocol is " << protocol); - if (!protocol.size()) + + if (protocol.size() == 0) return false; // skip scheme - const char *s = uri.buf() + protocol.size() + strlen(schemeSuffix); + const char *s = uri.termedBuf() + protocol.size() + strlen(schemeSuffix); const char *e; diff -u -r -N squid-3.1.0.5/src/auth/basic/auth_basic.cc squid-3.1.0.6/src/auth/basic/auth_basic.cc --- squid-3.1.0.5/src/auth/basic/auth_basic.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/auth/basic/auth_basic.cc 2009-03-03 12:06:32.000000000 +1300 @@ -331,7 +331,7 @@ parse_wordlist(&authenticate); - requirePathnameExists("authparam basic program", authenticate->key); + requirePathnameExists("auth_param basic program", authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&authenticateChildren); } else if (strcasecmp(param_str, "concurrency") == 0) { diff -u -r -N squid-3.1.0.5/src/auth/digest/auth_digest.cc squid-3.1.0.6/src/auth/digest/auth_digest.cc --- squid-3.1.0.5/src/auth/digest/auth_digest.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/auth/digest/auth_digest.cc 2009-03-03 12:06:32.000000000 +1300 @@ -932,7 +932,7 @@ parse_wordlist(&authenticate); - requirePathnameExists("authparam digest program", authenticate->key); + requirePathnameExists("auth_param digest program", authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&authenticateChildren); } else if (strcasecmp(param_str, "realm") == 0) { diff -u -r -N squid-3.1.0.5/src/auth/negotiate/auth_negotiate.cc squid-3.1.0.6/src/auth/negotiate/auth_negotiate.cc --- squid-3.1.0.5/src/auth/negotiate/auth_negotiate.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/auth/negotiate/auth_negotiate.cc 2009-03-03 12:06:32.000000000 +1300 @@ -159,7 +159,7 @@ parse_wordlist(&authenticate); - requirePathnameExists("authparam negotiate program", authenticate->key); + requirePathnameExists("auth_param negotiate program", authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&authenticateChildren); } else if (strcasecmp(param_str, "keep_alive") == 0) { diff -u -r -N squid-3.1.0.5/src/auth/ntlm/auth_ntlm.cc squid-3.1.0.6/src/auth/ntlm/auth_ntlm.cc --- squid-3.1.0.5/src/auth/ntlm/auth_ntlm.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/auth/ntlm/auth_ntlm.cc 2009-03-03 12:06:33.000000000 +1300 @@ -141,7 +141,7 @@ parse_wordlist(&authenticate); - requirePathnameExists("authparam ntlm program", authenticate->key); + requirePathnameExists("auth_param ntlm program", authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { parse_int(&authenticateChildren); } else if (strcasecmp(param_str, "keep_alive") == 0) { diff -u -r -N squid-3.1.0.5/src/cache_cf.cc squid-3.1.0.6/src/cache_cf.cc --- squid-3.1.0.5/src/cache_cf.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/cache_cf.cc 2009-03-03 12:06:33.000000000 +1300 @@ -888,7 +888,7 @@ if (!strncasecmp(unit, B_GBYTES_STR, strlen(B_GBYTES_STR))) return 1 << 30; - debugs(3, 1, "parseBytesUnits: unknown bytes unit '" << unit << "'"); + debugs(3, DBG_CRITICAL, "WARNING: Unknown bytes unit '" << unit << "'"); return 0; } diff -u -r -N squid-3.1.0.5/src/cf.data.pre squid-3.1.0.6/src/cf.data.pre --- squid-3.1.0.5/src/cf.data.pre 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/cf.data.pre 2009-03-03 12:06:33.000000000 +1300 @@ -126,6 +126,12 @@ auth_param basic program @DEFAULT_PREFIX@/libexec/ncsa_auth @DEFAULT_PREFIX@/etc/passwd + "utf8" on|off + HTTP uses iso-latin-1 as characterset, while some authentication + backends such as LDAP expects UTF-8. If this is set to on Squid will + translate the HTTP iso-latin-1 charset to UTF-8 before sending the + username & password to the helper. + "children" numberofchildren The number of authenticator processes to spawn. If you start too few Squid will have to wait for them to process a backlog of credential @@ -188,6 +194,12 @@ auth_param digest program @DEFAULT_PREFIX@/bin/digest_auth_pw @DEFAULT_PREFIX@/etc/digpass + "utf8" on|off + HTTP uses iso-latin-1 as characterset, while some authentication + backends such as LDAP expects UTF-8. If this is set to on Squid will + translate the HTTP iso-latin-1 charset to UTF-8 before sending the + username & password to the helper. + "children" numberofchildren The number of authenticator processes to spawn (no default). If you start too few Squid will have to wait for them to @@ -412,17 +424,17 @@ %USER_CERT_xx SSL User certificate subject attribute xx %USER_CA_xx SSL User certificate issuer attribute xx - %>{Header} HTTP request header + %>{Header} HTTP request header "Header" %>{Hdr:member} - HTTP request header list member + HTTP request header "Hdr" list member "member" %>{Hdr:;member} HTTP request header list member using ; as list separator. ; can be any non-alphanumeric character. - %<{Header} HTTP reply header + %<{Header} HTTP reply header "Header" %<{Hdr:member} - HTTP reply header list member + HTTP reply header "Hdr" list member "member" %<{Hdr:;member} HTTP reply header list member using ; as list separator. ; can be any non-alphanumeric @@ -3173,6 +3185,7 @@ DOC_END NAME: broken_posts +IFDEF: HTTP_VIOLATIONS TYPE: acl_access DEFAULT: none LOC: Config.accessList.brokenPosts @@ -3241,8 +3254,9 @@ when requested by a HTTP/1.0 client. This option enables Squid to ignore such expiry times until HTTP/1.1 is fully implemented. - WARNING: This may eventually cause some varying - objects not intended for caching to get cached. + + WARNING: If turned on this may eventually cause some + varying objects not intended for caching to get cached. DOC_END NAME: request_entities diff -u -r -N squid-3.1.0.5/src/client_side.cc squid-3.1.0.6/src/client_side.cc --- squid-3.1.0.5/src/client_side.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/client_side.cc 2009-03-03 12:06:33.000000000 +1300 @@ -464,7 +464,7 @@ aLogEntry->http.version = request->http_ver; aLogEntry->hier = request->hier; aLogEntry->cache.requestSize += request->content_length; - aLogEntry->cache.extuser = request->extacl_user.buf(); + aLogEntry->cache.extuser = request->extacl_user.termedBuf(); if (request->auth_user_request) { @@ -486,10 +486,10 @@ if (al.reply) { al.http.code = al.reply->sline.status; - al.http.content_type = al.reply->content_type.buf(); + al.http.content_type = al.reply->content_type.termedBuf(); } else if (loggingEntry() && loggingEntry()->mem_obj) { al.http.code = loggingEntry()->mem_obj->getReply()->sline.status; - al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.buf(); + al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.termedBuf(); } debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'"); @@ -852,7 +852,7 @@ static void clientPackTermBound(String boundary, MemBuf * mb) { - mb->Printf("\r\n--%s--\r\n", boundary.buf()); + mb->Printf("\r\n--" SQUIDSTRINGPH "--\r\n", SQUIDSTRINGPRINT(boundary)); debugs(33, 6, "clientPackTermBound: buf offset: " << mb->size); } @@ -866,10 +866,9 @@ assert(spec); /* put boundary */ - debugs(33, 5, "clientPackRangeHdr: appending boundary: " << - boundary.buf()); + debugs(33, 5, "clientPackRangeHdr: appending boundary: " << boundary); /* rfc2046 requires to _prepend_ boundary with ! */ - mb->Printf("\r\n--%s\r\n", boundary.buf()); + mb->Printf("\r\n--" SQUIDSTRINGPH "\r\n", SQUIDSTRINGPRINT(boundary)); /* stuff the header with required entries and pack it */ @@ -1169,8 +1168,8 @@ /* delete old Content-Type, add ours */ hdr->delById(HDR_CONTENT_TYPE); httpHeaderPutStrf(hdr, HDR_CONTENT_TYPE, - "multipart/byteranges; boundary=\"%s\"", - http->range_iter.boundary.buf()); + "multipart/byteranges; boundary=\"" SQUIDSTRINGPH "\"", + SQUIDSTRINGPRINT(http->range_iter.boundary)); /* Content-Length is not required in multipart responses * but it is always nice to have one */ actual_clen = http->mRangeCLen(); @@ -2243,15 +2242,32 @@ goto finish; } + /* RFC 2616 section 10.5.6 : handle unsupported HTTP versions cleanly. */ + /* We currently only accept 0.9, 1.0, 1.1 */ + if ( (http_ver.major == 0 && http_ver.minor != 9) || + (http_ver.major == 1 && http_ver.minor > 1 ) || + (http_ver.major > 1) ) { + + clientStreamNode *node = context->getClientReplyContext(); + debugs(33, 5, "Unsupported HTTP version discovered. :\n" << HttpParserHdrBuf(hp)); + clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); + assert (repContext); + repContext->setReplyToError(ERR_UNSUP_HTTPVERSION, HTTP_HTTP_VERSION_NOT_SUPPORTED, method, http->uri, conn->peer, NULL, HttpParserHdrBuf(hp), NULL); + assert(context->http->out.offset == 0); + context->pullData(); + conn->flags.readMoreRequests = false; + goto finish; + } + /* compile headers */ /* we should skip request line! */ /* XXX should actually know the damned buffer size here */ - if (!request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) { + if (http_ver.major >= 1 && !request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) { clientStreamNode *node = context->getClientReplyContext(); debugs(33, 5, "Failed to parse request headers:\n" << HttpParserHdrBuf(hp)); clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); - repContext->setReplyToError(ERR_INVALID_URL, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, NULL, NULL); + repContext->setReplyToError(ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, http->uri, conn->peer, NULL, NULL, NULL); assert(context->http->out.offset == 0); context->pullData(); conn->flags.readMoreRequests = false; @@ -2271,11 +2287,11 @@ request->flags.spoof_client_ip = conn->port->spoof_client_ip; } - if (internalCheck(request->urlpath.buf())) { + if (internalCheck(request->urlpath.termedBuf())) { if (internalHostnameIs(request->GetHost()) && request->port == getMyPort()) { http->flags.internal = 1; - } else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath.buf())) { + } else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath.termedBuf())) { request->SetHost(internalHostname()); request->port = getMyPort(); http->flags.internal = 1; @@ -2857,19 +2873,16 @@ #if USE_IDENT - ACLChecklist identChecklist; - - identChecklist.src_addr = details->peer; - - identChecklist.my_addr = details->me; - - identChecklist.accessList = cbdataReference(Config.accessList.identLookup); - - /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ - - if (identChecklist.fastCheck()) - identStart(details->me, details->peer, clientIdentDone, connState); - + if (Config.accessList.identLookup) { + ACLChecklist identChecklist; + identChecklist.src_addr = details->peer; + identChecklist.my_addr = details->me; + identChecklist.accessList = cbdataReference(Config.accessList.identLookup); + + /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ + if (identChecklist.fastCheck()) + identStart(details->me, details->peer, clientIdentDone, connState); + } #endif if (s->tcp_keepalive.enabled) { @@ -3075,18 +3088,16 @@ #if USE_IDENT - ACLChecklist identChecklist; - - identChecklist.src_addr = details->peer; - - identChecklist.my_addr = details->me; - - identChecklist.accessList = cbdataReference(Config.accessList.identLookup); - - /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ - - if (identChecklist.fastCheck()) - identStart(details->me, details->peer, clientIdentDone, connState); + if (Config.accessList.identLookup) { + ACLChecklist identChecklist; + identChecklist.src_addr = details->peer; + identChecklist.my_addr = details->me; + identChecklist.accessList = cbdataReference(Config.accessList.identLookup); + + /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ + if (identChecklist.fastCheck()) + identStart(details->me, details->peer, clientIdentDone, connState); + } #endif diff -u -r -N squid-3.1.0.5/src/client_side_reply.cc squid-3.1.0.6/src/client_side_reply.cc --- squid-3.1.0.5/src/client_side_reply.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/client_side_reply.cc 2009-03-03 12:06:33.000000000 +1300 @@ -93,7 +93,7 @@ void clientReplyContext::setReplyToError( err_type err, http_status status, const HttpRequestMethod& method, char const *uri, - IpAddress &addr, HttpRequest * failedrequest, char *unparsedrequest, + IpAddress &addr, HttpRequest * failedrequest, const char *unparsedrequest, AuthUserRequest * auth_user_request) { ErrorState *errstate = @@ -1291,7 +1291,7 @@ int connection_auth_blocked = 0; while ((e = hdr->getEntry(&pos))) { if (e->id == HDR_WWW_AUTHENTICATE) { - const char *value = e->value.buf(); + const char *value = e->value.rawBuf(); if ((strncasecmp(value, "NTLM", 4) == 0 && (value[4] == '\0' || value[4] == ' ')) @@ -1391,7 +1391,7 @@ ThisCache); strListAdd(&strVia, bbuf, ','); hdr->delById(HDR_VIA); - hdr->putStr(HDR_VIA, strVia.buf()); + hdr->putStr(HDR_VIA, strVia.termedBuf()); } /* Signal keep-alive if needed */ hdr->putStr(http->flags.accel ? HDR_CONNECTION : HDR_PROXY_CONNECTION, @@ -1758,8 +1758,10 @@ void clientReplyContext::processReplyAccess () { + /* NP: this should probably soft-fail to a zero-sized-reply error ?? */ assert(reply); - /* Dont't block our own responses or HTTP status messages */ + + /** Don't block our own responses or HTTP status messages */ if (http->logType == LOG_TCP_DENIED || http->logType == LOG_TCP_DENIED_REPLY || alwaysAllowResponse(reply->sline.status)) { @@ -1768,6 +1770,7 @@ return; } + /** Check for reply to big error */ if (reply->expectedBodyTooLarge(*http->request)) { sendBodyTooLargeError(); return; @@ -1775,11 +1778,13 @@ headers_sz = reply->hdr_sz; + /** check for absent access controls (permit by default) */ if (!Config.accessList.reply) { processReplyAccessResult(1); return; } + /** Process http_reply_access lists */ ACLChecklist *replyChecklist; replyChecklist = clientAclChecklistCreate(Config.accessList.reply, http); replyChecklist->reply = HTTPMSGLOCK(reply); diff -u -r -N squid-3.1.0.5/src/client_side_reply.h squid-3.1.0.6/src/client_side_reply.h --- squid-3.1.0.5/src/client_side_reply.h 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/client_side_reply.h 2009-03-03 12:06:33.000000000 +1300 @@ -72,7 +72,7 @@ int storeOKTransferDone() const; int storeNotOKTransferDone() const; - void setReplyToError(err_type, http_status, const HttpRequestMethod&, char const *, IpAddress &, HttpRequest *, char *, AuthUserRequest *); + void setReplyToError(err_type, http_status, const HttpRequestMethod&, char const *, IpAddress &, HttpRequest *, const char *, AuthUserRequest *); void createStoreEntry(const HttpRequestMethod& m, request_flags flags); void removeStoreReference(store_client ** scp, StoreEntry ** ep); void removeClientStoreReference(store_client **scp, ClientHttpRequest *http); diff -u -r -N squid-3.1.0.5/src/client_side_request.cc squid-3.1.0.6/src/client_side_request.cc --- squid-3.1.0.5/src/client_side_request.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/client_side_request.cc 2009-03-03 12:06:33.000000000 +1300 @@ -426,7 +426,7 @@ const char *asciiaddr; int l; struct in_addr addr; - p = request->x_forwarded_for_iterator.buf(); + p = request->x_forwarded_for_iterator.termedBuf(); l = request->x_forwarded_for_iterator.size(); /* @@ -509,8 +509,13 @@ } #endif /* FOLLOW_X_FORWARDED_FOR */ - acl_checklist = clientAclChecklistCreate(Config.accessList.http, http); - acl_checklist->nonBlockingCheck(clientAccessCheckDoneWrapper, this); + if (Config.accessList.http) { + acl_checklist = clientAclChecklistCreate(Config.accessList.http, http); + acl_checklist->nonBlockingCheck(clientAccessCheckDoneWrapper, this); + } else { + debugs(0, DBG_CRITICAL, "No http_access configuration found. This will block ALL traffic"); + clientAccessCheckDone(ACCESS_DENIED); + } } void @@ -851,7 +856,7 @@ int may_pin = 0; while ((e = req_hdr->getEntry(&pos))) { if (e->id == HDR_AUTHORIZATION || e->id == HDR_PROXY_AUTHORIZATION) { - const char *value = e->value.buf(); + const char *value = e->value.rawBuf(); if (strncasecmp(value, "NTLM ", 5) == 0 || strncasecmp(value, "Negotiate ", 10) == 0 @@ -892,7 +897,7 @@ } #if FORW_VIA_DB - fvdbCountVia(s.buf()); + fvdbCountVia(s.termedBuf()); #endif @@ -918,7 +923,7 @@ if (req_hdr->has(HDR_X_FORWARDED_FOR)) { String s = req_hdr->getList(HDR_X_FORWARDED_FOR); - fvdbCountForw(s.buf()); + fvdbCountForw(s.termedBuf()); s.clean(); } @@ -1022,11 +1027,19 @@ http->doCallouts(); } +/** Test cache allow/deny configuration + * Sets flags.cachable=1 if caching is not denied. + */ void ClientRequestContext::checkNoCache() { - acl_checklist = clientAclChecklistCreate(Config.accessList.noCache, http); - acl_checklist->nonBlockingCheck(checkNoCacheDoneWrapper, this); + if (Config.accessList.noCache) { + acl_checklist = clientAclChecklistCreate(Config.accessList.noCache, http); + acl_checklist->nonBlockingCheck(checkNoCacheDoneWrapper, this); + } else { + /* unless otherwise specified, we try to cache. */ + checkNoCacheDone(1); + } } static void diff -u -r -N squid-3.1.0.5/src/comm.cc squid-3.1.0.6/src/comm.cc --- squid-3.1.0.5/src/comm.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/comm.cc 2009-03-03 12:06:33.000000000 +1300 @@ -2553,6 +2553,7 @@ reads = deferredReads; deferredReads = CbDataListContainer(); + // XXX: For fairness this SHOULD randomize the order while (!reads.empty()) { DeferredRead aRead = popHead(reads); kickARead(aRead); diff -u -r -N squid-3.1.0.5/src/CommonPool.h squid-3.1.0.6/src/CommonPool.h --- squid-3.1.0.5/src/CommonPool.h 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/CommonPool.h 2009-03-03 12:06:31.000000000 +1300 @@ -59,7 +59,7 @@ void *operator new(size_t); void operator delete (void *); static CommonPool *Factory (unsigned char _class, CompositePoolNode::Pointer&); - char const* theClassTypeLabel() const {return typeLabel.buf();} + char const* theClassTypeLabel() const {return typeLabel.termedBuf();} protected: CommonPool(); diff -u -r -N squid-3.1.0.5/src/debug.cc squid-3.1.0.6/src/debug.cc --- squid-3.1.0.5/src/debug.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/debug.cc 2009-03-03 12:06:33.000000000 +1300 @@ -57,29 +57,16 @@ #ifdef _SQUID_MSWIN_ SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex; typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECTION, DWORD); - #endif void -#if STDC_HEADERS _db_print(const char *format,...) { -#else -_db_print(va_alist) -va_dcl { - const char *format = NULL; -#endif - LOCAL_ARRAY(char, f, BUFSIZ); va_list args1; -#if STDC_HEADERS - va_list args2; va_list args3; -#else -#define args2 args1 -#define args3 args1 -#endif + #ifdef _SQUID_MSWIN_ /* Multiple WIN32 threads may call this simultaneously */ @@ -112,53 +99,33 @@ EnterCriticalSection(dbg_mutex); #endif - /* give a chance to context-based debugging to print current context */ + /* give a chance to context-based debugging to print current context */ if (!Ctx_Lock) ctx_print(); -#if STDC_HEADERS - va_start(args1, format); - va_start(args2, format); - va_start(args3, format); -#else - - format = va_arg(args1, const char *); - -#endif - snprintf(f, BUFSIZ, "%s| %s", debugLogTime(), format); _db_print_file(f, args1); - _db_print_stderr(f, args2); #if HAVE_SYSLOG - _db_print_syslog(format, args3); - #endif -#ifdef _SQUID_MSWIN_ +#ifdef _SQUID_MSWIN_ LeaveCriticalSection(dbg_mutex); - #endif va_end(args1); - -#if STDC_HEADERS - va_end(args2); - va_end(args3); - -#endif } static void diff -u -r -N squid-3.1.0.5/src/Debug.h squid-3.1.0.6/src/Debug.h --- squid-3.1.0.5/src/Debug.h 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/Debug.h 2009-03-03 12:06:31.000000000 +1300 @@ -92,10 +92,21 @@ /* * HERE is a macro that you can use like this: * - * debugs(1,1, HERE << "some message"); + * debugs(1,2, HERE << "some message"); */ #define HERE __FILE__<<"("<<__LINE__<<") "<<__FUNCTION__<<": " +/* + * MYNAME is for use at debug levels 0 and 1 where HERE is too messy. + * + * debugs(1,1, MYNAME << "WARNING: some message"); + */ +#ifdef __PRETTY_FUNCTION__ +#define MYNAME __PRETTY_FUNCTION__ << " " +#else +#define MYNAME __FUNCTION__ << " " +#endif + /* some uint8_t do not like streaming control-chars (values 0-31, 127+) */ inline std::ostream& operator <<(std::ostream &os, const uint8_t d) { diff -u -r -N squid-3.1.0.5/src/DelayId.cc squid-3.1.0.6/src/DelayId.cc --- squid-3.1.0.5/src/DelayId.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/DelayId.cc 2009-03-03 12:06:31.000000000 +1300 @@ -106,6 +106,14 @@ } for (pool = 0; pool < DelayPools::pools(); pool++) { + + /* pools require explicit 'allow' to assign a client into them */ + if (!DelayPools::delay_data[pool].access) { + debugs(77, DBG_IMPORTANT, "delay_pool " << pool << + " has no delay_access configured. This means that no clients will ever use it."); + continue; + } + ACLChecklist ch; #if FOLLOW_X_FORWARDED_FOR if (Config.onoff.delay_pool_uses_indirect_client) @@ -124,8 +132,8 @@ /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ - if (DelayPools::delay_data[pool].theComposite().getRaw() && - ch.fastCheck()) { + if (DelayPools::delay_data[pool].theComposite().getRaw() && ch.fastCheck()) { + DelayId result (pool + 1); CompositePoolNode::CompositeSelectionDetails details; details.src_addr = ch.src_addr; diff -u -r -N squid-3.1.0.5/src/DelayPool.cc squid-3.1.0.6/src/DelayPool.cc --- squid-3.1.0.5/src/DelayPool.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/DelayPool.cc 2009-03-03 12:06:31.000000000 +1300 @@ -114,12 +114,7 @@ void CompositePoolNode::kickReads() { - /** - * we only start one, because delay pools may have **many** attached connections, - * and kicking them all off would be chaotic. - * This may need to be reviewed. - */ - deferredReads.kickReads(1); + deferredReads.kickReads(-1); } #endif diff -u -r -N squid-3.1.0.5/src/DelayTagged.cc squid-3.1.0.6/src/DelayTagged.cc --- squid-3.1.0.5/src/DelayTagged.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/DelayTagged.cc 2009-03-03 12:06:31.000000000 +1300 @@ -77,7 +77,7 @@ DelayTaggedCmp(DelayTaggedBucket::Pointer const &left, DelayTaggedBucket::Pointer const &right) { /* for rate limiting, case insensitive */ - return left->tag.caseCmp(right->tag.buf()); + return left->tag.caseCmp(right->tag); } void @@ -195,7 +195,7 @@ void DelayTaggedBucket::stats (StoreEntry *entry) const { - storeAppendPrintf(entry, " %s:", tag.buf()); + storeAppendPrintf(entry, " :" SQUIDSTRINGPH , SQUIDSTRINGPRINT(tag)); theBucket.stats (entry); } diff -u -r -N squid-3.1.0.5/src/DiskIO/AIO/AIODiskFile.cc squid-3.1.0.6/src/DiskIO/AIO/AIODiskFile.cc --- squid-3.1.0.5/src/DiskIO/AIO/AIODiskFile.cc 2009-02-03 14:15:35.000000000 +1300 +++ squid-3.1.0.6/src/DiskIO/AIO/AIODiskFile.cc 2009-03-03 12:06:31.000000000 +1300 @@ -87,10 +87,9 @@ { /* Simulate async calls */ #ifdef _SQUID_WIN32_ - fd = aio_open(path.buf(), flags); + fd = aio_open(path.termedBuf(), flags); #else - - fd = file_open(path.buf() , flags); + fd = file_open(path.termedBuf() , flags); #endif ioRequestor = callback; diff -u -r -N squid-3.1.0.5/src/eCAP/MessageRep.cc squid-3.1.0.6/src/eCAP/MessageRep.cc --- squid-3.1.0.5/src/eCAP/MessageRep.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/eCAP/MessageRep.cc 2009-03-03 12:06:33.000000000 +1300 @@ -39,7 +39,7 @@ const String value = squidId == HDR_OTHER ? theHeader.getByName(name.image().c_str()) : theHeader.getStrOrList(squidId); - return Value::FromTempString(value.buf()); + return Value::FromTempString(value.termedBuf()); } void @@ -192,7 +192,7 @@ Ecap::RequestLineRep::Area Ecap::RequestLineRep::uri() const { - return Area::FromTempBuffer(theMessage.urlpath.buf(), + return Area::FromTempBuffer(theMessage.urlpath.rawBuf(), theMessage.urlpath.size()); } diff -u -r -N squid-3.1.0.5/src/eCAP/ServiceRep.cc squid-3.1.0.6/src/eCAP/ServiceRep.cc --- squid-3.1.0.5/src/eCAP/ServiceRep.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/eCAP/ServiceRep.cc 2009-03-03 12:06:33.000000000 +1300 @@ -56,7 +56,7 @@ bool Ecap::ServiceRep::wantsUrl(const String &urlPath) const { Must(up()); - return theService->wantsUrl(urlPath.buf()); + return theService->wantsUrl(urlPath.termedBuf()); } Adaptation::Initiate * diff -u -r -N squid-3.1.0.5/src/enums.h squid-3.1.0.6/src/enums.h --- squid-3.1.0.5/src/enums.h 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/enums.h 2009-03-03 12:06:33.000000000 +1300 @@ -98,6 +98,7 @@ ERR_ESI, /* Failure to perform ESI processing */ ERR_INVALID_RESP, ERR_ICAP_FAILURE, + ERR_UNSUP_HTTPVERSION, /* HTTP version is not supported */ ERR_MAX } err_type; @@ -350,12 +351,6 @@ } clientStream_status_t; typedef enum { - ACCESS_DENIED, - ACCESS_ALLOWED, - ACCESS_REQ_PROXY_AUTH -} allow_t; - -typedef enum { AUTH_ACL_CHALLENGE = -2, AUTH_ACL_HELPER = -1, AUTH_ACL_CANNOT_AUTHENTICATE = 0, diff -u -r -N squid-3.1.0.5/src/errorpage.cc squid-3.1.0.6/src/errorpage.cc --- squid-3.1.0.5/src/errorpage.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/errorpage.cc 2009-03-03 12:06:33.000000000 +1300 @@ -556,9 +556,16 @@ if (NULL != request) { Packer p; - str.Printf("%s %s HTTP/%d.%d\n", + String urlpath_or_slash; + + if (request->urlpath.size() != 0) + urlpath_or_slash = request->urlpath; + else + urlpath_or_slash = "/"; + + str.Printf("%s " SQUIDSTRINGPH " HTTP/%d.%d\n", RequestMethodStr(request->method), - request->urlpath.size() ? request->urlpath.buf() : "/", + SQUIDSTRINGPRINT(urlpath_or_slash), request->http_ver.major, request->http_ver.minor); packerToMemInit(&p, &str); request->header.packInto(&p); @@ -734,9 +741,16 @@ if (NULL != request) { Packer p; - mb.Printf("%s %s HTTP/%d.%d\n", + String urlpath_or_slash; + + if (request->urlpath.size() != 0) + urlpath_or_slash = request->urlpath; + else + urlpath_or_slash = "/"; + + mb.Printf("%s " SQUIDSTRINGPH " HTTP/%d.%d\n", RequestMethodStr(request->method), - request->urlpath.size() ? request->urlpath.buf() : "/", + SQUIDSTRINGPRINT(urlpath_or_slash), request->http_ver.major, request->http_ver.minor); packerToMemInit(&p, &mb); request->header.packInto(&p); @@ -928,8 +942,7 @@ */ if (!Config.errorDirectory && request && request->header.getList(HDR_ACCEPT_LANGUAGE, &hdr) ) { - const char *buf = hdr.buf(); // raw header string for parsing - int pos = 0; // current parsing position in header string + size_t pos = 0; // current parsing position in header string char *reset = NULL; // where to reset the p pointer for each new tag file char *dt = NULL; @@ -950,12 +963,12 @@ * - IFF a tag contains only two characters we can wildcard ANY translations matching: '-'? .* * with preference given to an exact match. */ - while (pos < hdr.size() && buf[pos] != ';' && buf[pos] != ',' && !xisspace(buf[pos]) && dt < (dir+256) ) { - *dt++ = xtolower(buf[pos++]); + while (pos < hdr.size() && hdr[pos] != ';' && hdr[pos] != ',' && !xisspace(hdr[pos]) && dt < (dir+256) ) { + *dt++ = xtolower(hdr[pos++]); } *dt++ = '\0'; // nul-terminated the filename content string before system use. - debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << &buf[pos] << "'"); + debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << hdr.substr(pos,hdr.size()) << "'"); /* if we found anything we might use, try it. */ if (*reset != '\0') { @@ -983,8 +996,8 @@ dt = reset; // reset for next tag testing. we replace the failed name instead of cloning. // IFF we terminated the tag on ';' we need to skip the 'q=' bit to the next ',' or end. - while (pos < hdr.size() && buf[pos] != ',') pos++; - if (buf[pos] == ',') pos++; + while (pos < hdr.size() && hdr[pos] != ',') pos++; + if (hdr[pos] == ',') pos++; } } #endif /* USE_ERR_LOCALES */ diff -u -r -N squid-3.1.0.5/src/ESIAssign.cc squid-3.1.0.6/src/ESIAssign.cc --- squid-3.1.0.5/src/ESIAssign.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ESIAssign.cc 2009-03-03 12:06:31.000000000 +1300 @@ -89,7 +89,7 @@ variable = NULL; if (unevaluatedVariable.size()) { - varState->feedData(unevaluatedVariable.buf(), unevaluatedVariable.size()); + varState->feedData(unevaluatedVariable.rawBuf(), unevaluatedVariable.size()); char const *result = varState->extractChar (); /* Consider activating this, when we want to evaluate variables to a @@ -123,7 +123,7 @@ if (!value) return ESI_PROCESS_COMPLETE; - varState->addVariable (name.buf(), name.size(), value); + varState->addVariable (name.rawBuf(), name.size(), value); value = NULL; @@ -194,7 +194,7 @@ ESIVariableExpression::eval (ESIVarState &state, char const *subref, char const *defaultOnEmpty) const { /* XXX: Implement evaluation of the expression */ - ESISegment::ListAppend (state.getOutput(), expression.buf(), expression.size()); + ESISegment::ListAppend (state.getOutput(), expression.rawBuf(), expression.size()); } #endif /* USE_SQUID_ESI == 1 */ diff -u -r -N squid-3.1.0.5/src/ESI.cc squid-3.1.0.6/src/ESI.cc --- squid-3.1.0.5/src/ESI.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ESI.cc 2009-03-03 12:06:31.000000000 +1300 @@ -2430,7 +2430,7 @@ */ return 0; - if (strstr (sctusable->content.buf(), "ESI/1.0")) + if (sctusable->content.pos("ESI/1.0") != NULL) rv = 1; httpHdrScTargetDestroy (sctusable); diff -u -r -N squid-3.1.0.5/src/ESICustomParser.cc squid-3.1.0.6/src/ESICustomParser.cc --- squid-3.1.0.5/src/ESICustomParser.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ESICustomParser.cc 2009-03-03 12:06:31.000000000 +1300 @@ -109,7 +109,8 @@ } size_t openESITags (0); - char const *currentPos = content.buf(); + //erring on the safe side. Probably rawBuf would be ok too + char const *currentPos = content.termedBuf(); size_t remainingCount = content.size(); char const *tag = NULL; @@ -302,7 +303,7 @@ ESICustomParser::errorString() const { if (error.size()) - return error.buf(); + return error.termedBuf(); else return "Parsing error strings not implemented"; } diff -u -r -N squid-3.1.0.5/src/ESISegment.cc squid-3.1.0.6/src/ESISegment.cc --- squid-3.1.0.5/src/ESISegment.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ESISegment.cc 2009-03-03 12:06:32.000000000 +1300 @@ -236,5 +236,5 @@ { String temp; temp.limitInit(buf, len); - debugs(86, 9, "ESISegment::dumpOne: \"" << temp.buf() << "\""); + debugs(86, 9, "ESISegment::dumpOne: \"" << temp << "\""); } diff -u -r -N squid-3.1.0.5/src/ESIVarState.cc squid-3.1.0.6/src/ESIVarState.cc --- squid-3.1.0.5/src/ESIVarState.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ESIVarState.cc 2009-03-03 12:06:32.000000000 +1300 @@ -317,7 +317,7 @@ void ESIVarState::removeVariable (String const &name) { - Variable *candidate = static_cast (variables.find (name.buf(), name.size())); + Variable *candidate = static_cast (variables.find (name.rawBuf(), name.size())); if (candidate) { /* XXX: remove me */ @@ -434,7 +434,7 @@ String S = state.header().getListMember (HDR_COOKIE, subref, ';'); if (S.size()) - ESISegment::ListAppend (state.getOutput(), S.buf(), S.size()); + ESISegment::ListAppend (state.getOutput(), S.rawBuf(), S.size()); else if (found_default) ESISegment::ListAppend (state.getOutput(), found_default, strlen (found_default)); } @@ -468,7 +468,7 @@ if (state.header().has(HDR_ACCEPT_LANGUAGE)) { if (!subref) { String S (state.header().getList (HDR_ACCEPT_LANGUAGE)); - ESISegment::ListAppend (state.getOutput(), S.buf(), S.size()); + ESISegment::ListAppend (state.getOutput(), S.rawBuf(), S.size()); } else { if (state.header().hasListMember (HDR_ACCEPT_LANGUAGE, subref, ',')) { s = "true"; @@ -884,7 +884,7 @@ String strVary (rep->header.getList (HDR_VARY)); - if (!strVary.size() || strVary.buf()[0] != '*') { + if (!strVary.size() || strVary[0] != '*') { rep->header.putStr (HDR_VARY, tempstr); } } diff -u -r -N squid-3.1.0.5/src/external_acl.cc squid-3.1.0.6/src/external_acl.cc --- squid-3.1.0.5/src/external_acl.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/external_acl.cc 2009-03-03 12:06:33.000000000 +1300 @@ -365,14 +365,10 @@ // deprecated. but assume the old configs all referred to request headers. debugs(82, DBG_IMPORTANT, "WARNING: external_acl_type format %{...} is being replaced by %>{...} for : " << token); parse_header_token(format, (token+2), _external_acl_format::EXT_ACL_HEADER_REQUEST); - } - - if (strncmp(token, "%>{", 3) == 0) { + } else if (strncmp(token, "%>{", 3) == 0) { parse_header_token(format, (token+3), _external_acl_format::EXT_ACL_HEADER_REQUEST); - } - if (strncmp(token, "%<{", 3) == 0) { + } else if (strncmp(token, "%<{", 3) == 0) { parse_header_token(format, (token+3), _external_acl_format::EXT_ACL_HEADER_REPLY); - } else if (strcmp(token, "%LOGIN") == 0) { format->type = _external_acl_format::EXT_ACL_LOGIN; a->require_auth = true; @@ -411,10 +407,10 @@ format->type = _external_acl_format::EXT_ACL_USER_CERT_RAW; else if (strcmp(token, "%USER_CERTCHAIN") == 0) format->type = _external_acl_format::EXT_ACL_USER_CERTCHAIN_RAW; - else if (strncmp(token, "%USER_CERT_", 11)) { + else if (strncmp(token, "%USER_CERT_", 11) == 0) { format->type = _external_acl_format::EXT_ACL_USER_CERT; format->header = xstrdup(token + 11); - } else if (strncmp(token, "%CA_CERT_", 11)) { + } else if (strncmp(token, "%CA_CERT_", 11) == 0) { format->type = _external_acl_format::EXT_ACL_USER_CERT; format->header = xstrdup(token + 11); } @@ -757,7 +753,7 @@ external_acl_cache_touch(acl->def, entry); result = entry->result; - external_acl_message = entry->message.buf(); + external_acl_message = entry->message.termedBuf(); debugs(82, 2, "aclMatchExternal: " << acl->def->name << " = " << result); @@ -885,7 +881,7 @@ break; case _external_acl_format::EXT_ACL_PATH: - str = request->urlpath.buf(); + str = request->urlpath.termedBuf(); break; case _external_acl_format::EXT_ACL_METHOD: @@ -894,49 +890,49 @@ case _external_acl_format::EXT_ACL_HEADER_REQUEST: sb = request->header.getByName(format->header); - str = sb.buf(); + str = sb.termedBuf(); break; case _external_acl_format::EXT_ACL_HEADER_REQUEST_ID: sb = request->header.getStrOrList(format->header_id); - str = sb.buf(); + str = sb.termedBuf(); break; case _external_acl_format::EXT_ACL_HEADER_REQUEST_MEMBER: sb = request->header.getByNameListMember(format->header, format->member, format->separator); - str = sb.buf(); + str = sb.termedBuf(); break; case _external_acl_format::EXT_ACL_HEADER_REQUEST_ID_MEMBER: sb = request->header.getListMember(format->header_id, format->member, format->separator); - str = sb.buf(); + str = sb.termedBuf(); break; case _external_acl_format::EXT_ACL_HEADER_REPLY: if (reply) { sb = reply->header.getByName(format->header); - str = sb.buf(); + str = sb.termedBuf(); } break; case _external_acl_format::EXT_ACL_HEADER_REPLY_ID: if (reply) { sb = reply->header.getStrOrList(format->header_id); - str = sb.buf(); + str = sb.termedBuf(); } break; case _external_acl_format::EXT_ACL_HEADER_REPLY_MEMBER: if (reply) { sb = reply->header.getByNameListMember(format->header, format->member, format->separator); - str = sb.buf(); + str = sb.termedBuf(); } break; case _external_acl_format::EXT_ACL_HEADER_REPLY_ID_MEMBER: if (reply) { sb = reply->header.getListMember(format->header_id, format->member, format->separator); - str = sb.buf(); + str = sb.termedBuf(); } break; #if USE_SSL @@ -987,7 +983,7 @@ #endif case _external_acl_format::EXT_ACL_EXT_USER: - str = request->extacl_user.buf(); + str = request->extacl_user.termedBuf(); break; case _external_acl_format::EXT_ACL_UNKNOWN: @@ -1336,8 +1332,8 @@ if (entry != NULL) { debugs(82, 4, "externalAclLookup: entry = { date=" << (long unsigned int) entry->date << ", result=" << - entry->result << ", user=" << entry->user.buf() << " tag=" << - entry->tag.buf() << " log=" << entry->log.buf() << " }"); + entry->result << ", user=" << entry->user << " tag=" << + entry->tag << " log=" << entry->log << " }"); } diff -u -r -N squid-3.1.0.5/src/forward.cc squid-3.1.0.6/src/forward.cc --- squid-3.1.0.5/src/forward.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/forward.cc 2009-03-03 12:06:34.000000000 +1300 @@ -194,14 +194,15 @@ void FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request) { - /* + /** \note * client_addr == no_addr indicates this is an "internal" request * from peer_digest.c, asn.c, netdb.c, etc and should always * be allowed. yuck, I know. */ - if ( !request->client_addr.IsNoAddr() && request->protocol != PROTO_INTERNAL && request->protocol != PROTO_CACHEOBJ) { - /* + if ( Config.accessList.miss && !request->client_addr.IsNoAddr() && + request->protocol != PROTO_INTERNAL && request->protocol != PROTO_CACHEOBJ) { + /** * Check if this host is allowed to fetch MISSES from us (miss_access) */ ACLChecklist ch; @@ -1312,7 +1313,7 @@ IpAddress addr; for (l = head; l; l = l->next) { - if (ch->matchAclListFast(l->aclList)) + if (!l->aclList || ch->matchAclListFast(l->aclList)) return l->addr; } @@ -1330,7 +1331,7 @@ acl_tos *l; for (l = head; l; l = l->next) { - if (ch->matchAclListFast(l->aclList)) + if (!l->aclList || ch->matchAclListFast(l->aclList)) return l->tos; } @@ -1345,6 +1346,10 @@ if (request && request->flags.spoof_client_ip) return request->client_addr; + if (!Config.accessList.outgoing_address) { + return IpAddress(); // anything will do. + } + ch.dst_peer = dst_peer; if (request) { diff -u -r -N squid-3.1.0.5/src/fqdncache.cc squid-3.1.0.6/src/fqdncache.cc --- squid-3.1.0.5/src/fqdncache.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/fqdncache.cc 2009-03-03 12:06:34.000000000 +1300 @@ -639,7 +639,10 @@ char name[MAX_IPSTRLEN]; fqdncache_entry *f = NULL; - assert(!addr.IsAnyAddr() && !addr.IsNoAddr()); + if (addr.IsAnyAddr() || addr.IsNoAddr()) { + return NULL; + } + addr.NtoA(name,MAX_IPSTRLEN); FqdncacheStats.requests++; f = fqdncache_get(name); diff -u -r -N squid-3.1.0.5/src/fs/coss/store_dir_coss.cc squid-3.1.0.6/src/fs/coss/store_dir_coss.cc --- squid-3.1.0.5/src/fs/coss/store_dir_coss.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/fs/coss/store_dir_coss.cc 2009-03-03 12:06:34.000000000 +1300 @@ -1175,7 +1175,7 @@ if (!stripe_path) { String result = path; result.append("/stripe"); - const_cast(this)->stripe_path = xstrdup(result.buf()); + const_cast(this)->stripe_path = xstrdup(result.termedBuf()); } return stripe_path; diff -u -r -N squid-3.1.0.5/src/ftp.cc squid-3.1.0.6/src/ftp.cc --- squid-3.1.0.5/src/ftp.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/ftp.cc 2009-03-03 12:06:34.000000000 +1300 @@ -567,7 +567,7 @@ wordlist *w; char *dirup; int i, j, k; - const char *title = title_url.buf(); + const char *title = title_url.termedBuf(); flags.listing_started = true; printfReplyBody("\n"); printfReplyBody("\n", @@ -586,7 +586,7 @@ if (flags.need_base_href) printfReplyBody("\n", - html_quote(base_href.buf())); + html_quote(base_href.termedBuf())); printfReplyBody("\n"); @@ -1013,7 +1013,7 @@ if (flags.dir_slash) { url = xstrdup("./"); } else { - const char *title = title_url.buf(); + const char *title = title_url.termedBuf(); int k = 6 + strcspn(&title[6], "/"); char *t; url = xstrdup(title + k); @@ -1150,7 +1150,7 @@ FtpStateData::parseListing() { char *buf = data.readBuf->content(); - char *sbuf; /* NULL-terminated copy of buf */ + char *sbuf; /* NULL-terminated copy of termedBuf */ char *end; char *line; char *s; @@ -1301,34 +1301,18 @@ assert(io.fd == data.fd); -#if DELAY_POOLS - - DelayId delayId = entry->mem_obj->mostBytesAllowed(); - -#endif - if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { abortTransaction("entry aborted during dataRead"); return; } if (io.flag == COMM_OK && io.size > 0) { -#if DELAY_POOLS - delayId.bytesIn(io.size); -#endif - - } - - - if (io.flag == COMM_OK && io.size > 0) { debugs(9,5,HERE << "appended " << io.size << " bytes to readBuf"); data.readBuf->appended(io.size); #if DELAY_POOLS - DelayId delayId = entry->mem_obj->mostBytesAllowed(); delayId.bytesIn(io.size); #endif - IOStats.Ftp.reads++; for (j = io.size - 1, bin = 0; j; bin++) @@ -1461,16 +1445,20 @@ return 0; /* different username */ } +static String str_type_eq; void FtpStateData::checkUrlpath() { int l; - const char *t; + size_t t; + + if (str_type_eq.undefined()) //hack. String doesn't support global-static + str_type_eq="type="; - if ((t = request->urlpath.rpos(';')) != NULL) { - if (strncasecmp(t + 1, "type=", 5) == 0) { - typecode = (char) xtoupper(*(t + 6)); - request->urlpath.cutPointer(t); + if ((t = request->urlpath.rfind(';')) != String::npos) { + if (request->urlpath.substr(t+1,t+1+str_type_eq.size())==str_type_eq) { + typecode = (char)xtoupper(request->urlpath[t+str_type_eq.size()+1]); + request->urlpath.cut(t); } } @@ -1485,7 +1473,7 @@ /* UNIX root directory */ flags.isdir = 1; flags.root_dir = 1; - } else if ((l >= 1) && (*(request->urlpath.buf() + l - 1) == '/')) { + } else if ((l >= 1) && (request->urlpath[l - 1] == '/')) { /* Directory URL, ending in / */ flags.isdir = 1; @@ -1574,7 +1562,7 @@ checkUrlpath(); buildTitleUrl(); debugs(9, 5, HERE << "host=" << request->GetHost() << ", path=" << - request->urlpath.buf() << ", user=" << user << ", passwd=" << + request->urlpath << ", user=" << user << ", passwd=" << password); state = BEGIN; @@ -2025,7 +2013,7 @@ mode = 'A'; } else { t = ftpState->request->urlpath.rpos('/'); - filename = t ? t + 1 : ftpState->request->urlpath.buf(); + filename = t ? t + 1 : ftpState->request->urlpath.termedBuf(); mode = mimeGetTransferMode(filename); } @@ -2054,7 +2042,7 @@ debugs(9, 3, HERE); if (code == 200) { - p = path = xstrdup(ftpState->request->urlpath.buf()); + p = path = xstrdup(ftpState->request->urlpath.termedBuf()); if (*p == '/') p++; @@ -2308,7 +2296,7 @@ if (ftpState->theSize == 0) { debugs(9, 2, "SIZE reported " << ftpState->ctrl.last_reply << " on " << - ftpState->title_url.buf()); + ftpState->title_url); ftpState->theSize = -1; } } else if (code < 0) { @@ -3396,7 +3384,7 @@ safe_free(ftpState->filepath); /* Build the new path (urlpath begins with /) */ - path = xstrdup(ftpState->request->urlpath.buf()); + path = xstrdup(ftpState->request->urlpath.termedBuf()); rfc1738_unescape(path); @@ -3640,7 +3628,7 @@ e->buffer(); /* released when done processing current data payload */ - filename = (t = urlpath.rpos('/')) ? t + 1 : urlpath.buf(); + filename = (t = urlpath.rpos('/')) ? t + 1 : urlpath.termedBuf(); if (flags.isdir) { mime_type = "text/html"; @@ -3753,12 +3741,12 @@ if (request->protocol != PROTO_FTP) return NULL; - if ( !strncmp(request->urlpath.buf(), "/", 1) ) { + if ( request->urlpath[0]=='/' ) { newbuf.append(request->urlpath); request->urlpath.absorb(newbuf); safe_free(request->canonical); - } else if ( !strncmp(request->urlpath.buf(), "%2f", 3) ) { - newbuf.append(request->urlpath.buf() +1); + } else if ( !strncmp(request->urlpath.termedBuf(), "%2f", 3) ) { + newbuf.append(request->urlpath.substr(1,request->urlpath.size())); request->urlpath.absorb(newbuf); safe_free(request->canonical); } diff -u -r -N squid-3.1.0.5/src/gopher.cc squid-3.1.0.6/src/gopher.cc --- squid-3.1.0.5/src/gopher.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/gopher.cc 2009-03-03 12:06:34.000000000 +1300 @@ -277,7 +277,7 @@ static void gopher_request_parse(const HttpRequest * req, char *type_id, char *request) { - const char *path = req->urlpath.buf(); + const char *path = req->urlpath.termedBuf(); if (request) request[0] = '\0'; @@ -751,7 +751,7 @@ } /* while loop */ if (outbuf.size() > 0) { - entry->append(outbuf.buf(), outbuf.size()); + entry->append(outbuf.rawBuf(), outbuf.size()); /* now let start sending stuff to client */ entry->flush(); } diff -u -r -N squid-3.1.0.5/src/htcp.cc squid-3.1.0.6/src/htcp.cc --- squid-3.1.0.5/src/htcp.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/htcp.cc 2009-03-03 12:06:34.000000000 +1300 @@ -844,9 +844,12 @@ } static int - htcpAccessCheck(acl_access * acl, htcpSpecifier * s, IpAddress &from) { + /* default deny if no access list present */ + if (!acl) + return 0; + ACLChecklist checklist; checklist.src_addr = from; checklist.my_addr.SetNoAddr(); diff -u -r -N squid-3.1.0.5/src/http.cc squid-3.1.0.6/src/http.cc --- squid-3.1.0.5/src/http.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/http.cc 2009-03-03 12:06:34.000000000 +1300 @@ -72,8 +72,8 @@ static const char *const crlf = "\r\n"; static void httpMaybeRemovePublic(StoreEntry *, http_status); -static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, - HttpHeader * hdr_out, int we_do_ranges, http_state_flags); +static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, const String strConnection, HttpRequest * request, const HttpRequest * orig_request, + HttpHeader * hdr_out, const int we_do_ranges, const http_state_flags); HttpStateData::HttpStateData(FwdState *theFwdState) : AsyncJob("HttpStateData"), ServerStateData(theFwdState), lastChunk(0), header_bytes_read(0), reply_bytes_read(0), httpChunkDecoder(NULL) @@ -93,7 +93,7 @@ const char *url; if (_peer->options.originserver) - url = orig_request->urlpath.buf(); + url = orig_request->urlpath.termedBuf(); else url = entry->url(); @@ -578,7 +578,7 @@ strListAdd(&vstr, name, ','); hdr = request->header.getByName(name); safe_free(name); - value = hdr.buf(); + value = hdr.termedBuf(); if (value) { value = rfc1738_escape_part(value); @@ -603,7 +603,7 @@ strListAdd(&vstr, name, ','); hdr = request->header.getByName(name); safe_free(name); - value = hdr.buf(); + value = hdr.termedBuf(); if (value) { value = rfc1738_escape_part(value); @@ -618,8 +618,8 @@ vary.clean(); #endif - debugs(11, 3, "httpMakeVaryMark: " << vstr.buf()); - return vstr.buf(); + debugs(11, 3, "httpMakeVaryMark: " << vstr); + return vstr.termedBuf(); } void @@ -791,7 +791,7 @@ header = hdr->getStrOrList(HDR_PROXY_SUPPORT); /* XXX This ought to be done in a case-insensitive manner */ - rc = (strstr(header.buf(), "Session-Based-Authentication") != NULL); + rc = (strstr(header.termedBuf(), "Session-Based-Authentication") != NULL); return rc; } @@ -1454,7 +1454,7 @@ orig_request->http_ver.major, orig_request->http_ver.minor, ThisCache); strListAdd(&strVia, bbuf, ','); - hdr_out->putStr(HDR_VIA, strVia.buf()); + hdr_out->putStr(HDR_VIA, strVia.termedBuf()); strVia.clean(); } @@ -1465,7 +1465,7 @@ snprintf(bbuf, BBUF_SZ, "%s=\"Surrogate/1.0 ESI/1.0\"", Config.Accel.surrogate_id); strListAdd(&strSurrogate, bbuf, ','); - hdr_out->putStr(HDR_SURROGATE_CAPABILITY, strSurrogate.buf()); + hdr_out->putStr(HDR_SURROGATE_CAPABILITY, strSurrogate.termedBuf()); } #endif @@ -1495,7 +1495,7 @@ strFwd = orig_request->client_addr.NtoA(ntoabuf, MAX_IPSTRLEN); } if (strFwd.size() > 0) - hdr_out->putStr(HDR_X_FORWARDED_FOR, strFwd.buf()); + hdr_out->putStr(HDR_X_FORWARDED_FOR, strFwd.termedBuf()); } /** If set to DELETE - do not copy through. */ strFwd.clean(); @@ -1531,7 +1531,7 @@ const char *username = "-"; if (orig_request->extacl_user.size()) - username = orig_request->extacl_user.buf(); + username = orig_request->extacl_user.termedBuf(); else if (orig_request->auth_user_request) username = orig_request->auth_user_request->username(); @@ -1542,7 +1542,9 @@ } else if (strcmp(orig_request->peer_login, "PASS") == 0) { if (orig_request->extacl_user.size() && orig_request->extacl_passwd.size()) { char loginbuf[256]; - snprintf(loginbuf, sizeof(loginbuf), "%s:%s", orig_request->extacl_user.buf(), orig_request->extacl_passwd.buf()); + snprintf(loginbuf, sizeof(loginbuf), SQUIDSTRINGPH ":" SQUIDSTRINGPH, + SQUIDSTRINGPRINT(orig_request->extacl_user), + SQUIDSTRINGPRINT(orig_request->extacl_passwd)); httpHeaderPutStrf(hdr_out, HDR_PROXY_AUTHORIZATION, "Basic %s", base64_encode(loginbuf)); } @@ -1569,7 +1571,9 @@ hdr_out->putStr(HDR_AUTHORIZATION, auth); } else if (orig_request->extacl_user.size() && orig_request->extacl_passwd.size()) { char loginbuf[256]; - snprintf(loginbuf, sizeof(loginbuf), "%s:%s", orig_request->extacl_user.buf(), orig_request->extacl_passwd.buf()); + snprintf(loginbuf, sizeof(loginbuf), SQUIDSTRINGPH ":" SQUIDSTRINGPH, + SQUIDSTRINGPRINT(orig_request->extacl_user), + SQUIDSTRINGPRINT(orig_request->extacl_passwd)); httpHeaderPutStrf(hdr_out, HDR_AUTHORIZATION, "Basic %s", base64_encode(loginbuf)); } @@ -1581,7 +1585,7 @@ if (orig_request->auth_user_request) username = orig_request->auth_user_request->username(); else if (orig_request->extacl_user.size()) - username = orig_request->extacl_user.buf(); + username = orig_request->extacl_user.termedBuf(); snprintf(loginbuf, sizeof(loginbuf), "%s%s", username, orig_request->peer_login + 1); @@ -1613,7 +1617,7 @@ httpHdrCcSetMaxAge(cc, getMaxAge(url)); if (request->urlpath.size()) - assert(strstr(url, request->urlpath.buf())); + assert(strstr(url, request->urlpath.termedBuf())); } /* Enforce sibling relations */ @@ -1647,20 +1651,22 @@ strConnection.clean(); } +/** + * Decides whether a particular header may be cloned from the received Clients request + * to our outgoing fetch request. + */ void -copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags flags) +copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, const String strConnection, HttpRequest * request, const HttpRequest * orig_request, HttpHeader * hdr_out, const int we_do_ranges, const http_state_flags flags) { - debugs(11, 5, "httpBuildRequestHeader: " << e->name.buf() << ": " << e->value.buf()); - - if (!httpRequestHdrAllowed(e, &strConnection)) { - debugs(11, 2, "'" << e->name.buf() << "' header denied by anonymize_headers configuration"); - return; - } + debugs(11, 5, "httpBuildRequestHeader: " << e->name << ": " << e->value ); switch (e->id) { +/** \title RFC 2616 sect 13.5.1 - Hop-by-Hop headers which Squid should not pass on. */ + case HDR_PROXY_AUTHORIZATION: - /* Only pass on proxy authentication to peers for which + /** \par Proxy-Authorization: + * Only pass on proxy authentication to peers for which * authentication forwarding is explicitly enabled */ @@ -1672,16 +1678,31 @@ break; +/** \title RFC 2616 sect 13.5.1 - Hop-by-Hop headers which Squid does not pass on. */ + + case HDR_CONNECTION: /** \par Connection: */ + case HDR_TE: /** \par TE: */ + case HDR_KEEP_ALIVE: /** \par Keep-Alive: */ + case HDR_PROXY_AUTHENTICATE: /** \par Proxy-Authenticate: */ + case HDR_TRAILERS: /** \par Trailers: */ + case HDR_UPGRADE: /** \par Upgrade: */ + case HDR_TRANSFER_ENCODING: /** \par Transfer-Encoding: */ + break; + + +/** \title OTHER headers I haven't bothered to track down yet. */ + case HDR_AUTHORIZATION: - /* Pass on WWW authentication */ + /** \par WWW-Authorization: + * Pass on WWW authentication */ if (!flags.originpeer) { hdr_out->addEntry(e->clone()); } else { - /* In accelerators, only forward authentication if enabled + /** \note In accelerators, only forward authentication if enabled + * by login=PASS or login=PROXYPASS * (see also below for proxy->server authentication) */ - if (orig_request->peer_login && (strcmp(orig_request->peer_login, "PASS") == 0 || strcmp(orig_request->peer_login, "PROXYPASS") == 0)) { @@ -1692,7 +1713,7 @@ break; case HDR_HOST: - /* + /** \par Host: * Normally Squid rewrites the Host: header. * However, there is one case when we don't: If the URL * went through our redirector and the admin configured @@ -1717,8 +1738,9 @@ break; case HDR_IF_MODIFIED_SINCE: - /* append unless we added our own; - * note: at most one client's ims header can pass through */ + /** \par If-Modified-Since: + * append unless we added our own; + * \note at most one client's ims header can pass through */ if (!hdr_out->has(HDR_IF_MODIFIED_SINCE)) hdr_out->addEntry(e->clone()); @@ -1726,6 +1748,8 @@ break; case HDR_MAX_FORWARDS: + /** \par Max-Forwards: + * pass only on TRACE requests */ if (orig_request->method == METHOD_TRACE) { const int hops = e->getInt(); @@ -1736,7 +1760,9 @@ break; case HDR_VIA: - /* If Via is disabled then forward any received header as-is */ + /** \par Via: + * If Via is disabled then forward any received header as-is. + * Otherwise leave for explicit updated addition later. */ if (!Config.onoff.via) hdr_out->addEntry(e->clone()); @@ -1748,6 +1774,8 @@ case HDR_IF_RANGE: case HDR_REQUEST_RANGE: + /** \par Range:, If-Range:, Request-Range: + * Only pass if we accept ranges */ if (!we_do_ranges) hdr_out->addEntry(e->clone()); @@ -1755,22 +1783,32 @@ case HDR_PROXY_CONNECTION: - case HDR_CONNECTION: - case HDR_X_FORWARDED_FOR: case HDR_CACHE_CONTROL: - /* append these after the loop if needed */ + /** \par Proxy-Connaction:, X-Forwarded-For:, Cache-Control: + * handled specially by Squid, so leave off for now. + * append these after the loop if needed */ break; case HDR_FRONT_END_HTTPS: + /** \par Front-End-Https: + * Pass thru only if peer is configured with front-end-https */ if (!flags.front_end_https) hdr_out->addEntry(e->clone()); break; default: - /* pass on all other header fields */ + /** \par default. + * pass on all other header fields + * which are NOT listed by the special Connection: header. */ + + if (strConnection.size()>0 && strListIsMember(&strConnection, e->name.termedBuf(), ',')) { + debugs(11, 2, "'" << e->name << "' header cropped by Connection: definition"); + return; + } + hdr_out->addEntry(e->clone()); } } @@ -1814,7 +1852,7 @@ HttpVersion httpver(1, 0); mb->Printf("%s %s HTTP/%d.%d\r\n", RequestMethodStr(request->method), - request->urlpath.size() ? request->urlpath.buf() : "/", + request->urlpath.size() ? request->urlpath.termedBuf() : "/", httpver.major,httpver.minor); /* build and pack headers */ { @@ -1933,34 +1971,38 @@ void HttpStateData::doneSendingRequestBody() { - ACLChecklist ch; debugs(11,5, HERE << "doneSendingRequestBody: FD " << fd); + +#if HTTP_VIOLATIONS + ACLChecklist ch; ch.request = HTTPMSGLOCK(request); - if (Config.accessList.brokenPosts) + if (Config.accessList.brokenPosts) { ch.accessList = cbdataReference(Config.accessList.brokenPosts); + /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ - /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */ - - if (!Config.accessList.brokenPosts) { - debugs(11, 5, "doneSendingRequestBody: No brokenPosts list"); - CommIoCbParams io(NULL); - io.fd=fd; - io.flag=COMM_OK; - sendComplete(io); - } else if (!ch.fastCheck()) { - debugs(11, 5, "doneSendingRequestBody: didn't match brokenPosts"); - CommIoCbParams io(NULL); - io.fd=fd; - io.flag=COMM_OK; - sendComplete(io); - } else { - debugs(11, 2, "doneSendingRequestBody: matched brokenPosts"); - typedef CommCbMemFunT Dialer; - Dialer dialer(this, &HttpStateData::sendComplete); - AsyncCall::Pointer call= asyncCall(11,5, "HttpStateData::SendComplete", dialer); - comm_write(fd, "\r\n", 2, call); + if (!ch.fastCheck()) { + debugs(11, 5, "doneSendingRequestBody: didn't match brokenPosts"); + CommIoCbParams io(NULL); + io.fd=fd; + io.flag=COMM_OK; + sendComplete(io); + } else { + debugs(11, 2, "doneSendingRequestBody: matched brokenPosts"); + typedef CommCbMemFunT Dialer; + Dialer dialer(this, &HttpStateData::sendComplete); + AsyncCall::Pointer call= asyncCall(11,5, "HttpStateData::SendComplete", dialer); + comm_write(fd, "\r\n", 2, call); + } + return; } + debugs(11, 5, "doneSendingRequestBody: No brokenPosts list"); +#endif /* HTTP_VIOLATIONS */ + + CommIoCbParams io(NULL); + io.fd=fd; + io.flag=COMM_OK; + sendComplete(io); } // more origin request body data is available diff -u -r -N squid-3.1.0.5/src/HttpHdrCc.cc squid-3.1.0.6/src/HttpHdrCc.cc --- squid-3.1.0.5/src/HttpHdrCc.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHdrCc.cc 2009-03-03 12:06:32.000000000 +1300 @@ -134,13 +134,13 @@ CcFieldsInfo, CC_ENUM_END); if (type < 0) { - debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << str << "'"); type = CC_OTHER; } if (EBIT_TEST(cc->mask, type)) { if (type != CC_OTHER) - debugs(65, 2, "hdr cc: ignoring duplicate cache-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(65, 2, "hdr cc: ignoring duplicate cache-directive: near '" << item << "' in '" << str << "'"); CcFieldsInfo[type].stat.repCount++; @@ -205,7 +205,7 @@ { assert(cc); - if (cc->other.buf()) + if (cc->other.defined()) cc->other.clean(); memFree(cc, MEM_HTTP_HDR_CC); @@ -235,7 +235,8 @@ if (EBIT_TEST(cc->mask, flag) && flag != CC_OTHER) { /* print option name */ - packerPrintf(p, (pcount ? ", %s" : "%s"), CcFieldsInfo[flag].name.buf()); + packerPrintf(p, (pcount ? ", " SQUIDSTRINGPH : SQUIDSTRINGPH), + SQUIDSTRINGPRINT(CcFieldsInfo[flag].name)); /* handle options with values */ @@ -252,8 +253,9 @@ } } - if (cc->other.size()) - packerPrintf(p, (pcount ? ", %s" : "%s"), cc->other.buf()); + if (cc->other.size() != 0) + packerPrintf(p, (pcount ? ", " SQUIDSTRINGPH : SQUIDSTRINGPH), + SQUIDSTRINGPRINT(cc->other)); } /* negative max_age will clean old max_Age setting */ @@ -299,7 +301,7 @@ extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; const int valid_id = id >= 0 && id < CC_ENUM_END; - const char *name = valid_id ? CcFieldsInfo[id].name.buf() : "INVALID"; + const char *name = valid_id ? CcFieldsInfo[id].name.termedBuf() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", diff -u -r -N squid-3.1.0.5/src/HttpHdrRange.cc squid-3.1.0.6/src/HttpHdrRange.cc --- squid-3.1.0.5/src/HttpHdrRange.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHdrRange.cc 2009-03-03 12:06:32.000000000 +1300 @@ -251,14 +251,14 @@ int count = 0; assert(this && range_spec); ++ParsedCount; - debugs(64, 8, "parsing range field: '" << range_spec->buf() << "'"); + debugs(64, 8, "parsing range field: '" << range_spec << "'"); /* check range type */ if (range_spec->caseCmp("bytes=", 6)) return 0; /* skip "bytes="; hack! */ - pos = range_spec->buf() + 6; + pos = range_spec->termedBuf() + 6; /* iterate through comma separated list */ while (strListGetItem(range_spec, ',', &item, &ilen, &pos)) { diff -u -r -N squid-3.1.0.5/src/HttpHdrSc.cc squid-3.1.0.6/src/HttpHdrSc.cc --- squid-3.1.0.5/src/HttpHdrSc.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHdrSc.cc 2009-03-03 12:06:32.000000000 +1300 @@ -138,7 +138,7 @@ ScFieldsInfo, SC_ENUM_END); if (type < 0) { - debugs(90, 2, "hdr sc: unknown control-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(90, 2, "hdr sc: unknown control-directive: near '" << item << "' in '" << str << "'"); type = SC_OTHER; } @@ -162,7 +162,7 @@ if (EBIT_TEST(sct->mask, type)) { if (type != SC_OTHER) - debugs(90, 2, "hdr sc: ignoring duplicate control-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(90, 2, "hdr sc: ignoring duplicate control-directive: near '" << item << "' in '" << str << "'"); ScFieldsInfo[type].stat.repCount++; @@ -257,7 +257,8 @@ if (EBIT_TEST(sc->mask, flag) && flag != SC_OTHER) { /* print option name */ - packerPrintf(p, (pcount ? ", %s" : "%s"), ScFieldsInfo[flag].name.buf()); + packerPrintf(p, (pcount ? ", " SQUIDSTRINGPH : SQUIDSTRINGPH), + SQUIDSTRINGPRINT(ScFieldsInfo[flag].name)); /* handle options with values */ @@ -265,14 +266,14 @@ packerPrintf(p, "=%d", (int) sc->max_age); if (flag == SC_CONTENT) - packerPrintf(p, "=\"%s\"", sc->content.buf()); + packerPrintf(p, "=\"" SQUIDSTRINGPH "\"", SQUIDSTRINGPRINT(sc->content)); pcount++; } } if (sc->target.size()) - packerPrintf (p, ";%s", sc->target.buf()); + packerPrintf (p, ";" SQUIDSTRINGPH, SQUIDSTRINGPRINT(sc->target)); } void @@ -339,7 +340,7 @@ extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; const int valid_id = id >= 0 && id < SC_ENUM_END; - const char *name = valid_id ? ScFieldsInfo[id].name.buf() : "INVALID"; + const char *name = valid_id ? ScFieldsInfo[id].name.termedBuf() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", @@ -352,7 +353,7 @@ extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; const int valid_id = id >= 0 && id < SC_ENUM_END; - const char *name = valid_id ? ScFieldsInfo[id].name.buf() : "INVALID"; + const char *name = valid_id ? ScFieldsInfo[id].name.termedBuf() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", @@ -369,9 +370,9 @@ while (node) { HttpHdrScTarget *sct = (HttpHdrScTarget *)node->data; - if (target && sct->target.buf() && !strcmp (target, sct->target.buf())) + if (target && sct->target.defined() && !strcmp (target, sct->target.termedBuf())) return sct; - else if (!target && !sct->target.buf()) + else if (!target && sct->target.undefined()) return sct; node = node->next; diff -u -r -N squid-3.1.0.5/src/HttpHdrScTarget.cc squid-3.1.0.6/src/HttpHdrScTarget.cc --- squid-3.1.0.5/src/HttpHdrScTarget.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHdrScTarget.cc 2009-03-03 12:06:32.000000000 +1300 @@ -68,7 +68,7 @@ { HttpHdrScTarget *dup; assert(sc); - dup = httpHdrScTargetCreate(sc->target.buf()); + dup = httpHdrScTargetCreate(sc->target.termedBuf()); dup->mask = sc->mask; dup->max_age = sc->max_age; dup->content = sc->content; diff -u -r -N squid-3.1.0.5/src/HttpHeader.cc squid-3.1.0.6/src/HttpHeader.cc --- squid-3.1.0.5/src/HttpHeader.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHeader.cc 2009-03-03 12:06:32.000000000 +1300 @@ -461,7 +461,7 @@ if (e->id != HDR_OTHER) delById(e->id); else - delByName(e->name.buf()); + delByName(e->name.termedBuf()); } pos = HttpHeaderInitPos; @@ -578,7 +578,8 @@ } if (e->id == HDR_CONTENT_LENGTH && (e2 = findEntry(e->id)) != NULL) { - if (e->value.cmp(e2->value.buf()) != 0) { +// if (e->value.cmp(e2->value.termedBuf()) != 0) { + if (e->value != e2->value) { int64_t l1, l2; debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2, "WARNING: found two conflicting content-length headers in {" << getStringPrefix(header_start, header_end) << "}"); @@ -588,12 +589,12 @@ goto reset; } - if (!httpHeaderParseOffset(e->value.buf(), &l1)) { - debugs(55, 1, "WARNING: Unparseable content-length '" << e->value.buf() << "'"); + if (!httpHeaderParseOffset(e->value.termedBuf(), &l1)) { + debugs(55, 1, "WARNING: Unparseable content-length '" << e->value << "'"); delete e; continue; - } else if (!httpHeaderParseOffset(e2->value.buf(), &l2)) { - debugs(55, 1, "WARNING: Unparseable content-length '" << e2->value.buf() << "'"); + } else if (!httpHeaderParseOffset(e2->value.termedBuf(), &l2)) { + debugs(55, 1, "WARNING: Unparseable content-length '" << e2->value << "'"); delById(e2->id); } else if (l1 > l2) { delById(e2->id); @@ -615,7 +616,7 @@ } } - if (e->id == HDR_OTHER && stringHasWhitespace(e->name.buf())) { + if (e->id == HDR_OTHER && stringHasWhitespace(e->name.termedBuf())) { debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2, "WARNING: found whitespace in HTTP header name {" << getStringPrefix(field_start, field_end) << "}"); @@ -875,7 +876,7 @@ while ((e = getEntry(&pos))) { if (e->id == id) - strListAdd(s, e->value.buf(), ','); + strListAdd(s, e->value.termedBuf(), ','); } /* @@ -909,7 +910,7 @@ while ((e = getEntry(&pos))) { if (e->id == id) - strListAdd(&s, e->value.buf(), ','); + strListAdd(&s, e->value.termedBuf(), ','); } /* @@ -964,7 +965,7 @@ /* Sorry, an unknown header name. Do linear search */ while ((e = getEntry(&pos))) { if (e->id == HDR_OTHER && e->name.caseCmp(name) == 0) { - strListAdd(&result, e->value.buf(), ','); + strListAdd(&result, e->value.termedBuf(), ','); } } @@ -1209,7 +1210,7 @@ assert(Headers[id].type == ftDate_1123); /* must be of an appropriate type */ if ((e = findEntry(id))) { - value = parse_rfc1123(e->value.buf()); + value = parse_rfc1123(e->value.termedBuf()); httpHeaderNoteParsedEntry(e->id, e->value, value < 0); } @@ -1226,7 +1227,7 @@ if ((e = findEntry(id))) { httpHeaderNoteParsedEntry(e->id, e->value, 0); /* no errors are possible */ - return e->value.buf(); + return e->value.termedBuf(); } return NULL; @@ -1242,7 +1243,7 @@ if ((e = findLastEntry(id))) { httpHeaderNoteParsedEntry(e->id, e->value, 0); /* no errors are possible */ - return e->value.buf(); + return e->value.termedBuf(); } return NULL; @@ -1322,7 +1323,7 @@ HttpHeaderEntry *e; if ((e = findEntry(HDR_CONTENT_RANGE))) { - cr = httpHdrContRangeParseCreate(e->value.buf()); + cr = httpHdrContRangeParseCreate(e->value.termedBuf()); httpHeaderNoteParsedEntry(e->id, e->value, !cr); } @@ -1367,7 +1368,7 @@ assert(Headers[id].type == ftETag); /* must be of an appropriate type */ if ((e = findEntry(id))) - etagParseInit(&etag, e->value.buf()); + etagParseInit(&etag, e->value.termedBuf()); return etag; } @@ -1381,7 +1382,7 @@ memset(&tot, 0, sizeof(tot)); if ((e = findEntry(id))) { - const char *str = e->value.buf(); + const char *str = e->value.termedBuf(); /* try as an ETag */ if (etagParseInit(&tot.tag, str)) { @@ -1417,13 +1418,13 @@ Headers[id].stat.aliveCount++; - debugs(55, 9, "created HttpHeaderEntry " << this << ": '" << name.buf() << " : " << value.buf()); + debugs(55, 9, "created HttpHeaderEntry " << this << ": '" << name << " : " << value ); } HttpHeaderEntry::~HttpHeaderEntry() { assert_eid(id); - debugs(55, 9, "destroying entry " << this << ": '" << name.buf() << ": " << value.buf() << "'"); + debugs(55, 9, "destroying entry " << this << ": '" << name << ": " << value << "'"); /* clean name if needed */ if (id == HDR_OTHER) @@ -1503,7 +1504,7 @@ if (field_end - value_start > 65534) { /* String must be LESS THAN 64K and it adds a terminating NULL */ - debugs(55, 1, "WARNING: ignoring '" << name.buf() << "' header of " << (field_end - value_start) << " bytes"); + debugs(55, 1, "WARNING: ignoring '" << name << "' header of " << (field_end - value_start) << " bytes"); if (id == HDR_OTHER) name.clean(); @@ -1518,24 +1519,24 @@ Headers[id].stat.aliveCount++; - debugs(55, 9, "parsed HttpHeaderEntry: '" << name.buf() << ": " << value.buf() << "'"); + debugs(55, 9, "parsed HttpHeaderEntry: '" << name << ": " << value << "'"); - return new HttpHeaderEntry(id, name.buf(), value.buf()); + return new HttpHeaderEntry(id, name.termedBuf(), value.termedBuf()); } HttpHeaderEntry * HttpHeaderEntry::clone() const { - return new HttpHeaderEntry(id, name.buf(), value.buf()); + return new HttpHeaderEntry(id, name.termedBuf(), value.termedBuf()); } void HttpHeaderEntry::packInto(Packer * p) const { assert(p); - packerAppend(p, name.buf(), name.size()); + packerAppend(p, name.rawBuf(), name.size()); packerAppend(p, ": ", 2); - packerAppend(p, value.buf(), value.size()); + packerAppend(p, value.rawBuf(), value.size()); packerAppend(p, "\r\n", 2); } @@ -1545,7 +1546,7 @@ assert_eid (id); assert (Headers[id].type == ftInt); int val = -1; - int ok = httpHeaderParseInt(value.buf(), &val); + int ok = httpHeaderParseInt(value.termedBuf(), &val); httpHeaderNoteParsedEntry(id, value, !ok); /* XXX: Should we check ok - ie * return ok ? -1 : value; @@ -1559,7 +1560,7 @@ assert_eid (id); assert (Headers[id].type == ftInt64); int64_t val = -1; - int ok = httpHeaderParseOffset(value.buf(), &val); + int ok = httpHeaderParseOffset(value.termedBuf(), &val); httpHeaderNoteParsedEntry(id, value, !ok); /* XXX: Should we check ok - ie * return ok ? -1 : value; @@ -1574,7 +1575,7 @@ if (error) { Headers[id].stat.errCount++; - debugs(55, 2, "cannot parse hdr field: '" << Headers[id].name.buf() << ": " << context.buf() << "'"); + debugs(55, 2, "cannot parse hdr field: '" << Headers[id].name << ": " << context << "'"); } } @@ -1591,7 +1592,7 @@ { const int id = (int) val; const int valid_id = id >= 0 && id < HDR_ENUM_END; - const char *name = valid_id ? Headers[id].name.buf() : "INVALID"; + const char *name = valid_id ? Headers[id].name.termedBuf() : "INVALID"; int visible = count > 0; /* for entries with zero count, list only those that belong to current type of message */ @@ -1669,7 +1670,7 @@ for (ht = (http_hdr_type)0; ht < HDR_ENUM_END; ++ht) { HttpHeaderFieldInfo *f = Headers + ht; storeAppendPrintf(e, "%2d\t %-25s\t %5d\t %6.3f\t %6.3f\n", - f->id, f->name.buf(), f->stat.aliveCount, + f->id, f->name.termedBuf(), f->stat.aliveCount, xpercent(f->stat.errCount, f->stat.parsCount), xpercent(f->stat.repCount, f->stat.seenCount)); } @@ -1682,7 +1683,7 @@ } http_hdr_type -httpHeaderIdByName(const char *name, int name_len, const HttpHeaderFieldInfo * info, int end) +httpHeaderIdByName(const char *name, size_t name_len, const HttpHeaderFieldInfo * info, int end) { int i; @@ -1690,7 +1691,7 @@ if (name_len >= 0 && name_len != info[i].name.size()) continue; - if (!strncasecmp(name, info[i].name.buf(), + if (!strncasecmp(name, info[i].name.termedBuf(), name_len < 0 ? info[i].name.size() + 1 : name_len)) return info[i].id; } @@ -1715,7 +1716,7 @@ assert(id >= 0 && id < HDR_ENUM_END); - return Headers[id].name.buf(); + return Headers[id].name.termedBuf(); } int @@ -1804,7 +1805,7 @@ int headers_deleted = 0; while ((e = getEntry(&pos))) { - if (strListIsMember(&strConnection, e->name.buf(), ',')) + if (strListIsMember(&strConnection, e->name.termedBuf(), ',')) delAt(pos, headers_deleted); } if (headers_deleted) diff -u -r -N squid-3.1.0.5/src/HttpHeader.h squid-3.1.0.6/src/HttpHeader.h --- squid-3.1.0.5/src/HttpHeader.h 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHeader.h 2009-03-03 12:06:32.000000000 +1300 @@ -33,12 +33,21 @@ #ifndef SQUID_HTTPHEADER_H #define SQUID_HTTPHEADER_H - /* because we pass a spec by value */ #include "HttpHeaderRange.h" /* HttpHeader holds a HttpHeaderMask */ #include "HttpHeaderMask.h" + +/* class forward declarations */ +class HttpVersion; +class HttpHdrContRange; +class HttpHdrCc; +class HttpHdrSc; +class HttpHdrRange; +class String; + + /* constant attributes of http header fields */ /** recognized or "known" header fields; @?@ add more! */ @@ -149,13 +158,6 @@ field_type type; }; -class HttpVersion; - -class HttpHdrContRange; - -class HttpHdrCc; - -class HttpHdrSc; /** Iteration for headers; use HttpHeaderPos as opaque type, do not interpret */ typedef ssize_t HttpHeaderPos; diff -u -r -N squid-3.1.0.5/src/HttpHeaderTools.cc squid-3.1.0.6/src/HttpHeaderTools.cc --- squid-3.1.0.5/src/HttpHeaderTools.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpHeaderTools.cc 2009-03-03 12:06:32.000000000 +1300 @@ -86,7 +86,7 @@ memset(mask, value, sizeof(*mask)); } -/* calculates a bit mask of a given array; does not reset mask! */ +/** calculates a bit mask of a given array; does not reset mask! */ void httpHeaderCalcMask(HttpHeaderMask * mask, http_hdr_type http_hdr_type_enums[], size_t count) { @@ -103,27 +103,10 @@ /* same as httpHeaderPutStr, but formats the string using snprintf first */ void -#if STDC_HEADERS httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt,...) -#else -httpHeaderPutStrf(va_alist) -va_dcl -#endif { -#if STDC_HEADERS va_list args; va_start(args, fmt); -#else - - va_list args; - HttpHeader *hdr = NULL; - http_hdr_type id = HDR_ENUM_END; - const char *fmt = NULL; - va_start(args); - hdr = va_arg(args, HttpHeader *); - id = va_arg(args, http_hdr_type); - fmt = va_arg(args, char *); -#endif httpHeaderPutStrvf(hdr, id, fmt, args); va_end(args); @@ -182,7 +165,7 @@ return res; } -/* returns true iff "m" is a member of the list */ +/** returns true iff "m" is a member of the list */ int strListIsMember(const String * list, const char *m, char del) { @@ -201,14 +184,14 @@ return 0; } -/* returns true iff "s" is a substring of a member of the list */ +/** returns true iff "s" is a substring of a member of the list */ int strListIsSubstr(const String * list, const char *s, char del) { assert(list && del); - return list->pos(s) != 0; + return (list->find(s) != String::npos); - /* + /** \note * Note: the original code with a loop is broken because it uses strstr() * instead of strnstr(). If 's' contains a 'del', strListIsSubstr() may * return true when it should not. If 's' does not contain a 'del', the @@ -217,7 +200,7 @@ */ } -/* appends an item to the list */ +/** appends an item to the list */ void strListAdd(String * str, const char *item, char del) { @@ -234,7 +217,7 @@ str->append(item, strlen(item)); } -/* +/** * iterates through a 0-terminated string of items separated by 'del's. * white space around 'del' is considered to be a part of 'del' * like strtok, but preserves the source, and can iterate several strings at once @@ -258,7 +241,7 @@ delim[2][1] = del; if (!*pos) { - *pos = str->buf(); + *pos = str->termedBuf(); if (!*pos) return 0; @@ -301,7 +284,7 @@ return len > 0; } -/* handy to printf prefixes of potentially very long buffers */ +/** handy to printf prefixes of potentially very long buffers */ const char * getStringPrefix(const char *str, const char *end) { @@ -312,7 +295,7 @@ return buf; } -/* +/** * parses an int field, complains if soemthing went wrong, returns true on * success */ @@ -342,7 +325,8 @@ } -/* Parses a quoted-string field (RFC 2616 section 2.2), complains if +/** + * Parses a quoted-string field (RFC 2616 section 2.2), complains if * something went wrong, returns non-zero on success. * start should point at the first ". * RC TODO: This is too looose. We should honour the BNF and exclude CTL's @@ -373,9 +357,13 @@ } } -/* - * httpHdrMangle checks the anonymizer (header_access) configuration. - * Returns 1 if the header is allowed. +/** + * Checks the anonymizer (header_access) configuration. + * + * \retval 0 Header is explicitly blocked for removal + * \retval 1 Header is explicitly allowed + * \retval 1 Header has been replaced, the current version can be used. + * \retval 1 Header has no access controls to test */ static int httpHdrMangle(HttpHeaderEntry * e, HttpRequest * request, int req_or_rep) @@ -396,10 +384,15 @@ hm = &Config.request_header_access[e->id]; } + /* mangler or checklist went away. default allow */ + if(!hm || !hm->access_list) { + return 1; + } + checklist = aclChecklistCreate(hm->access_list, request, NULL); - if (1 == checklist->fastCheck()) { - /* aclCheckFast returns 1 for allow. */ + if (checklist->fastCheck()) { + /* aclCheckFast returns true for allow. */ retval = 1; } else if (NULL == hm->replacement) { /* It was denied, and we don't have any replacement */ @@ -417,7 +410,7 @@ return retval; } -/* Mangles headers for a list of headers. */ +/** Mangles headers for a list of headers. */ void httpHdrMangleList(HttpHeader * l, HttpRequest * request, int req_or_rep) { @@ -433,7 +426,7 @@ l->refreshMask(); } -/* +/** * return 1 if manglers are configured. Used to set a flag * for optimization during request forwarding. */ diff -u -r -N squid-3.1.0.5/src/HttpReply.cc squid-3.1.0.6/src/HttpReply.cc --- squid-3.1.0.5/src/HttpReply.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpReply.cc 2009-03-03 12:06:32.000000000 +1300 @@ -281,7 +281,7 @@ two = otherRep->header.getStrOrList(HDR_ETAG); - if (!one.buf() || !two.buf() || strcasecmp (one.buf(), two.buf())) { + if (one.undefined() || two.undefined() || one.caseCmp(two)!=0 ) { one.clean(); two.clean(); return 0; @@ -295,7 +295,7 @@ two = otherRep->header.getStrOrList(HDR_CONTENT_MD5); - if (!one.buf() || !two.buf() || strcasecmp (one.buf(), two.buf())) { + if (one.undefined() || two.undefined() || one.caseCmp(two) != 0 ) { one.clean(); two.clean(); return 0; @@ -439,8 +439,9 @@ bool HttpReply::sanityCheckStartLine(MemBuf *buf, http_status *error) { - if (buf->contentSize() >= protoPrefix.size() && protoPrefix.cmp(buf->content(), protoPrefix.size()) != 0) { - debugs(58, 3, "HttpReply::sanityCheckStartLine: missing protocol prefix (" << protoPrefix.buf() << ") in '" << buf->content() << "'"); + //hack warning: using psize instead of size here due to type mismatches with MemBuf. + if (buf->contentSize() >= protoPrefix.psize() && protoPrefix.cmp(buf->content(), protoPrefix.size()) != 0) { + debugs(58, 3, "HttpReply::sanityCheckStartLine: missing protocol prefix (" << protoPrefix << ") in '" << buf->content() << "'"); *error = HTTP_INVALID_HEADER; return false; } @@ -543,7 +544,8 @@ ch.reply = HTTPMSGLOCK(this); // XXX: this lock makes method non-const ch.request = HTTPMSGLOCK(&request); for (acl_size_t *l = Config.ReplyBodySize; l; l = l -> next) { - if (ch.matchAclListFast(l->aclList)) { + /* if there is no ACL list or if the ACLs listed match use this size value */ + if (!l->aclList || ch.matchAclListFast(l->aclList)) { debugs(58, 4, HERE << "bodySizeMax=" << bodySizeMax); bodySizeMax = l->size; // may be -1 break; diff -u -r -N squid-3.1.0.5/src/HttpRequest.cc squid-3.1.0.6/src/HttpRequest.cc --- squid-3.1.0.5/src/HttpRequest.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpRequest.cc 2009-03-03 12:06:32.000000000 +1300 @@ -150,7 +150,7 @@ HttpRequest * HttpRequest::clone() const { - HttpRequest *copy = new HttpRequest(method, protocol, urlpath.buf()); + HttpRequest *copy = new HttpRequest(method, protocol, urlpath.termedBuf()); // TODO: move common cloning clone to Msg::copyTo() or copy ctor copy->header.append(&header); copy->hdrCacheInit(); @@ -298,8 +298,8 @@ { assert(p); /* pack request-line */ - packerPrintf(p, "%s %s HTTP/1.0\r\n", - RequestMethodStr(method), urlpath.buf()); + packerPrintf(p, "%s " SQUIDSTRINGPH " HTTP/1.0\r\n", + RequestMethodStr(method), SQUIDSTRINGPRINT(urlpath)); /* headers */ header.packInto(p); /* trailer */ @@ -326,22 +326,6 @@ header.len + 2; } -/** - * Returns true if HTTP allows us to pass this header on. Does not - * check anonymizer (aka header_access) configuration. - */ -int -httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConn) -{ - assert(e); - /* check connection header */ - - if (strConn && strListIsMember(strConn, e->name.buf(), ',')) - return 0; - - return 1; -} - /* sync this routine when you update HttpRequest struct */ void HttpRequest::hdrCacheInit() @@ -411,7 +395,7 @@ return urlCanonical((HttpRequest*)this); if (urlpath.size()) - return urlpath.buf(); + return urlpath.termedBuf(); return "/"; } diff -u -r -N squid-3.1.0.5/src/HttpRequest.h squid-3.1.0.6/src/HttpRequest.h --- squid-3.1.0.5/src/HttpRequest.h 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpRequest.h 2009-03-03 12:06:32.000000000 +1300 @@ -40,8 +40,7 @@ #include "HttpRequestMethod.h" /* Http Request */ -extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection); -extern int httpRequestHdrAllowedByName(http_hdr_type id); +//DEAD?: extern int httpRequestHdrAllowedByName(http_hdr_type id); extern void httpRequestPack(void *obj, Packer *p); diff -u -r -N squid-3.1.0.5/src/HttpRequestMethod.cc squid-3.1.0.6/src/HttpRequestMethod.cc --- squid-3.1.0.5/src/HttpRequestMethod.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/HttpRequestMethod.cc 2009-03-03 12:06:32.000000000 +1300 @@ -177,7 +177,7 @@ return RequestMethodStr[theMethod]; } else { if (theImage.size()>0) { - return theImage.buf(); + return theImage.termedBuf(); } else { return "METHOD_OTHER"; } diff -u -r -N squid-3.1.0.5/src/ICAP/ICAPModXact.cc squid-3.1.0.6/src/ICAP/ICAPModXact.cc --- squid-3.1.0.5/src/ICAP/ICAPModXact.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ICAP/ICAPModXact.cc 2009-03-03 12:06:32.000000000 +1300 @@ -1029,8 +1029,8 @@ * XXX These should use HttpHdr interfaces instead of Printfs */ const Adaptation::ServiceConfig &s = service().cfg(); - buf.Printf("%s %s ICAP/1.0\r\n", s.methodStr(), s.uri.buf()); - buf.Printf("Host: %s:%d\r\n", s.host.buf(), s.port); + buf.Printf("%s " SQUIDSTRINGPH " ICAP/1.0\r\n", s.methodStr(), SQUIDSTRINGPRINT(s.uri)); + buf.Printf("Host: " SQUIDSTRINGPH ":%d\r\n", SQUIDSTRINGPRINT(s.host), s.port); buf.Printf("Date: %s\r\n", mkrfc1123(squid_curtime)); if (!TheICAPConfig.reuse_connections) @@ -1038,13 +1038,15 @@ // we must forward "Proxy-Authenticate" and "Proxy-Authorization" // as ICAP headers. - if (virgin.header->header.has(HDR_PROXY_AUTHENTICATE)) - buf.Printf("Proxy-Authenticate: %s\r\n", - virgin.header->header.getByName("Proxy-Authenticate").buf()); - - if (virgin.header->header.has(HDR_PROXY_AUTHORIZATION)) - buf.Printf("Proxy-Authorization: %s\r\n", - virgin.header->header.getByName("Proxy-Authorization").buf()); + if (virgin.header->header.has(HDR_PROXY_AUTHENTICATE)) { + String vh=virgin.header->header.getByName("Proxy-Authenticate"); + buf.Printf("Proxy-Authenticate: " SQUIDSTRINGPH "\r\n",SQUIDSTRINGPRINT(vh)); + } + + if (virgin.header->header.has(HDR_PROXY_AUTHORIZATION)) { + String vh=virgin.header->header.getByName("Proxy-Authorization"); + buf.Printf("Proxy-Authorization: " SQUIDSTRINGPH "\r\n", SQUIDSTRINGPRINT(vh)); + } buf.Printf("Encapsulated: "); diff -u -r -N squid-3.1.0.5/src/ICAP/ICAPOptions.cc squid-3.1.0.6/src/ICAP/ICAPOptions.cc --- squid-3.1.0.5/src/ICAP/ICAPOptions.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ICAP/ICAPOptions.cc 2009-03-03 12:06:32.000000000 +1300 @@ -124,8 +124,8 @@ { const String s = h->getByName(fname); - if (s.size() && xisdigit(*s.buf())) - value = atoi(s.buf()); + if (s.size() && xisdigit(*s.termedBuf())) + value = atoi(s.termedBuf()); else value = -1; @@ -176,8 +176,8 @@ if (eLen < urlLen) { const int eOff = urlLen - eLen; // RFC 3507 examples imply that extensions come without leading '.' - if (urlPath.buf()[eOff-1] == '.' && - strcmp(urlPath.buf() + eOff, e->key) == 0) { + if (urlPath[eOff-1] == '.' && + strcmp(urlPath.termedBuf() + eOff, e->key) == 0) { debugs(93,7, "ICAPOptions url " << urlPath << " matches " << name << " extension " << e->key); return true; diff -u -r -N squid-3.1.0.5/src/ICAP/ICAPOptXact.cc squid-3.1.0.6/src/ICAP/ICAPOptXact.cc --- squid-3.1.0.5/src/ICAP/ICAPOptXact.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ICAP/ICAPOptXact.cc 2009-03-03 12:06:32.000000000 +1300 @@ -43,8 +43,10 @@ void ICAPOptXact::makeRequest(MemBuf &buf) { const Adaptation::Service &s = service(); - buf.Printf("OPTIONS %s ICAP/1.0\r\n", s.cfg().uri.buf()); - buf.Printf("Host: %s:%d\r\n", s.cfg().host.buf(), s.cfg().port); + const String uri = s.cfg().uri; + buf.Printf("OPTIONS " SQUIDSTRINGPH " ICAP/1.0\r\n", SQUIDSTRINGPRINT(uri)); + const String host = s.cfg().host; + buf.Printf("Host: " SQUIDSTRINGPH ":%d\r\n", SQUIDSTRINGPRINT(host), s.cfg().port); buf.append(ICAP::crlf, 2); } diff -u -r -N squid-3.1.0.5/src/ICAP/ICAPServiceRep.cc squid-3.1.0.6/src/ICAP/ICAPServiceRep.cc --- squid-3.1.0.5/src/ICAP/ICAPServiceRep.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ICAP/ICAPServiceRep.cc 2009-03-03 12:06:32.000000000 +1300 @@ -279,8 +279,8 @@ if (!method_found) { debugs(93,1, "WARNING: Squid is configured to use ICAP method " << cfg().methodStr() << - " for service " << cfg().uri.buf() << - " but OPTIONS response declares the methods are " << method_list.buf()); + " for service " << cfg().uri << + " but OPTIONS response declares the methods are " << method_list); } } @@ -293,7 +293,7 @@ // TODO: If skew is negative, the option will be considered down // because of stale options. We should probably change this. debugs(93, 1, "ICAP service's clock is skewed by " << skew << - " seconds: " << cfg().uri.buf()); + " seconds: " << cfg().uri); } } diff -u -r -N squid-3.1.0.5/src/ICAP/ICAPXaction.cc squid-3.1.0.6/src/ICAP/ICAPXaction.cc --- squid-3.1.0.5/src/ICAP/ICAPXaction.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/ICAP/ICAPXaction.cc 2009-03-03 12:06:32.000000000 +1300 @@ -76,7 +76,7 @@ disableRetries(); // this will also safely drain pconn pool // TODO: check whether NULL domain is appropriate here - connection = icapPconnPool->pop(s.cfg().host.buf(), s.cfg().port, NULL, client_addr, isRetriable); + connection = icapPconnPool->pop(s.cfg().host.termedBuf(), s.cfg().port, NULL, client_addr, isRetriable); if (connection >= 0) { debugs(93,3, HERE << "reused pconn FD " << connection); @@ -96,12 +96,12 @@ IpAddress outgoing; connection = comm_open(SOCK_STREAM, 0, outgoing, - COMM_NONBLOCKING, s.cfg().uri.buf()); + COMM_NONBLOCKING, s.cfg().uri.termedBuf()); if (connection < 0) dieOnConnectionFailure(); // throws - debugs(93,3, typeName << " opens connection to " << s.cfg().host.buf() << ":" << s.cfg().port); + debugs(93,3, typeName << " opens connection to " << s.cfg().host << ":" << s.cfg().port); // TODO: service bypass status may differ from that of a transaction typedef CommCbMemFunT TimeoutDialer; @@ -119,7 +119,7 @@ typedef CommCbMemFunT ConnectDialer; connector = asyncCall(93,3, "ICAPXaction::noteCommConnected", ConnectDialer(this, &ICAPXaction::noteCommConnected)); - commConnectStart(connection, s.cfg().host.buf(), s.cfg().port, connector); + commConnectStart(connection, s.cfg().host.termedBuf(), s.cfg().port, connector); } /* @@ -148,19 +148,22 @@ cancelRead(); // may not work if (reuseConnection && !doneWithIo()) { + //status() adds leading spaces. debugs(93,5, HERE << "not reusing pconn due to pending I/O" << status()); reuseConnection = false; } if (reuseConnection) { IpAddress client_addr; + //status() adds leading spaces. debugs(93,3, HERE << "pushing pconn" << status()); AsyncCall::Pointer call = NULL; commSetTimeout(connection, -1, call); - icapPconnPool->push(connection, theService->cfg().host.buf(), + icapPconnPool->push(connection, theService->cfg().host.termedBuf(), theService->cfg().port, NULL, client_addr); disableRetries(); } else { + //status() adds leading spaces. debugs(93,3, HERE << "closing pconn" << status()); // comm_close will clear timeout comm_close(connection); @@ -232,7 +235,7 @@ { debugs(93, 2, HERE << typeName << " failed: timeout with " << theService->cfg().methodStr() << " " << - theService->cfg().uri.buf() << status()); + theService->cfg().uri << status()); reuseConnection = false; service().noteFailure(); diff -u -r -N squid-3.1.0.5/src/icp_v2.cc squid-3.1.0.6/src/icp_v2.cc --- squid-3.1.0.5/src/icp_v2.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/icp_v2.cc 2009-03-03 12:06:34.000000000 +1300 @@ -405,6 +405,10 @@ int icpAccessAllowed(IpAddress &from, HttpRequest * icp_request) { + /* absent an explicit allow, we deny all */ + if (!Config.accessList.icp) + return 0; + ACLChecklist checklist; checklist.src_addr = from; checklist.my_addr.SetNoAddr(); diff -u -r -N squid-3.1.0.5/src/internal.cc squid-3.1.0.6/src/internal.cc --- squid-3.1.0.5/src/internal.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/internal.cc 2009-03-03 12:06:34.000000000 +1300 @@ -51,7 +51,7 @@ internalStart(HttpRequest * request, StoreEntry * entry) { ErrorState *err; - const char *upath = request->urlpath.buf(); + const char *upath = request->urlpath.termedBuf(); debugs(76, 3, "internalStart: " << request->client_addr << " requesting '" << upath << "'"); if (0 == strcmp(upath, "/squid-internal-dynamic/netdb")) { diff -u -r -N squid-3.1.0.5/src/LoadableModule.cc squid-3.1.0.6/src/LoadableModule.cc --- squid-3.1.0.5/src/LoadableModule.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/LoadableModule.cc 2009-03-03 12:06:32.000000000 +1300 @@ -67,7 +67,7 @@ void *LoadableModule::openModule(int mode) { # if XSTD_USE_LIBLTDL - return lt_dlopen(theName.buf()); + return lt_dlopen(theName.termedBuf()); # else return dlopen(theName.c_str(), mode == lmNow ? RTLD_NOW : RTLD_LAZY); diff -u -r -N squid-3.1.0.5/src/logfile.cc squid-3.1.0.6/src/logfile.cc --- squid-3.1.0.5/src/logfile.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/logfile.cc 2009-03-03 12:06:34.000000000 +1300 @@ -101,19 +101,16 @@ if (path[6] != '\0') { path += 7; - char* delim = strchr(path, '.'); - - if (!delim) - delim = strchr(path, '|'); - - if (delim != NULL) - *delim = '\0'; - - lf->syslog_priority = syslog_ntoa(path); - - if (delim != NULL) - lf->syslog_priority |= syslog_ntoa(delim+1); - + char *priority = xstrdup(path); + char *facility = (char *) strchr(priority, '.'); + if (!facility) + facility = (char *) strchr(priority, '|'); + if (facility) { + *facility++ = '\0'; + lf->syslog_priority |= syslog_ntoa(facility); + } + lf->syslog_priority |= syslog_ntoa(priority); + xfree(priority); if (0 == (lf->syslog_priority & PRIORITY_MASK)) lf->syslog_priority |= LOG_INFO; } @@ -257,27 +254,13 @@ } void -#if STDC_HEADERS logfilePrintf(Logfile * lf, const char *fmt,...) -#else -logfilePrintf(va_alist) -va_dcl -#endif { va_list args; char buf[8192]; int s; -#if STDC_HEADERS va_start(args, fmt); -#else - - Logfile *lf; - const char *fmt; - va_start(args); - lf = va_arg(args, Logfile *); - fmt = va_arg(args, char *); -#endif s = vsnprintf(buf, 8192, fmt, args); diff -u -r -N squid-3.1.0.5/src/main.cc squid-3.1.0.6/src/main.cc --- squid-3.1.0.5/src/main.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/main.cc 2009-03-03 12:06:34.000000000 +1300 @@ -1240,7 +1240,7 @@ setUmask(Config.umask); if (-1 == opt_send_signal) if (checkRunningPid()) - exit(1); + exit(0); #if TEST_ACCESS @@ -1396,8 +1396,13 @@ exit(1); } } else { - fprintf(stderr, "%s: ERROR: No running copy\n", APP_SHORTNAME); - exit(1); + if (opt_send_signal != SIGTERM) { + fprintf(stderr, "%s: ERROR: No running copy\n", APP_SHORTNAME); + exit(1); + } else { + fprintf(stderr, "%s: No running copy\n", APP_SHORTNAME); + exit(0); + } } /* signal successfully sent */ diff -u -r -N squid-3.1.0.5/src/Makefile.am squid-3.1.0.6/src/Makefile.am --- squid-3.1.0.5/src/Makefile.am 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/Makefile.am 2009-03-03 12:06:32.000000000 +1300 @@ -1022,9 +1022,9 @@ DEFAULT_HTTP_PORT = @CACHE_HTTP_PORT@ DEFAULT_ICP_PORT = @CACHE_ICP_PORT@ DEFAULT_PREFIX = $(prefix) -DEFAULT_CONFIG_FILE = $(sysconfdir)/squid.conf DEFAULT_CONFIG_DIR = $(sysconfdir) -DEFAULT_MIME_TABLE = $(sysconfdir)/mime.conf +DEFAULT_CONFIG_FILE = $(DEFAULT_CONFIG_DIR)/squid.conf +DEFAULT_MIME_TABLE = $(DEFAULT_CONFIG_DIR)/mime.conf DEFAULT_DNSSERVER = $(libexecdir)/`echo dnsserver | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_LOG_PREFIX = @DEFAULT_LOG_DIR@ DEFAULT_CACHE_LOG = $(DEFAULT_LOG_PREFIX)/cache.log @@ -1041,7 +1041,8 @@ DEFAULT_MIB_PATH = $(datadir)/mib.txt DEFAULT_HOSTS = @OPT_DEFAULT_HOSTS@ -DEFS = @DEFS@ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" +# Make location configure settings available to the code +DEFS = @DEFS@ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\" $(OBJS): $(top_srcdir)/include/version.h ../include/autoconf.h @@ -1067,7 +1068,7 @@ true squid.conf.default: squid.conf.documented - grep -v -E "^[#\ ]" squid.conf.documented | grep . >squid.conf.default + $(EGREP) -v "^[#\ ]" squid.conf.documented | $(EGREP) . >squid.conf.default cf_parser.h: cf.data cf_gen$(EXEEXT) ./cf_gen cf.data $(srcdir)/cf.data.depend @@ -1126,16 +1127,8 @@ $(mkinstalldirs) $(DESTDIR)$(DEFAULT_LOG_PREFIX) uninstall-local: - @if test -f $(DESTDIR)$(DEFAULT_MIME_TABLE) ; then \ - echo "rm -f $(DESTDIR)$(DEFAULT_MIME_TABLE)"; \ - $(RM) -f $(DESTDIR)$(DEFAULT_MIME_TABLE); \ - fi - -# Don't automatically uninstall config files -# @if test -f $(DESTDIR)$(DEFAULT_CONFIG_FILE) ; then \ -# echo "rm -f $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -# $(RM) -f $(DESTDIR)$(DEFAULT_CONFIG_FILE); \ -# fi + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_MIME_TABLE) + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_CONFIG_FILE) CLEANFILES = cf_gen_defines.h cf.data cf_parser.h squid.conf.default squid.conf.documented \ globals.cc string_arrays.c repl_modules.cc DiskIO/DiskIOModules_gen.cc \ @@ -1511,6 +1504,7 @@ $(SWAP_TEST_GEN_SOURCES) tests_testDiskIO_LDADD = \ ip/libip.la \ + libsquid.la \ @DISK_LIBS@ \ $(SWAP_TEST_LDADD) \ SquidConfig.o diff -u -r -N squid-3.1.0.5/src/Makefile.in squid-3.1.0.6/src/Makefile.in --- squid-3.1.0.5/src/Makefile.in 2009-02-03 14:16:00.000000000 +1300 +++ squid-3.1.0.6/src/Makefile.in 2009-03-03 12:06:57.000000000 +1300 @@ -1595,7 +1595,9 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_LOG_DIR = @DEFAULT_LOG_DIR@ -DEFS = @DEFS@ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" + +# Make location configure settings available to the code +DEFS = @DEFS@ -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\" DEPDIR = @DEPDIR@ DIGEST_AUTH_HELPERS = @DIGEST_AUTH_HELPERS@ DISK_LIBS = @DISK_LIBS@ @@ -2491,9 +2493,9 @@ DEFAULT_HTTP_PORT = @CACHE_HTTP_PORT@ DEFAULT_ICP_PORT = @CACHE_ICP_PORT@ DEFAULT_PREFIX = $(prefix) -DEFAULT_CONFIG_FILE = $(sysconfdir)/squid.conf DEFAULT_CONFIG_DIR = $(sysconfdir) -DEFAULT_MIME_TABLE = $(sysconfdir)/mime.conf +DEFAULT_CONFIG_FILE = $(DEFAULT_CONFIG_DIR)/squid.conf +DEFAULT_MIME_TABLE = $(DEFAULT_CONFIG_DIR)/mime.conf DEFAULT_DNSSERVER = $(libexecdir)/`echo dnsserver | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_LOG_PREFIX = @DEFAULT_LOG_DIR@ DEFAULT_CACHE_LOG = $(DEFAULT_LOG_PREFIX)/cache.log @@ -2509,12 +2511,6 @@ DEFAULT_ERROR_DIR = $(datadir)/errors DEFAULT_MIB_PATH = $(datadir)/mib.txt DEFAULT_HOSTS = @OPT_DEFAULT_HOSTS@ - -# Don't automatically uninstall config files -# @if test -f $(DESTDIR)$(DEFAULT_CONFIG_FILE) ; then \ -# echo "rm -f $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -# $(RM) -f $(DESTDIR)$(DEFAULT_CONFIG_FILE); \ -# fi CLEANFILES = cf_gen_defines.h cf.data cf_parser.h squid.conf.default \ squid.conf.documented globals.cc string_arrays.c \ repl_modules.cc DiskIO/DiskIOModules_gen.cc test_tools.cc *.a \ @@ -2838,6 +2834,7 @@ tests_testDiskIO_LDADD = \ ip/libip.la \ + libsquid.la \ @DISK_LIBS@ \ $(SWAP_TEST_LDADD) \ SquidConfig.o @@ -5258,7 +5255,7 @@ true squid.conf.default: squid.conf.documented - grep -v -E "^[#\ ]" squid.conf.documented | grep . >squid.conf.default + $(EGREP) -v "^[#\ ]" squid.conf.documented | $(EGREP) . >squid.conf.default cf_parser.h: cf.data cf_gen$(EXEEXT) ./cf_gen cf.data $(srcdir)/cf.data.depend @@ -5314,10 +5311,8 @@ $(mkinstalldirs) $(DESTDIR)$(DEFAULT_LOG_PREFIX) uninstall-local: - @if test -f $(DESTDIR)$(DEFAULT_MIME_TABLE) ; then \ - echo "rm -f $(DESTDIR)$(DEFAULT_MIME_TABLE)"; \ - $(RM) -f $(DESTDIR)$(DEFAULT_MIME_TABLE); \ - fi + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_MIME_TABLE) + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_CONFIG_FILE) test_tools.cc: $(top_srcdir)/test-suite/test_tools.cc cp $(top_srcdir)/test-suite/test_tools.cc . diff -u -r -N squid-3.1.0.5/src/MemBuf.cc squid-3.1.0.6/src/MemBuf.cc --- squid-3.1.0.5/src/MemBuf.cc 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/MemBuf.cc 2009-03-03 12:06:32.000000000 +1300 @@ -273,22 +273,11 @@ } /* calls memBufVPrintf */ -#if STDC_HEADERS void MemBuf::Printf(const char *fmt,...) { va_list args; va_start(args, fmt); -#else -void -MemBuf::Printf(va_alist) -va_dcl { - va_list args; - mb_size_t sz = 0; - va_start(args); - const char *fmt = va_arg(args, char *); -#endif - vPrintf(fmt, args); va_end(args); } diff -u -r -N squid-3.1.0.5/src/MemBuf.h squid-3.1.0.6/src/MemBuf.h --- squid-3.1.0.5/src/MemBuf.h 2009-02-03 14:15:36.000000000 +1300 +++ squid-3.1.0.6/src/MemBuf.h 2009-03-03 12:06:32.000000000 +1300 @@ -105,23 +105,12 @@ /** unfirtunate hack to test if the buffer has been Init()ialized */ int isNull(); -#if STDC_HEADERS - /** * calls snprintf, extends buffer if needed \note we use Printf instead of printf so the compiler won't * think we're calling the libc printf() */ void Printf(const char *fmt,...) PRINTF_FORMAT_ARG2; -#else - - /** - * calls snprintf, extends buffer if needed - \note we use Printf instead of printf so the compiler won't - * think we're calling the libc printf() - */ - void Printf(); -#endif /** vPrintf for other printf()'s to use */ void vPrintf(const char *fmt, va_list ap); diff -u -r -N squid-3.1.0.5/src/Packer.cc squid-3.1.0.6/src/Packer.cc --- squid-3.1.0.5/src/Packer.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/Packer.cc 2009-03-03 12:06:32.000000000 +1300 @@ -167,24 +167,11 @@ p->append(p->real_handler, buf, sz); } -#if STDC_HEADERS void packerPrintf(Packer * p, const char *fmt,...) { va_list args; va_start(args, fmt); -#else -void -packerPrintf(va_alist) -va_dcl { - va_list args; - Packer *p = NULL; - const char *fmt = NULL; - int sz = 0; - va_start(args); - p = va_arg(args, Packer *); - fmt = va_arg(args, char *); -#endif assert(p); assert(p->real_handler && p->packer_vprintf); diff -u -r -N squid-3.1.0.5/src/Packer.h squid-3.1.0.6/src/Packer.h --- squid-3.1.0.5/src/Packer.h 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/Packer.h 2009-03-03 12:06:32.000000000 +1300 @@ -46,11 +46,7 @@ #endif /* append/vprintf's for Packer */ typedef void (*append_f) (void *, const char *buf, int size); -#if STDC_HEADERS typedef void (*vprintf_f) (void *, const char *fmt, va_list args); -#else -typedef void (*vprintf_f) (); -#endif class Packer @@ -65,11 +61,7 @@ SQUIDCEXTERN void packerClean(Packer * p); SQUIDCEXTERN void packerAppend(Packer * p, const char *buf, int size); -#if STDC_HEADERS SQUIDCEXTERN void packerPrintf(Packer * p, const char *fmt,...) PRINTF_FORMAT_ARG2; -#else -SQUIDCEXTERN void packerPrintf(); -#endif #endif /* SQUID_PACKER_H */ diff -u -r -N squid-3.1.0.5/src/pconn.cc squid-3.1.0.6/src/pconn.cc --- squid-3.1.0.5/src/pconn.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/pconn.cc 2009-03-03 12:06:34.000000000 +1300 @@ -238,14 +238,18 @@ for (i = 0; i < PCONN_HIST_SZ; i++) hist[i] = 0; - PconnModule::GetInstance()->add - (this); + PconnModule::GetInstance()->add(this); +} + +PconnPool::~PconnPool() +{ + descr = NULL; + hashFreeMemory(table); } void PconnPool::push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address) { - IdleConnList *list; const char *aKey; LOCAL_ARRAY(char, desc, FD_DESC_SZ); diff -u -r -N squid-3.1.0.5/src/pconn.h squid-3.1.0.6/src/pconn.h --- squid-3.1.0.5/src/pconn.h 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/pconn.h 2009-03-03 12:06:34.000000000 +1300 @@ -70,6 +70,7 @@ public: PconnPool(const char *); + ~PconnPool(); void moduleInit(); void push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address); diff -u -r -N squid-3.1.0.5/src/peer_digest.cc squid-3.1.0.6/src/peer_digest.cc --- squid-3.1.0.5/src/peer_digest.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/peer_digest.cc 2009-03-03 12:06:34.000000000 +1300 @@ -231,7 +231,7 @@ { eventAdd("peerDigestCheck", peerDigestCheck, pd, (double) delay, 1); pd->times.next_check = squid_curtime + delay; - debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host.buf() << " in " << delay << " secs"); + debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host << " in " << delay << " secs"); } /* @@ -241,10 +241,10 @@ peerDigestNotePeerGone(PeerDigest * pd) { if (pd->flags.requested) { - debugs(72, 2, "peerDigest: peer " << pd->host.buf() << " gone, will destroy after fetch."); + debugs(72, 2, "peerDigest: peer " << pd->host << " gone, will destroy after fetch."); /* do nothing now, the fetching chain will notice and take action */ } else { - debugs(72, 2, "peerDigest: peer " << pd->host.buf() << " is gone, destroying now."); + debugs(72, 2, "peerDigest: peer " << pd->host << " is gone, destroying now."); peerDigestDestroy(pd); } } @@ -279,7 +279,7 @@ /* per-peer limit */ if (req_time - pd->times.received < PeerDigestReqMinGap) { - debugs(72, 2, "peerDigestCheck: " << pd->host.buf() << + debugs(72, 2, "peerDigestCheck: " << pd->host << ", avoiding close peer requests (" << (int) (req_time - pd->times.received) << " < " << (int) PeerDigestReqMinGap << " secs)."); @@ -289,7 +289,7 @@ /* global limit */ if (req_time - pd_last_req_time < GlobDigestReqMinGap) { - debugs(72, 2, "peerDigestCheck: " << pd->host.buf() << + debugs(72, 2, "peerDigestCheck: " << pd->host << ", avoiding close requests (" << (int) (req_time - pd_last_req_time) << " < " << (int) GlobDigestReqMinGap << " secs)."); @@ -544,7 +544,7 @@ assert(reply); assert (reply->sline.status != 0); status = reply->sline.status; - debugs(72, 3, "peerDigestFetchReply: " << pd->host.buf() << " status: " << status << + debugs(72, 3, "peerDigestFetchReply: " << pd->host << " status: " << status << ", expires: " << (long int) reply->expires << " (" << std::showpos << (int) (reply->expires - squid_curtime) << ")"); @@ -634,7 +634,7 @@ assert (fetch->entry->getReply()->sline.status != 0); if (fetch->entry->getReply()->sline.status != HTTP_OK) { - debugs(72, 1, "peerDigestSwapInHeaders: " << fetch->pd->host.buf() << + debugs(72, 1, "peerDigestSwapInHeaders: " << fetch->pd->host << " status " << fetch->entry->getReply()->sline.status << " got cached!"); @@ -762,7 +762,7 @@ #endif else - host = pd->host.buf(); + host = pd->host.termedBuf(); } debugs(72, 6, step_name << ": peer " << host << ", offset: " << @@ -813,7 +813,7 @@ peerDigestFetchStop(DigestFetchState * fetch, char *buf, const char *reason) { assert(reason); - debugs(72, 2, "peerDigestFetchStop: peer " << fetch->pd->host.buf() << ", reason: " << reason); + debugs(72, 2, "peerDigestFetchStop: peer " << fetch->pd->host << ", reason: " << reason); peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 0); } @@ -822,7 +822,7 @@ peerDigestFetchAbort(DigestFetchState * fetch, char *buf, const char *reason) { assert(reason); - debugs(72, 2, "peerDigestFetchAbort: peer " << fetch->pd->host.buf() << ", reason: " << reason); + debugs(72, 2, "peerDigestFetchAbort: peer " << fetch->pd->host << ", reason: " << reason); peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 1); } @@ -872,7 +872,7 @@ peerDigestPDFinish(DigestFetchState * fetch, int pcb_valid, int err) { PeerDigest *pd = fetch->pd; - const char *host = pd->host.buf(); + const char *host = pd->host.termedBuf(); pd->times.received = squid_curtime; pd->times.req_delay = fetch->resp_time; @@ -986,7 +986,7 @@ { StoreDigestCBlock cblock; int freed_size = 0; - const char *host = pd->host.buf(); + const char *host = pd->host.termedBuf(); xmemcpy(&cblock, buf, sizeof(cblock)); /* network -> host conversions */ @@ -1080,7 +1080,7 @@ const int bit_util = cacheDigestBitUtil(pd->cd); if (bit_util > 65) { - debugs(72, 0, "Warning: " << pd->host.buf() << + debugs(72, 0, "Warning: " << pd->host << " peer digest has too many bits on (" << bit_util << "%%)."); return 0; @@ -1106,7 +1106,7 @@ assert(pd); - const char *host = pd->host.buf(); + const char *host = pd->host.termedBuf(); storeAppendPrintf(e, "\npeer digest from %s\n", host); cacheDigestGuessStatsReport(&pd->stats.guess, e, host); diff -u -r -N squid-3.1.0.5/src/peer_select.cc squid-3.1.0.6/src/peer_select.cc --- squid-3.1.0.5/src/peer_select.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/peer_select.cc 2009-03-03 12:06:34.000000000 +1300 @@ -290,18 +290,21 @@ HttpRequest *request = ps->request; debugs(44, 3, "peerSelectFoo: '" << RequestMethodStr(request->method) << " " << request->GetHost() << "'"); + /** If we don't known whether DIRECT is permitted ... */ if (ps->direct == DIRECT_UNKNOWN) { if (ps->always_direct == 0 && Config.accessList.AlwaysDirect) { + /** check always_direct; */ ps->acl_checklist = aclChecklistCreate( Config.accessList.AlwaysDirect, request, NULL); /* ident */ - ps->acl_checklist->nonBlockingCheck(peerCheckAlwaysDirectDone, - ps); + ps->acl_checklist->nonBlockingCheck(peerCheckAlwaysDirectDone, ps); return; } else if (ps->always_direct > 0) { + /** if always_direct says YES, do that. */ ps->direct = DIRECT_YES; } else if (ps->never_direct == 0 && Config.accessList.NeverDirect) { + /** check never_direct; */ ps->acl_checklist = aclChecklistCreate( Config.accessList.NeverDirect, request, @@ -310,10 +313,13 @@ ps); return; } else if (ps->never_direct > 0) { + /** if always_direct says NO, do that. */ ps->direct = DIRECT_NO; } else if (request->flags.accelerated) { + /** if we are accelerating, direct is not an option. */ ps->direct = DIRECT_NO; } else if (request->flags.loopdetect) { + /** if we are in a forwarding-loop, direct is not an option. */ ps->direct = DIRECT_YES; } else if (peerCheckNetdbDirect(ps)) { ps->direct = DIRECT_YES; diff -u -r -N squid-3.1.0.5/src/protos.h squid-3.1.0.6/src/protos.h --- squid-3.1.0.5/src/protos.h 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/protos.h 2009-03-03 12:06:34.000000000 +1300 @@ -101,11 +101,7 @@ SQUIDCEXTERN void _db_init(const char *logfile, const char *options); SQUIDCEXTERN void _db_rotate_log(void); -#if STDC_HEADERS SQUIDCEXTERN void _db_print(const char *,...) PRINTF_FORMAT_ARG1; -#else -SQUIDCEXTERN void _db_print(); -#endif /* packs, then prints an object using debug() */ SQUIDCEXTERN void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm); @@ -183,6 +179,7 @@ SQUIDCEXTERN void ftpStart(FwdState *); class HttpRequest; +class HttpReply; /// \ingroup ServerProtocolFTPAPI SQUIDCEXTERN const char *ftpUrlWith2f(HttpRequest *); @@ -259,7 +256,7 @@ class HttpHeaderFieldInfo; SQUIDCEXTERN HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count); SQUIDCEXTERN void httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * info, int count); -SQUIDCEXTERN http_hdr_type httpHeaderIdByName(const char *name, int name_len, const HttpHeaderFieldInfo * attrs, int end); +SQUIDCEXTERN http_hdr_type httpHeaderIdByName(const char *name, size_t name_len, const HttpHeaderFieldInfo * attrs, int end); SQUIDCEXTERN http_hdr_type httpHeaderIdByNameDef(const char *name, int name_len); SQUIDCEXTERN const char *httpHeaderNameById(int id); SQUIDCEXTERN int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); @@ -270,12 +267,8 @@ SQUIDCEXTERN const char *getStringPrefix(const char *str, const char *end); SQUIDCEXTERN int httpHeaderParseInt(const char *start, int *val); SQUIDCEXTERN int httpHeaderParseOffset(const char *start, int64_t * off); -#if STDC_HEADERS SQUIDCEXTERN void httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt,...) PRINTF_FORMAT_ARG3; -#else -SQUIDCEXTERN void httpHeaderPutStrf(); -#endif /* Http Header */ @@ -566,12 +559,7 @@ SQUIDCEXTERN void safeunlink(const char *path, int quiet); SQUIDCEXTERN void death(int sig); SQUIDCEXTERN void fatal(const char *message); -#if STDC_HEADERS -SQUIDCEXTERN void -fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; -#else -SQUIDCEXTERN void fatalf(); -#endif +SQUIDCEXTERN void fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; SQUIDCEXTERN void fatal_dump(const char *message); SQUIDCEXTERN void sigusr2_handle(int sig); SQUIDCEXTERN void sig_child(int sig); @@ -720,12 +708,7 @@ SQUIDCEXTERN void logfileRotate(Logfile * lf); SQUIDCEXTERN void logfileWrite(Logfile * lf, void *buf, size_t len); SQUIDCEXTERN void logfileFlush(Logfile * lf); -#if STDC_HEADERS -SQUIDCEXTERN void -logfilePrintf(Logfile * lf, const char *fmt,...) PRINTF_FORMAT_ARG2; -#else -SQUIDCEXTERN void logfilePrintf(va_alist); -#endif +SQUIDCEXTERN void logfilePrintf(Logfile * lf, const char *fmt,...) PRINTF_FORMAT_ARG2; /* * prototypes for system functions missing from system includes diff -u -r -N squid-3.1.0.5/src/redirect.cc squid-3.1.0.6/src/redirect.cc --- squid-3.1.0.5/src/redirect.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/redirect.cc 2009-03-03 12:06:34.000000000 +1300 @@ -137,8 +137,8 @@ if (http->request->auth_user_request) r->client_ident = http->request->auth_user_request->username(); - else if (http->request->extacl_user.buf() != NULL) { - r->client_ident = http->request->extacl_user.buf(); + else if (http->request->extacl_user.defined()) { + r->client_ident = http->request->extacl_user.termedBuf(); } if (!r->client_ident && (conn != NULL && conn->rfc931[0])) diff -u -r -N squid-3.1.0.5/src/snmp_core.cc squid-3.1.0.6/src/snmp_core.cc --- squid-3.1.0.5/src/snmp_core.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/snmp_core.cc 2009-03-03 12:06:34.000000000 +1300 @@ -58,13 +58,8 @@ mib_tree_entry *mib_tree_head; mib_tree_entry *mib_tree_last; -#if STDC_HEADERS static mib_tree_entry *snmpAddNode(oid * name, int len, oid_ParseFn * parsefunction, instance_Fn * instancefunction, int children,...); static oid *snmpCreateOid(int length,...); -#else -static mib_tree_entry *snmpAddNode(); -static oid *snmpCreateOid(); -#endif SQUIDCEXTERN void (*snmplib_debug_hook) (int, char *); static oid *static_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn); static oid *time_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn); @@ -532,7 +527,9 @@ rq->session.Version = SNMP_VERSION_1; Community = snmp_parse(&rq->session, PDU, buf, len); - if (Community) { + /* Check if we have explicit permission to access SNMP data. + * default (set above) is to deny all */ + if (Community && Config.accessList.snmp) { ACLChecklist checklist; checklist.accessList = cbdataReference(Config.accessList.snmp); checklist.src_addr = rq->from; @@ -982,33 +979,12 @@ * Adds a node to the MIB tree structure and adds the appropriate children */ static mib_tree_entry * -#if STDC_HEADERS snmpAddNode(oid * name, int len, oid_ParseFn * parsefunction, instance_Fn * instancefunction, int children,...) -#else -snmpAddNode(va_alist) -va_dcl -#endif { -#if STDC_HEADERS va_list args; int loop; mib_tree_entry *entry = NULL; va_start(args, children); -#else - - va_list args; - oid *name = NULL; - int len = 0, children = 0, loop; - oid_ParseFn *parsefunction = NULL; - instance_Fn *instancefunction = NULL; - mib_tree_entry *entry = NULL; - va_start(args); - name = va_arg(args, oid *); - len = va_arg(args, int); - parsefunction = va_arg(args, oid_ParseFn *); - instancefunction = va_arg(args, instance_Fn *); - children = va_arg(args, int); -#endif debugs(49, 6, "snmpAddNode: Children : " << children << ", Oid : "); snmpDebugOid(6, name, len); @@ -1038,26 +1014,12 @@ * Returns the list of parameters in an oid */ static oid * -#if STDC_HEADERS snmpCreateOid(int length,...) -#else -snmpCreateOid(va_alist) -va_dcl -#endif { -#if STDC_HEADERS va_list args; oid *new_oid; int loop; va_start(args, length); -#else - - va_list args; - int length = 0, loop; - oid *new_oid; - va_start(args); - length va_arg(args, int); -#endif new_oid = (oid *)xmalloc(sizeof(oid) * length); diff -u -r -N squid-3.1.0.5/src/SquidString.h squid-3.1.0.6/src/SquidString.h --- squid-3.1.0.5/src/SquidString.h 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/SquidString.h 2009-03-03 12:06:32.000000000 +1300 @@ -40,6 +40,12 @@ /** todo checks to wrap this include properly */ #include +/* squid string placeholder (for printf) */ +#ifndef SQUIDSTRINGPH +#define SQUIDSTRINGPH "%.*s" +#define SQUIDSTRINGPRINT(s) s.psize(),s.rawBuf() +#endif /* SQUIDSTRINGPH */ + #define DEBUGSTRINGS 0 #if DEBUGSTRINGS @@ -86,6 +92,9 @@ String (String const &); ~String(); + typedef size_t size_type; //storage size intentionally unspecified + const static size_type npos = std::string::npos; + String &operator =(char const *); String &operator =(String const &); bool operator ==(String const &) const; @@ -95,10 +104,31 @@ * Retrieve a single character in the string. \param pos Position of character to retrieve. */ - _SQUID_INLINE_ char &operator [](unsigned int pos); + _SQUID_INLINE_ char operator [](unsigned int pos) const; + + _SQUID_INLINE_ size_type size() const; + /// variant of size() suited to be used for printf-alikes. + /// throws when size() > MAXINT + int psize() const; - _SQUID_INLINE_ int size() const; - _SQUID_INLINE_ char const * buf() const; + /** + * \retval true the String has some contents + */ + _SQUID_INLINE_ bool defined() const; + /** + * \retval true the String does not hold any contents + */ + _SQUID_INLINE_ bool undefined() const; + /** + * Returns a raw pointer to the underlying backing store. The caller has been + * verified not to make any assumptions about null-termination + */ + _SQUID_INLINE_ char const * rawBuf() const; + /** + * Returns a raw pointer to the underlying backing store. + * The caller requires it to be null-terminated. + */ + _SQUID_INLINE_ char const * termedBuf() const; void limitInit(const char *str, int len); // TODO: rename to assign() void clean(); void reset(char const *str); @@ -107,29 +137,28 @@ void append(char const); void append (String const &); void absorb(String &old); - _SQUID_INLINE_ const char * pos(char const *) const; - _SQUID_INLINE_ const char * pos(char const ch) const; - _SQUID_INLINE_ const char * rpos(char const ch) const; + const char * pos(char const *aString) const; + const char * pos(char const ch) const; + ///offset from string start of the first occurrence of ch + /// returns String::npos if ch is not found + size_type find(char const ch) const; + size_type find(char const *aString) const; + const char * rpos(char const ch) const; + size_type rfind(char const ch) const; _SQUID_INLINE_ int cmp (char const *) const; - _SQUID_INLINE_ int cmp (char const *, size_t count) const; + _SQUID_INLINE_ int cmp (char const *, size_type count) const; _SQUID_INLINE_ int cmp (String const &) const; _SQUID_INLINE_ int caseCmp (char const *) const; - _SQUID_INLINE_ int caseCmp (char const *, size_t count) const; + _SQUID_INLINE_ int caseCmp (char const *, size_type count) const; + _SQUID_INLINE_ int caseCmp (String const &) const; - /** \deprecated Use assignment to [] position instead. - * ie str[0] = 'h'; - */ - _SQUID_INLINE_ void set(char const *loc, char const ch); + String substr(size_type from, size_type to) const; /** \deprecated Use assignment to [] position instead. * ie str[newLength] = '\0'; */ - _SQUID_INLINE_ void cut(size_t newLength); + _SQUID_INLINE_ void cut(size_type newLength); - /** \deprecated Use assignment to [] position instead. - * ie str[newLength] = '\0'; - */ - _SQUID_INLINE_ void cutPointer(char const *loc); #if DEBUGSTRINGS @@ -141,15 +170,19 @@ private: void allocAndFill(const char *str, int len); - void allocBuffer(size_t sz); - void setBuffer(char *buf, size_t sz); + void allocBuffer(size_type sz); + void setBuffer(char *buf, size_type sz); /* never reference these directly! */ - unsigned short int size_; /* buffer size; 64K limit */ + size_type size_; /* buffer size; 64K limit */ - unsigned short int len_; /* current length */ + size_type len_; /* current length */ char *buf_; + + _SQUID_INLINE_ void set(char const *loc, char const ch); + _SQUID_INLINE_ void cutPointer(char const *loc); + }; _SQUID_INLINE_ std::ostream & operator<<(std::ostream& os, String const &aString); diff -u -r -N squid-3.1.0.5/src/stat.cc squid-3.1.0.6/src/stat.cc --- squid-3.1.0.5/src/stat.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/stat.cc 2009-03-03 12:06:34.000000000 +1300 @@ -430,8 +430,9 @@ { StoreEntry *sentry = (StoreEntry *)data; +// format: "%12s %15s %6s %12s\n","Alloc Size","Count","Delta","Alloc/sec" if (number > 0) - storeAppendPrintf(sentry, "%d\t %d\t %d\t %.1f\n", size, number, number - oldnum, xdiv((number - oldnum), xm_deltat)); + storeAppendPrintf(sentry, "%12d %15d %6d %.1f\n", size, number, number - oldnum, xdiv((number - oldnum), xm_deltat)); } #endif @@ -752,7 +753,7 @@ xm_deltat = current_dtime - xm_time; xm_time = current_dtime; storeAppendPrintf(sentry, "\nMemory allocation statistics\n"); - storeAppendPrintf(sentry, "Allocation Size\t Alloc Count\t Alloc Delta\t Allocs/sec \n"); + storeAppendPrintf(sentry, "%12s %15s %6s %12s\n","Alloc Size","Count","Delta","Alloc/sec"); malloc_statistics(info_get_mallstat, sentry); #endif } @@ -1653,8 +1654,8 @@ if (http->request->auth_user_request) p = http->request->auth_user_request->username(); - else if (http->request->extacl_user.buf() != NULL) { - p = http->request->extacl_user.buf(); + else if (http->request->extacl_user.defined()) { + p = http->request->extacl_user.termedBuf(); } if (!p && (conn != NULL && conn->rfc931[0])) diff -u -r -N squid-3.1.0.5/src/store.cc squid-3.1.0.6/src/store.cc --- squid-3.1.0.5/src/store.cc 2009-02-03 14:15:38.000000000 +1300 +++ squid-3.1.0.6/src/store.cc 2009-03-03 12:06:34.000000000 +1300 @@ -689,16 +689,16 @@ if (vary.size()) { /* Again, we own this structure layout */ - rep->header.putStr(HDR_VARY, vary.buf()); + rep->header.putStr(HDR_VARY, vary.termedBuf()); vary.clean(); } #if X_ACCELERATOR_VARY vary = mem_obj->getReply()->header.getList(HDR_X_ACCELERATOR_VARY); - if (vary.buf()) { + if (vary.defined()) { /* Again, we own this structure layout */ - rep->header.putStr(HDR_X_ACCELERATOR_VARY, vary.buf()); + rep->header.putStr(HDR_X_ACCELERATOR_VARY, vary.termedBuf()); vary.clean(); } @@ -851,25 +851,10 @@ void -#if STDC_HEADERS storeAppendPrintf(StoreEntry * e, const char *fmt,...) -#else -storeAppendPrintf(va_alist) -va_dcl -#endif { -#if STDC_HEADERS va_list args; va_start(args, fmt); -#else - - va_list args; - StoreEntry *e = NULL; - const char *fmt = NULL; - va_start(args); - e = va_arg(args, StoreEntry *); - fmt = va_arg(args, char *); -#endif storeAppendVPrintf(e, fmt, args); va_end(args); diff -u -r -N squid-3.1.0.5/src/Store.h squid-3.1.0.6/src/Store.h --- squid-3.1.0.5/src/Store.h 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/Store.h 2009-03-03 12:06:32.000000000 +1300 @@ -351,13 +351,8 @@ /// \ingroup StoreAPI SQUIDCEXTERN int expiresMoreThan(time_t, time_t); -#if STDC_HEADERS /// \ingroup StoreAPI SQUIDCEXTERN void storeAppendPrintf(StoreEntry *, const char *,...) PRINTF_FORMAT_ARG2; -#else -/// \ingroup StoreAPI -SQUIDCEXTERN void storeAppendPrintf(); -#endif /// \ingroup StoreAPI SQUIDCEXTERN void storeAppendVPrintf(StoreEntry *, const char *, va_list ap); diff -u -r -N squid-3.1.0.5/src/store_log.cc squid-3.1.0.6/src/store_log.cc --- squid-3.1.0.5/src/store_log.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/store_log.cc 2009-03-03 12:06:34.000000000 +1300 @@ -52,12 +52,17 @@ static Logfile *storelog = NULL; +static String str_unknown; + void storeLog(int tag, const StoreEntry * e) { MemObject *mem = e->mem_obj; HttpReply const *reply; + if (str_unknown.undefined()) + str_unknown="unknown"; //hack. Delay initialization as string doesn't support global variables.. + if (NULL == storelog) return; @@ -75,7 +80,10 @@ * Because if we print it before the swap file number, it'll break * the existing log format. */ - logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d %s %"PRId64"/%"PRId64" %s %s\n", + + String ctype=(reply->content_type.size() ? reply->content_type.termedBuf() : str_unknown); + + logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d " SQUIDSTRINGPH " %"PRId64"/%"PRId64" %s %s\n", (int) current_time.tv_sec, (int) current_time.tv_usec / 1000, storeLogTags[tag], @@ -86,7 +94,7 @@ (int) reply->date, (int) reply->last_modified, (int) reply->expires, - reply->content_type.size() ? reply->content_type.buf() : "unknown", + SQUIDSTRINGPRINT(ctype), reply->content_length, e->contentLen(), RequestMethodStr(mem->method), diff -u -r -N squid-3.1.0.5/src/String.cc squid-3.1.0.6/src/String.cc --- squid-3.1.0.5/src/String.cc 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/String.cc 2009-03-03 12:06:32.000000000 +1300 @@ -35,14 +35,23 @@ #include "squid.h" #include "Store.h" +#include "TextException.h" + +int +String::psize() const +{ + Must(size() < INT_MAX); + return size(); +} + // low-level buffer allocation, // does not free old buffer and does not adjust or look at len_ void -String::allocBuffer(size_t sz) +String::allocBuffer(String::size_type sz) { PROF_start(StringInitBuf); - assert (buf_ == NULL); + assert (undefined()); char *newBuffer = (char*)memAllocString(sz, &sz); setBuffer(newBuffer, sz); PROF_stop(StringInitBuf); @@ -51,9 +60,9 @@ // low-level buffer assignment // does not free old buffer and does not adjust or look at len_ void -String::setBuffer(char *aBuf, size_t aSize) +String::setBuffer(char *aBuf, String::size_type aSize) { - assert(!buf_); + assert(undefined()); assert(aSize < 65536); buf_ = aBuf; size_ = aSize; @@ -81,7 +90,7 @@ { clean(); // TODO: optimize to avoid cleaning the buffer we can use if (old.size() > 0) - allocAndFill(old.buf(), old.size()); + allocAndFill(old.rawBuf(), old.size()); return *this; } @@ -128,7 +137,7 @@ String::String (String const &old) : size_(0), len_(0), buf_(NULL) { if (old.size() > 0) - allocAndFill(old.buf(), old.size()); + allocAndFill(old.rawBuf(), old.size()); #if DEBUGSTRINGS StringRegistry::Instance().add(this); @@ -141,7 +150,7 @@ PROF_start(StringClean); assert(this); - if (buf()) + if (defined()) memFreeString(size_, buf_); len_ = 0; @@ -188,7 +197,7 @@ snew.allocBuffer(snew.len_ + 1); if (len_) - xmemcpy(snew.buf_, buf(), len_); + xmemcpy(snew.buf_, rawBuf(), len_); if (len) xmemcpy(snew.buf_ + len_, str, len); @@ -219,7 +228,7 @@ void String::append(String const &old) { - append (old.buf(), old.len_); + append (old.rawBuf(), old.len_); } void @@ -233,11 +242,24 @@ old.len_ = 0; } +String +String::substr(String::size_type from, String::size_type to) const +{ + Must(from >= 0 && from < size()); + Must(to > 0 && to <= size()); + Must(to > from); + + String rv; + rv.limitInit(rawBuf()+from,to-from); + return rv; +} + + #if DEBUGSTRINGS void String::stat(StoreEntry *entry) const { - storeAppendPrintf(entry, "%p : %d/%d \"%s\"\n",this,len_, size_, buf()); + storeAppendPrintf(entry, "%p : %d/%d \"%.*s\"\n",this,len_, size_, size(), rawBuf()); } StringRegistry & @@ -279,7 +301,7 @@ StringRegistry StringRegistry::Instance_; -extern size_t memStringCount(); +extern String::size_type memStringCount(); void StringRegistry::Stat(StoreEntry *entry) @@ -412,6 +434,62 @@ return p ? p : "(NULL)"; } +const char * +String::pos(char const *aString) const +{ + if (undefined()) + return NULL; + return strstr(termedBuf(), aString); +} + +const char * +String::pos(char const ch) const +{ + if (undefined()) + return NULL; + return strchr(termedBuf(), ch); +} + +const char * +String::rpos(char const ch) const +{ + if (undefined()) + return NULL; + return strrchr(termedBuf(), (ch)); +} + +String::size_type +String::find(char const ch) const +{ + const char *c; + c=pos(ch); + if (c==NULL) + return npos; + return c-rawBuf(); +} + +String::size_type +String::find(char const *aString) const +{ + const char *c; + c=pos(aString); + if (c==NULL) + return npos; + return c-rawBuf(); +} + +String::size_type +String::rfind(char const ch) const +{ + const char *c; + c=rpos(ch); + if (c==NULL) + return npos; + return c-rawBuf(); +} + + + #ifndef _USE_INLINE_ #include "String.cci" #endif diff -u -r -N squid-3.1.0.5/src/String.cci squid-3.1.0.6/src/String.cci --- squid-3.1.0.5/src/String.cci 2009-02-03 14:15:37.000000000 +1300 +++ squid-3.1.0.6/src/String.cci 2009-03-03 12:06:32.000000000 +1300 @@ -35,6 +35,15 @@ #include "assert.h" #include +#ifdef HAVE_STDINT_H +#include //for INT_MAX +#else /* HAVE_STDINT_H */ +#ifndef INT_MAX +#define INT_MAX 1<<31 //hack but a safe bet +#endif /* INT_MAX */ +#endif /* HAVE_STDINT_H */ + + String::String() : size_(0), len_(0), buf_ (NULL) { #if DEBUGSTRINGS @@ -42,44 +51,43 @@ #endif } -int +String::size_type String::size() const { return len_; } -char const * -String::buf() const +bool String::defined() const { - return buf_; + return buf_!=NULL; } -char& -String::operator [](unsigned int pos) +bool String::undefined() const { - assert(pos < size_); - - return buf_[pos]; + return buf_==NULL; } -const char * -String::pos(char const *aString) const +char const * +String::rawBuf() const { - return strstr(buf(), aString); + return buf_; } -const char * -String::pos(char const ch) const +char const * +String::termedBuf() const { - return strchr(buf(), ch); + return buf_; } -const char * -String::rpos(char const ch) const +char +String::operator [](unsigned int pos) const { - return strrchr(buf(), (ch)); + assert(pos < size_); + + return buf_[pos]; } + int String::cmp (char const *aString) const { @@ -94,11 +102,11 @@ if (aString == NULL || aString[0] == '\0') return 1; - return strcmp(buf(), aString); + return strcmp(termedBuf(), aString); } int -String::cmp (char const *aString, size_t count) const +String::cmp (char const *aString, String::size_type count) const { /* always the same at length 0 */ @@ -114,7 +122,7 @@ if (aString == NULL || aString[0] == '\0') return 1; - return strncmp(buf(), aString, count); + return strncmp(termedBuf(), aString, count); } int @@ -131,21 +139,28 @@ if (aString.size() == 0) return 1; - return strcmp(buf(), aString.buf()); + return strcmp(termedBuf(), aString.termedBuf()); } int String::caseCmp(char const *aString) const { - return strcasecmp(buf(), aString); + return strcasecmp(termedBuf(), aString); } int -String::caseCmp(char const *aString, size_t count) const +String::caseCmp(char const *aString, String::size_type count) const { - return strncasecmp(buf(), aString, count); + return strncasecmp(termedBuf(), aString, count); } +int +String::caseCmp(const String &str) const +{ + return caseCmp(str.rawBuf(),str.size()); +} + + void String::set(char const *loc, char const ch) { @@ -155,7 +170,7 @@ } void -String::cut(size_t newLength) +String::cut(String::size_type newLength) { if (newLength < 0 || newLength > len_) return; @@ -179,6 +194,6 @@ std::ostream & operator<<(std::ostream& os, String const &aString) { - os << aString.buf(); + os.write(aString.rawBuf(),aString.size()); return os; } diff -u -r -N squid-3.1.0.5/src/structs.h squid-3.1.0.6/src/structs.h --- squid-3.1.0.5/src/structs.h 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/structs.h 2009-03-03 12:06:34.000000000 +1300 @@ -462,8 +462,9 @@ acl_access *snmp; #endif - +#if HTTP_VIOLATIONS acl_access *brokenPosts; +#endif #if USE_IDENT acl_access *identLookup; diff -u -r -N squid-3.1.0.5/src/tests/stub_store.cc squid-3.1.0.6/src/tests/stub_store.cc --- squid-3.1.0.5/src/tests/stub_store.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tests/stub_store.cc 2009-03-03 12:06:34.000000000 +1300 @@ -38,18 +38,13 @@ StorePointer Store::CurrentRoot = NULL; extern "C" void -#if STDC_HEADERS - storeAppendPrintf(StoreEntry * e, const char *fmt,...) -#else - storeAppendPrintf(va_alist) - va_dcl -#endif +storeAppendPrintf(StoreEntry * e, const char *fmt,...) { fatal("Not implemented"); } extern "C" void - storeAppendVPrintf(StoreEntry * e, const char *fmt, va_list vargs) +storeAppendVPrintf(StoreEntry * e, const char *fmt, va_list vargs) { fatal("Not implemented"); } diff -u -r -N squid-3.1.0.5/src/tests/testEvent.cc squid-3.1.0.6/src/tests/testEvent.cc --- squid-3.1.0.5/src/tests/testEvent.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tests/testEvent.cc 2009-03-03 12:06:34.000000000 +1300 @@ -97,20 +97,20 @@ /* loop over the strings, showing exactly where they differ (if at all) */ printf("Actual Text:\n"); /* TODO: these should really be just [] lookups, but String doesn't have those here yet. */ - for ( int i = 0; i < anEntry->_appended_text.size(); i++) { - CPPUNIT_ASSERT( expect.buf()[i] ); - CPPUNIT_ASSERT( anEntry->_appended_text.buf()[i] ); + for ( unsigned int i = 0; i < anEntry->_appended_text.size(); i++) { + CPPUNIT_ASSERT( expect[i] ); + CPPUNIT_ASSERT( anEntry->_appended_text[i] ); /* slight hack to make special chars visible */ - switch (anEntry->_appended_text.buf()[i]) { + switch (anEntry->_appended_text[i]) { case '\t': printf("\\t"); break; default: - printf("%c", anEntry->_appended_text.buf()[i] ); + printf("%c", anEntry->_appended_text[i] ); } /* make this an int comparison, so that we can see the ASCII code at failure */ - CPPUNIT_ASSERT_EQUAL( (int)expect.buf()[i], (int)anEntry->_appended_text.buf()[i] ); + CPPUNIT_ASSERT_EQUAL( (int)(expect[i]), (int)anEntry->_appended_text[i] ); } printf("\n"); CPPUNIT_ASSERT_EQUAL( expect, anEntry->_appended_text); diff -u -r -N squid-3.1.0.5/src/tests/testStoreController.cc squid-3.1.0.6/src/tests/testStoreController.cc --- squid-3.1.0.5/src/tests/testStoreController.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tests/testStoreController.cc 2009-03-03 12:06:34.000000000 +1300 @@ -111,7 +111,7 @@ EBIT_CLR(e->flags, KEY_PRIVATE); e->ping_status = PING_NONE; EBIT_CLR(e->flags, ENTRY_VALIDATED); - e->hashInsert((const cache_key *)name.buf()); /* do it after we clear KEY_PRIVATE */ + e->hashInsert((const cache_key *)name.termedBuf()); /* do it after we clear KEY_PRIVATE */ return e; } diff -u -r -N squid-3.1.0.5/src/tests/testStoreHashIndex.cc squid-3.1.0.6/src/tests/testStoreHashIndex.cc --- squid-3.1.0.5/src/tests/testStoreHashIndex.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tests/testStoreHashIndex.cc 2009-03-03 12:06:34.000000000 +1300 @@ -92,7 +92,7 @@ EBIT_CLR(e->flags, KEY_PRIVATE); e->ping_status = PING_NONE; EBIT_CLR(e->flags, ENTRY_VALIDATED); - e->hashInsert((const cache_key *)name.buf()); /* do it after we clear KEY_PRIVATE */ + e->hashInsert((const cache_key *)name.termedBuf()); /* do it after we clear KEY_PRIVATE */ return e; } diff -u -r -N squid-3.1.0.5/src/tests/testString.cc squid-3.1.0.6/src/tests/testString.cc --- squid-3.1.0.5/src/tests/testString.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tests/testString.cc 2009-03-03 12:06:34.000000000 +1300 @@ -59,3 +59,11 @@ CPPUNIT_ASSERT(right.cmp("foo") < 0); CPPUNIT_ASSERT(right.cmp("foo", 1) < 0); } + +void testString::testSubstr() +{ + String s("0123456789"); + String check=s.substr(3,5); + String ref("34"); + CPPUNIT_ASSERT(check == ref); +} diff -u -r -N squid-3.1.0.5/src/tests/testString.h squid-3.1.0.6/src/tests/testString.h --- squid-3.1.0.5/src/tests/testString.h 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tests/testString.h 2009-03-03 12:06:34.000000000 +1300 @@ -14,6 +14,8 @@ CPPUNIT_TEST( testCmpDefault ); CPPUNIT_TEST( testCmpEmptyString ); CPPUNIT_TEST( testCmpNotEmptyDefault ); + CPPUNIT_TEST( testSubstr ); + CPPUNIT_TEST_SUITE_END(); public: @@ -23,6 +25,7 @@ void testCmpDefault(); void testCmpEmptyString(); void testCmpNotEmptyDefault(); + void testSubstr(); }; #endif diff -u -r -N squid-3.1.0.5/src/tools.cc squid-3.1.0.6/src/tools.cc --- squid-3.1.0.5/src/tools.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tools.cc 2009-03-03 12:06:34.000000000 +1300 @@ -493,22 +493,11 @@ } /* printf-style interface for fatal */ -#if STDC_HEADERS void fatalf(const char *fmt,...) { va_list args; va_start(args, fmt); -#else -void -fatalf(va_alist) -va_dcl { - va_list args; - const char *fmt = NULL; - va_start(args); - fmt = va_arg(args, char *); -#endif - fatalvf(fmt, args); va_end(args); } diff -u -r -N squid-3.1.0.5/src/tunnel.cc squid-3.1.0.6/src/tunnel.cc --- squid-3.1.0.5/src/tunnel.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/tunnel.cc 2009-03-03 12:06:34.000000000 +1300 @@ -263,8 +263,8 @@ if (xerrno == COMM_ERR_CLOSING) return; - debugs(50, debugLevelForError(xerrno), "tunnelReadServer: FD " << fd() << - ": read failure: " << xstrerror()); + debugs(50, debugLevelForError(xerrno), "TunnelStateData::Connection::error: FD " << fd() << + ": read/write failure: " << xstrerror()); if (!ignoreErrno(xerrno)) comm_close(fd()); @@ -613,9 +613,10 @@ * be allowed. yuck, I know. */ - if (!request->client_addr.IsNoAddr()) { + if (!request->client_addr.IsNoAddr() && Config.accessList.miss) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) + * default is to allow. */ ACLChecklist ch; ch.src_addr = request->client_addr; diff -u -r -N squid-3.1.0.5/src/url.cc squid-3.1.0.6/src/url.cc --- squid-3.1.0.5/src/url.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/url.cc 2009-03-03 12:06:34.000000000 +1300 @@ -439,7 +439,8 @@ return request->canonical; if (request->protocol == PROTO_URN) { - snprintf(urlbuf, MAX_URL, "urn:%s", request->urlpath.buf()); + snprintf(urlbuf, MAX_URL, "urn:" SQUIDSTRINGPH, + SQUIDSTRINGPRINT(request->urlpath)); } else { /// \todo AYJ: this could use "if..else and method == METHOD_CONNECT" easier. switch (request->method.id()) { @@ -454,13 +455,13 @@ if (request->port != urlDefaultPort(request->protocol)) snprintf(portbuf, 32, ":%d", request->port); - snprintf(urlbuf, MAX_URL, "%s://%s%s%s%s%s", + snprintf(urlbuf, MAX_URL, "%s://%s%s%s%s" SQUIDSTRINGPH, ProtocolStr[request->protocol], request->login, *request->login ? "@" : null_string, request->GetHost(), portbuf, - request->urlpath.buf()); + SQUIDSTRINGPRINT(request->urlpath)); break; } @@ -482,7 +483,8 @@ char *t; if (request->protocol == PROTO_URN) { - snprintf(buf, MAX_URL, "urn:%s", request->urlpath.buf()); + snprintf(buf, MAX_URL, "urn:" SQUIDSTRINGPH, + SQUIDSTRINGPRINT(request->urlpath)); } else { /// \todo AYJ: this could use "if..else and method == METHOD_CONNECT" easier. switch (request->method.id()) { @@ -510,12 +512,12 @@ strcat(loginbuf, "@"); } - snprintf(buf, MAX_URL, "%s://%s%s%s%s", + snprintf(buf, MAX_URL, "%s://%s%s%s" SQUIDSTRINGPH, ProtocolStr[request->protocol], loginbuf, request->GetHost(), portbuf, - request->urlpath.buf()); + SQUIDSTRINGPRINT(request->urlpath)); /* * strip arguments AFTER a question-mark */ @@ -584,7 +586,8 @@ char *urlbuf = (char *)xmalloc(MAX_URL * sizeof(char)); if (req->protocol == PROTO_URN) { - snprintf(urlbuf, MAX_URL, "urn:%s", req->urlpath.buf()); + snprintf(urlbuf, MAX_URL, "urn:" SQUIDSTRINGPH, + SQUIDSTRINGPRINT(req->urlpath)); return (urlbuf); } @@ -610,7 +613,7 @@ if (relUrl[0] == '/') { strncpy(&urlbuf[urllen], relUrl, MAX_URL - urllen - 1); } else { - const char *path = req->urlpath.buf(); + const char *path = req->urlpath.termedBuf(); const char *last_slash = strrchr(path, '/'); if (last_slash == NULL) { diff -u -r -N squid-3.1.0.5/src/urn.cc squid-3.1.0.6/src/urn.cc --- squid-3.1.0.5/src/urn.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/urn.cc 2009-03-03 12:06:34.000000000 +1300 @@ -57,7 +57,7 @@ char *getHost (String &urlpath); void setUriResFromRequest(HttpRequest *); bool RequestNeedsMenu(HttpRequest *r); - void updateRequestURL(HttpRequest *r, char const *newPath); + void updateRequestURL(HttpRequest *r, char const *newPath, const size_t newPath_len); void createUriResRequest (String &uri); virtual ~UrnState(); @@ -167,32 +167,31 @@ UrnState::getHost (String &urlpath) { char * result; - char const *t; + size_t p; - /* FIXME: this appears to be parsing the URL. *very* badly. */ - /* FIXME: a proper encapsulated URI/URL type needs to clear this up. */ - - if ((t = urlpath.pos(':')) != NULL) { - urlpath.set(t, '\0'); - result = xstrdup(urlpath.buf()); - urlpath.set(t, ':'); + /** FIXME: this appears to be parsing the URL. *very* badly. */ + /* a proper encapsulated URI/URL type needs to clear this up. */ + if ((p=urlpath.find(':')) != String::npos) { + result=xstrndup(urlpath.rawBuf(),p-1); } else { - result = xstrdup(urlpath.buf()); + result = xstrndup(urlpath.rawBuf(),urlpath.size()); } - return result; } bool UrnState::RequestNeedsMenu(HttpRequest *r) { - return strncasecmp(r->urlpath.buf(), "menu.", 5) == 0; + if (r->urlpath.size() < 5) + return false; + //now we're sure it's long enough + return strncasecmp(r->urlpath.rawBuf(), "menu.", 5) == 0; } void -UrnState::updateRequestURL(HttpRequest *r, char const *newPath) +UrnState::updateRequestURL(HttpRequest *r, char const *newPath, const size_t newPath_len) { - char *new_path = xstrdup (newPath); + char *new_path = xstrndup (newPath, newPath_len); r->urlpath = new_path; xfree(new_path); } @@ -202,7 +201,8 @@ { LOCAL_ARRAY(char, local_urlres, 4096); char *host = getHost (uri); - snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:%s", host, uri.buf()); + snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:" SQUIDSTRINGPH, + host, SQUIDSTRINGPRINT(uri)); safe_free (host); safe_free (urlres); urlres = xstrdup (local_urlres); @@ -213,7 +213,7 @@ UrnState::setUriResFromRequest(HttpRequest *r) { if (RequestNeedsMenu(r)) { - updateRequestURL(r, r->urlpath.buf() + 5); + updateRequestURL(r, r->urlpath.rawBuf() + 5, r->urlpath.size() - 5 ); flags.force_menu = 1; } diff -u -r -N squid-3.1.0.5/src/whois.cc squid-3.1.0.6/src/whois.cc --- squid-3.1.0.5/src/whois.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/src/whois.cc 2009-03-03 12:06:35.000000000 +1300 @@ -98,7 +98,8 @@ buf = (char *)xmalloc(l); - snprintf(buf, l, "%s\r\n", p->request->urlpath.buf() + 1); + String str_print=p->request->urlpath.substr(1,p->request->urlpath.size()); + snprintf(buf, l, SQUIDSTRINGPH"\r\n", SQUIDSTRINGPRINT(str_print)); comm_write(fd, buf, strlen(buf), whoisWriteComplete, p, NULL); comm_read(fd, p->buf, BUFSIZ, whoisReadReply, p); diff -u -r -N squid-3.1.0.5/test-suite/test_tools.cc squid-3.1.0.6/test-suite/test_tools.cc --- squid-3.1.0.5/test-suite/test_tools.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/test-suite/test_tools.cc 2009-03-03 12:06:35.000000000 +1300 @@ -31,40 +31,17 @@ _db_print_stderr(const char *format, va_list args); void -#if STDC_HEADERS _db_print(const char *format,...) { -#else -_db_print(va_alist) -va_dcl { - const char *format = NULL; -#endif - LOCAL_ARRAY(char, f, BUFSIZ); va_list args1; -#if STDC_HEADERS - va_list args2; va_list args3; -#else -#define args2 args1 -#define args3 args1 -#endif - -#if STDC_HEADERS va_start(args1, format); - va_start(args2, format); - va_start(args3, format); -#else - - format = va_arg(args1, const char *); - -#endif - snprintf(f, BUFSIZ, "%s| %s", "stub time", //debugLogTime(squid_curtime), format); @@ -72,14 +49,8 @@ _db_print_stderr(f, args2); va_end(args1); - -#if STDC_HEADERS - va_end(args2); - va_end(args3); - -#endif } static void @@ -114,21 +85,10 @@ } /* printf-style interface for fatal */ -#if STDC_HEADERS void fatalf(const char *fmt,...) { va_list args; va_start(args, fmt); -#else -void -fatalf(va_alist) -va_dcl { - va_list args; - const char *fmt = NULL; - va_start(args); - fmt = va_arg(args, char *); -#endif - fatalvf(fmt, args); va_end(args); } diff -u -r -N squid-3.1.0.5/tools/Makefile.am squid-3.1.0.6/tools/Makefile.am --- squid-3.1.0.5/tools/Makefile.am 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/tools/Makefile.am 2009-03-03 12:06:35.000000000 +1300 @@ -53,12 +53,8 @@ fi uninstall-local: - -# Don't automatically uninstall config files -# @if test -f $(DESTDIR)$(DEFAULT_CONFIG_FILE) ; then \ -# echo "rm -f $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -# $(RM) -f $(DESTDIR)$(DEFAULT_CONFIG_FILE); \ -# fi + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_CACHEMGR_CONFIG) + $(RM) -f $(DESTDIR)$(DEFAULT_CACHEMGR_CONFIG).default DISTCLEANFILES = diff -u -r -N squid-3.1.0.5/tools/Makefile.in squid-3.1.0.6/tools/Makefile.in --- squid-3.1.0.5/tools/Makefile.in 2009-02-03 14:16:03.000000000 +1300 +++ squid-3.1.0.6/tools/Makefile.in 2009-03-03 12:07:00.000000000 +1300 @@ -344,12 +344,6 @@ EXTRA_DIST = \ cachemgr.conf - -# Don't automatically uninstall config files -# @if test -f $(DESTDIR)$(DEFAULT_CONFIG_FILE) ; then \ -# echo "rm -f $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -# $(RM) -f $(DESTDIR)$(DEFAULT_CONFIG_FILE); \ -# fi DISTCLEANFILES = all: all-recursive @@ -869,6 +863,8 @@ fi uninstall-local: + @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh $(RM) $(DESTDIR)$(DEFAULT_CACHEMGR_CONFIG) + $(RM) -f $(DESTDIR)$(DEFAULT_CACHEMGR_CONFIG).default # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -u -r -N squid-3.1.0.5/tools/squidclient.cc squid-3.1.0.6/tools/squidclient.cc --- squid-3.1.0.5/tools/squidclient.cc 2009-02-03 14:15:39.000000000 +1300 +++ squid-3.1.0.6/tools/squidclient.cc 2009-03-03 12:06:35.000000000 +1300 @@ -368,95 +368,88 @@ } } - if(version[0] == '-') { + if(version[0] == '-' || !version[0] || version[0] == '0') { + /* HTTP/0.9, no headers, no version */ snprintf(msg, BUFSIZ, "%s %s\r\n", method, url); } else { snprintf(msg, BUFSIZ, "%s %s HTTP/%s\r\n", method, url, version); - } - - if (host) { - snprintf(buf, BUFSIZ, "Host: %s\r\n", method, url, version, host); - strcat(msg,buf); - } - if (reload) { - snprintf(buf, BUFSIZ, "Pragma: no-cache\r\n"); - strcat(msg, buf); - } - if (put_fd > 0) { - snprintf(buf, BUFSIZ, "Content-length: %d\r\n", (int) sb.st_size); - strcat(msg, buf); - } - if (opt_noaccept == 0) { - snprintf(buf, BUFSIZ, "Accept: */*\r\n"); - strcat(msg, buf); - } - if (ims) { - snprintf(buf, BUFSIZ, "If-Modified-Since: %s\r\n", mkrfc1123(ims)); - strcat(msg, buf); - } - if (max_forwards > -1) { - snprintf(buf, BUFSIZ, "Max-Forwards: %d\r\n", max_forwards); - strcat(msg, buf); - } - if (proxy_user) { - const char *user = proxy_user; - const char *password = proxy_password; + if (host) { + snprintf(buf, BUFSIZ, "Host: %s\r\n", host); + strcat(msg,buf); + } + + if (reload) { + snprintf(buf, BUFSIZ, "Pragma: no-cache\r\n"); + strcat(msg, buf); + } + if (put_fd > 0) { + snprintf(buf, BUFSIZ, "Content-length: %d\r\n", (int) sb.st_size); + strcat(msg, buf); + } + if (opt_noaccept == 0) { + snprintf(buf, BUFSIZ, "Accept: */*\r\n"); + strcat(msg, buf); + } + if (ims) { + snprintf(buf, BUFSIZ, "If-Modified-Since: %s\r\n", mkrfc1123(ims)); + strcat(msg, buf); + } + if (max_forwards > -1) { + snprintf(buf, BUFSIZ, "Max-Forwards: %d\r\n", max_forwards); + strcat(msg, buf); + } + if (proxy_user) { + const char *user = proxy_user; + const char *password = proxy_password; #if HAVE_GETPASS - - if (!password) - password = getpass("Proxy password: "); - + if (!password) + password = getpass("Proxy password: "); #endif - - if (!password) { - fprintf(stderr, "ERROR: Proxy password missing\n"); - exit(1); - } - snprintf(buf, BUFSIZ, "%s:%s", user, password); - snprintf(buf, BUFSIZ, "Proxy-Authorization: Basic %s\r\n", base64_encode(buf)); - strcat(msg, buf); - } - if (www_user) { - const char *user = www_user; - const char *password = www_password; + if (!password) { + fprintf(stderr, "ERROR: Proxy password missing\n"); + exit(1); + } + snprintf(buf, BUFSIZ, "%s:%s", user, password); + snprintf(buf, BUFSIZ, "Proxy-Authorization: Basic %s\r\n", base64_encode(buf)); + strcat(msg, buf); + } + if (www_user) { + const char *user = www_user; + const char *password = www_password; #if HAVE_GETPASS - - if (!password) - password = getpass("WWW password: "); - + if (!password) + password = getpass("WWW password: "); #endif + if (!password) { + fprintf(stderr, "ERROR: WWW password missing\n"); + exit(1); + } + snprintf(buf, BUFSIZ, "%s:%s", user, password); + snprintf(buf, BUFSIZ, "Authorization: Basic %s\r\n", base64_encode(buf)); + strcat(msg, buf); + } + + /* HTTP/1.0 may need keep-alive */ + if (strcmp(version, "1.0") == 0) { + if (keep_alive) { + if (strchr(url, ':')) + snprintf(buf, BUFSIZ, "Proxy-Connection: keep-alive\r\n"); + else + strcat(msg, "Connection: keep-alive\r\n"); + } + } else { + if (!keep_alive) + strcat(msg, "Connection: close\r\n"); + } + strcat(msg, buf); - if (!password) { - fprintf(stderr, "ERROR: WWW password missing\n"); - exit(1); - } - snprintf(buf, BUFSIZ, "%s:%s", user, password); - snprintf(buf, BUFSIZ, "Authorization: Basic %s\r\n", base64_encode(buf)); - strcat(msg, buf); + strcat(msg, extra_hdrs); + strcat(msg, "\r\n"); } - /* 1.0 & 1.1 might need Proxy-Connection: header */ - if (version[0] == '1' && version[1] == '.' && version[2] >= '0' && version[2] <= '1') { - if (keep_alive) { - if (port != 80) - snprintf(buf, BUFSIZ, "Proxy-Connection: keep-alive\r\n"); - else - strcat(msg, "Connection: keep-alive\r\n"); - } - } else { - if (!keep_alive) - strcat(msg, "Connection: close\r\n"); - else - snprintf(buf, BUFSIZ, "Connection: keep-alive\r\n"); - } - strcat(msg, buf); - - strcat(msg, extra_hdrs); - strcat(msg, "\r\n"); - if (opt_verbose) - fprintf(stderr, "headers: '%s'\n", msg); + fprintf(stderr, "Request: '%s'\n", msg); if (ping) { #if HAVE_SIGACTION