diff -u -r -N squid-3.2.0.18/acinclude/os-deps.m4 squid-3.2.0.19/acinclude/os-deps.m4 --- squid-3.2.0.18/acinclude/os-deps.m4 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/acinclude/os-deps.m4 2012-08-03 00:14:34.000000000 +1200 @@ -829,14 +829,21 @@ SQUID_STATE_ROLLBACK(winsock) ]) - dnl check that setresuid is properly implemented. dnl sets squid_cv_resuid_works to "yes" or "no" AC_DEFUN([SQUID_CHECK_SETRESUID_WORKS],[ AC_CACHE_CHECK(if setresuid is actually implemented, squid_cv_resuid_works, AC_RUN_IFELSE([ AC_LANG_SOURCE([[ +#if HAVE_STDLIB_H #include +#endif +#if HAVE_STDIO_H +#include +#endif +#if HAVE_UNISTD_H +#include +#endif int main(int argc, char **argv) { if(setresuid(-1,-1,-1)) { perror("setresuid:"); diff -u -r -N squid-3.2.0.18/bootstrap.sh squid-3.2.0.19/bootstrap.sh --- squid-3.2.0.18/bootstrap.sh 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/bootstrap.sh 2012-08-03 00:14:34.000000000 +1200 @@ -148,6 +148,9 @@ fi done +# Make a copy of SPONSORS we can package +sed -e 's/@Squid-[0-9\.]*://' SPONSORS.txt || (rm -f SPONSORS.txt && exit 1) + # Fixup autoconf recursion using --silent/--quiet option # autoconf should inherit this option whe recursing into subdirectories # but it currently doesn't for some reason. diff -u -r -N squid-3.2.0.18/ChangeLog squid-3.2.0.19/ChangeLog --- squid-3.2.0.18/ChangeLog 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/ChangeLog 2012-08-03 00:14:34.000000000 +1200 @@ -1,3 +1,16 @@ +Changes to squid-3.2.0.19 (02 Aug 2012): + + - Regression Bug 3580: IDENT request makes squid crash + - Regression Bug 3577: File Descriptors not properly closed + - Regression Bug 3478: Allow peer selection and connection auth on intercepted traffic + - Regression Fix: Restore memory caching ability + - Bug 3556 Workaround: epoll assertion failed: comm.cc:1093: isOpen(fd) + - Bug 3551: store_rebuild.cc:116: "store_errors == 0" assertion + - Bug 3525: Do not resend nibbled PUTs and avoid "mustAutoConsume" assertion. + - Avoid bogus "Disk space over limit" warnings when rebuidling dirty ufs index + - Support custom headers in [request|reply]_header_* manglers + - ... and much code polishing + Changes to squid-3.2.0.18 (29 Jun 2012): - Bug 3576: ICY streams being Transfer-Encoding:chunked diff -u -r -N squid-3.2.0.18/compat/xstring.cc squid-3.2.0.19/compat/xstring.cc --- squid-3.2.0.18/compat/xstring.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/compat/xstring.cc 2012-08-03 00:14:34.000000000 +1200 @@ -39,8 +39,11 @@ return dst; if (src) - while (--n != 0 && *src != '\0') - *dst++ = *src++; + while (--n != 0 && *src != '\0') { + *dst = *src; + ++dst; + ++src; + } *dst = '\0'; return r; diff -u -r -N squid-3.2.0.18/configure squid-3.2.0.19/configure --- squid-3.2.0.18/configure 2012-06-29 13:39:35.000000000 +1200 +++ squid-3.2.0.19/configure 2012-08-03 00:16:03.000000000 +1200 @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for Squid Web Proxy 3.2.0.18. +# Generated by GNU Autoconf 2.68 for Squid Web Proxy 3.2.0.19. # # Report bugs to . # @@ -575,8 +575,8 @@ # Identity of this package. PACKAGE_NAME='Squid Web Proxy' PACKAGE_TARNAME='squid' -PACKAGE_VERSION='3.2.0.18' -PACKAGE_STRING='Squid Web Proxy 3.2.0.18' +PACKAGE_VERSION='3.2.0.19' +PACKAGE_STRING='Squid Web Proxy 3.2.0.19' PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/' PACKAGE_URL='' @@ -1571,7 +1571,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.2.0.18 to adapt to many kinds of systems. +\`configure' configures Squid Web Proxy 3.2.0.19 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1641,7 +1641,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Squid Web Proxy 3.2.0.18:";; + short | recursive ) echo "Configuration of Squid Web Proxy 3.2.0.19:";; esac cat <<\_ACEOF @@ -2019,7 +2019,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Squid Web Proxy configure 3.2.0.18 +Squid Web Proxy configure 3.2.0.19 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -3115,7 +3115,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.2.0.18, which was +It was created by Squid Web Proxy $as_me 3.2.0.19, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3934,7 +3934,7 @@ # Define the identity of the package. PACKAGE='squid' - VERSION='3.2.0.18' + VERSION='3.2.0.19' cat >>confdefs.h <<_ACEOF @@ -4264,7 +4264,6 @@ - # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # @@ -28693,7 +28692,15 @@ /* end confdefs.h. */ +#if HAVE_STDLIB_H #include +#endif +#if HAVE_STDIO_H +#include +#endif +#if HAVE_UNISTD_H +#include +#endif int main(int argc, char **argv) { if(setresuid(-1,-1,-1)) { perror("setresuid:"); @@ -30874,7 +30881,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.2.0.18, which was +This file was extended by Squid Web Proxy $as_me 3.2.0.19, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -30940,7 +30947,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Squid Web Proxy config.status 3.2.0.18 +Squid Web Proxy config.status 3.2.0.19 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -u -r -N squid-3.2.0.18/configure.ac squid-3.2.0.19/configure.ac --- squid-3.2.0.18/configure.ac 2012-06-29 13:39:35.000000000 +1200 +++ squid-3.2.0.19/configure.ac 2012-08-03 00:16:03.000000000 +1200 @@ -3,7 +3,7 @@ dnl dnl dnl -AC_INIT([Squid Web Proxy],[3.2.0.18],[http://www.squid-cache.org/bugs/],[squid]) +AC_INIT([Squid Web Proxy],[3.2.0.19],[http://www.squid-cache.org/bugs/],[squid]) AC_PREREQ(2.61) AC_CONFIG_HEADERS([include/autoconf.h]) AC_CONFIG_AUX_DIR(cfgaux) diff -u -r -N squid-3.2.0.18/CONTRIBUTORS squid-3.2.0.19/CONTRIBUTORS --- squid-3.2.0.18/CONTRIBUTORS 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/CONTRIBUTORS 2012-08-03 00:14:34.000000000 +1200 @@ -1,6 +1,6 @@ Special thanks go to people who have volunteered their time, effort, and ideas to make this software available. - + Adam Ciarcinski Adrian Chadd Alex Rousskov @@ -20,7 +20,6 @@ Arkin Arthur Tumanyan Assar Westerlund - Automatic source maintenance Axel Westerhold Benno Rice Bertrand Jacquin @@ -149,7 +148,7 @@ Philip Allison Philippe Lantin Pierangelo Masarati - Pierre-Louis BRENAC + Pierre-Louis Brenac Przemek Czerkas Rafael Martinez Torres Rafal Ramocki @@ -162,7 +161,7 @@ Richard Huveneers Robert Collins Robert Forster - Rodrigo Campos (rodrigo@geekbunker.org) + Rodrigo Campos Ron Gomes Russell Street Russell Vincent @@ -184,9 +183,10 @@ Tony Lorimer Unknown - NetBSD Project Vincent Regnard - Vitaliy Matytsyn (main) + Vitaliy Matytsyn Wesha Wojtek Sylwestrzak Wolfgang Nothdurft + benno@jeamland.net fancyrabbit vollkommen diff -u -r -N squid-3.2.0.18/CREDITS squid-3.2.0.19/CREDITS --- squid-3.2.0.18/CREDITS 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/CREDITS 2012-08-03 00:14:34.000000000 +1200 @@ -453,7 +453,7 @@ ============================================================================== -helprs/negotiate_auth/kerberos/ * +helpers/negotiate_auth/kerberos/ * /* * ----------------------------------------------------------------------------- @@ -526,6 +526,17 @@ ============================================================================== +icons/SN.png: + + Squid NOW icon - copyright Squid Project + + This work is licensed under the + Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Liscence + (CC BY-NC-SA 3.0) + [ http://creativecommons.org/licenses/by-nc-sa/3.0/ ] + +============================================================================== + icons/silk/: Silk icon set 1.3 @@ -592,3 +603,14 @@ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +============================================================================== + +errors/errorpage.css: + + Stylesheet for Squid Error pages + Adapted from design by Free CSS Templates + http://www.freecsstemplates.org + Released for free under a Creative Commons Attribution 2.5 License + +============================================================================== diff -u -r -N squid-3.2.0.18/helpers/basic_auth/DB/basic_db_auth.8 squid-3.2.0.19/helpers/basic_auth/DB/basic_db_auth.8 --- squid-3.2.0.18/helpers/basic_auth/DB/basic_db_auth.8 2012-06-29 13:57:13.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/DB/basic_db_auth.8 2012-08-03 00:34:58.000000000 +1200 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "BASIC_DB_AUTH 1" -.TH BASIC_DB_AUTH 1 "2012-06-28" "perl v5.10.1" "User Contributed Perl Documentation" +.TH BASIC_DB_AUTH 1 "2012-08-02" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-3.2.0.18/helpers/basic_auth/LDAP/basic_ldap_auth.cc squid-3.2.0.19/helpers/basic_auth/LDAP/basic_ldap_auth.cc --- squid-3.2.0.18/helpers/basic_auth/LDAP/basic_ldap_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/LDAP/basic_ldap_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -623,15 +623,19 @@ n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; - snprintf(escaped, 3, "%02x", (unsigned char) *src++); + *escaped = '\\'; + ++escaped; + snprintf(escaped, 3, "%02x", (unsigned char) *src); + ++src; escaped += 2; } break; default: - *escaped++ = *src++; - n++; - size--; + *escaped = *src; + ++escaped; + ++src; + ++n; + --size; } } *escaped = '\0'; diff -u -r -N squid-3.2.0.18/helpers/basic_auth/NCSA/crypt_md5.cc squid-3.2.0.19/helpers/basic_auth/NCSA/crypt_md5.cc --- squid-3.2.0.18/helpers/basic_auth/NCSA/crypt_md5.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/NCSA/crypt_md5.cc 2012-08-03 00:14:34.000000000 +1200 @@ -32,7 +32,8 @@ static void md5to64(char *s, unsigned long v, int n) { while (--n >= 0) { - *s++ = itoa64[v & 0x3f]; + *s = itoa64[v & 0x3f]; + ++s; v >>= 6; } } @@ -59,7 +60,8 @@ unsigned long l; if (*salt == '$') { - magic = salt++; + magic = salt; + ++salt; while (*salt && *salt != '$') salt++; if (*salt == '$') { diff -u -r -N squid-3.2.0.18/helpers/basic_auth/PAM/basic_pam_auth.cc squid-3.2.0.19/helpers/basic_auth/PAM/basic_pam_auth.cc --- squid-3.2.0.18/helpers/basic_auth/PAM/basic_pam_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/PAM/basic_pam_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -221,7 +221,8 @@ debug("ERROR: %s: Unexpected input '%s'\n", argv[0], buf); goto error; } - *password_buf++ = '\0'; + *password_buf = '\0'; + ++password_buf; rfc1738_unescape(user); rfc1738_unescape(password_buf); conv.appdata_ptr = (char *) password_buf; /* from buf above. not allocated */ diff -u -r -N squid-3.2.0.18/helpers/basic_auth/RADIUS/basic_radius_auth.cc squid-3.2.0.19/helpers/basic_auth/RADIUS/basic_radius_auth.cc --- squid-3.2.0.18/helpers/basic_auth/RADIUS/basic_radius_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/RADIUS/basic_radius_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -264,16 +264,21 @@ tmp[2] = '\0'; while (*src && size > 1) { if (*src == '%' && src[1] != '\0' && src[2] != '\0') { - src++; - tmp[0] = *src++; - tmp[1] = *src++; - *dst++ = strtol(tmp, NULL, 16); + ++src; + tmp[0] = *src; + ++src; + tmp[1] = *src; + ++src; + *dst = strtol(tmp, NULL, 16); + ++dst; } else { - *dst++ = *src++; + *dst = *src; + ++dst; + ++src; } - size--; + --size; } - *dst++ = '\0'; + *dst = '\0'; } static int @@ -308,12 +313,14 @@ /* * User Name */ - *ptr++ = PW_USER_NAME; + *ptr = PW_USER_NAME; + ++ptr; length = strlen(username); if (length > MAXPWNAM) { length = MAXPWNAM; } - *ptr++ = length + 2; + *ptr = length + 2; + ++ptr; memcpy(ptr, username, length); ptr += length; total_length += length + 2; @@ -335,8 +342,10 @@ */ length = ((length / AUTH_VECTOR_LEN) + 1) * AUTH_VECTOR_LEN; - *ptr++ = PW_PASSWORD; - *ptr++ = length + 2; + *ptr = PW_PASSWORD; + ++ptr; + *ptr = length + 2; + ++ptr; secretlen = strlen(secretkey); /* Set up the Cipher block chain */ @@ -348,22 +357,27 @@ md5_calc(cbc, md5buf, secretlen + AUTH_VECTOR_LEN); /* Xor the password into the MD5 digest */ - for (i = 0; i < AUTH_VECTOR_LEN; i++) { - *ptr++ = (cbc[i] ^= passbuf[j + i]); + for (i = 0; i < AUTH_VECTOR_LEN; ++i) { + *ptr = (cbc[i] ^= passbuf[j + i]); + ++ptr; } } total_length += length + 2; - *ptr++ = PW_NAS_PORT_ID; - *ptr++ = 6; + *ptr = PW_NAS_PORT_ID; + ++ptr; + *ptr = 6; + ++ptr; ui = htonl(nasport); memcpy(ptr, &ui, 4); ptr += 4; total_length += 6; - *ptr++ = PW_NAS_PORT_TYPE; - *ptr++ = 6; + *ptr = PW_NAS_PORT_TYPE; + ++ptr; + *ptr = 6; + ++ptr; ui = htonl(nasporttype); memcpy(ptr, &ui, 4); @@ -372,14 +386,18 @@ if (*identifier) { int len = strlen(identifier); - *ptr++ = PW_NAS_ID; - *ptr++ = len + 2; + *ptr = PW_NAS_ID; + ++ptr; + *ptr = len + 2; + ++ptr; memcpy(ptr, identifier, len); ptr += len; total_length += len + 2; } else { - *ptr++ = PW_NAS_IP_ADDRESS; - *ptr++ = 6; + *ptr = PW_NAS_IP_ADDRESS; + ++ptr; + *ptr = 6; + ++ptr; ui = htonl(nas_ipaddr); memcpy(ptr, &ui, 4); @@ -397,7 +415,8 @@ */ auth->length = htons(total_length); - while (retry--) { + while (retry) { + --retry; int time_spent; struct timeval sent; /* @@ -566,7 +585,7 @@ /* Parse out the username and password */ ptr = buf; while (isspace(*ptr)) - ptr++; + ++ptr; if ((end = strchr(ptr, ' ')) == NULL) { SEND_ERR("No password"); continue; @@ -575,7 +594,7 @@ urldecode(username, ptr, MAXPWNAM); ptr = end + 1; while (isspace(*ptr)) - ptr++; + ++ptr; urldecode(passwd, ptr, MAXPASS); if (authenticate(sockfd, username, passwd)) diff -u -r -N squid-3.2.0.18/helpers/basic_auth/RADIUS/radius-util.cc squid-3.2.0.19/helpers/basic_auth/RADIUS/radius-util.cc --- squid-3.2.0.18/helpers/basic_auth/RADIUS/radius-util.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/RADIUS/radius-util.cc 2012-08-03 00:14:34.000000000 +1200 @@ -79,17 +79,17 @@ digit_count = 0; while (*addr != '\0' && *addr != ' ') { if (*addr == '.') { - dot_count++; + ++dot_count; digit_count = 0; } else if (!isdigit(*addr)) { dot_count = 5; } else { - digit_count++; + ++digit_count; if (digit_count > 3) { dot_count = 5; } } - addr++; + ++addr; } if (dot_count != 3) { return(-1); @@ -112,7 +112,7 @@ int cur_byte; ipaddr = (uint32_t)0; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; ++i) { ptr = buf; count = 0; *ptr = '\0'; @@ -120,8 +120,10 @@ if (!isdigit(*ip_str)) { return((uint32_t)0); } - *ptr++ = *ip_str++; - count++; + *ptr = *ip_str; + ++ptr; + ++ip_str; + ++count; } if (count >= 4 || count == 0) { return((uint32_t)0); @@ -131,7 +133,7 @@ if (cur_byte < 0 || cur_byte > 255) { return((uint32_t)0); } - ip_str++; + ++ip_str; ipaddr = ipaddr << 8 | (uint32_t)cur_byte; } return(ipaddr); diff -u -r -N squid-3.2.0.18/helpers/basic_auth/SASL/basic_sasl_auth.cc squid-3.2.0.19/helpers/basic_auth/SASL/basic_sasl_auth.cc --- squid-3.2.0.18/helpers/basic_auth/SASL/basic_sasl_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/SASL/basic_sasl_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -99,7 +99,8 @@ SEND_ERR("No Password"); continue; } - *password++ = '\0'; + *password = '\0'; + ++password; rfc1738_unescape(username); rfc1738_unescape(password); diff -u -r -N squid-3.2.0.18/helpers/basic_auth/SMB/basic_smb_auth.cc squid-3.2.0.19/helpers/basic_auth/SMB/basic_smb_auth.cc --- squid-3.2.0.18/helpers/basic_auth/SMB/basic_smb_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/basic_auth/SMB/basic_smb_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -91,7 +91,8 @@ if (*t == '\\') buf[i++] = '\\'; - buf[i++] = *t; + buf[i] = *t; + ++i; } if (i > 0) { diff -u -r -N squid-3.2.0.18/helpers/digest_auth/eDirectory/ldap_backend.cc squid-3.2.0.19/helpers/digest_auth/eDirectory/ldap_backend.cc --- squid-3.2.0.18/helpers/digest_auth/eDirectory/ldap_backend.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/digest_auth/eDirectory/ldap_backend.cc 2012-08-03 00:14:34.000000000 +1200 @@ -171,15 +171,19 @@ n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; - snprintf(escaped, 3, "%02x", (int) *src++); + *escaped = '\\'; + ++escaped; + snprintf(escaped, 3, "%02x", (int) *src); + ++src; escaped += 2; } break; default: - *escaped++ = *src++; - n++; - size--; + *escaped = *src; + ++escaped; + ++src; + ++n; + --size; } } *escaped = '\0'; diff -u -r -N squid-3.2.0.18/helpers/digest_auth/LDAP/ldap_backend.cc squid-3.2.0.19/helpers/digest_auth/LDAP/ldap_backend.cc --- squid-3.2.0.18/helpers/digest_auth/LDAP/ldap_backend.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/digest_auth/LDAP/ldap_backend.cc 2012-08-03 00:14:34.000000000 +1200 @@ -170,15 +170,19 @@ n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; - snprintf(escaped, 3, "%02x", (int) *src++); + *escaped = '\\'; + ++escaped; + snprintf(escaped, 3, "%02x", (int) *src); + ++src; escaped += 2; } break; default: - *escaped++ = *src++; - n++; - size--; + *escaped = *src; + ++escaped; + ++src; + ++n; + --size; } } *escaped = '\0'; diff -u -r -N squid-3.2.0.18/helpers/external_acl/AD_group/ext_ad_group_acl.cc squid-3.2.0.19/helpers/external_acl/AD_group/ext_ad_group_acl.cc --- squid-3.2.0.18/helpers/external_acl/AD_group/ext_ad_group_acl.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/AD_group/ext_ad_group_acl.cc 2012-08-03 00:14:34.000000000 +1200 @@ -583,7 +583,7 @@ */ if (nStatus == NERR_Success) { if ((pTmpBuf = pBuf) != NULL) { - for (i = 0; i < dwEntriesRead; i++) { + for (i = 0; i < dwEntriesRead; ++i) { assert(pTmpBuf != NULL); if (pTmpBuf == NULL) { result = 0; @@ -629,7 +629,7 @@ strncpy(NTDomain, UserName, sizeof(NTDomain)); - for (j = 0; j < strlen(NTV_VALID_DOMAIN_SEPARATOR); j++) { + for (j = 0; j < strlen(NTV_VALID_DOMAIN_SEPARATOR); ++j) { if ((domain_qualify = strchr(NTDomain, NTV_VALID_DOMAIN_SEPARATOR[j])) != NULL) break; } @@ -850,7 +850,7 @@ continue; } username = strtok(buf, " "); - for (n = 0; (group = strtok(NULL, " ")) != NULL; n++) { + for (n = 0; (group = strtok(NULL, " ")) != NULL; ++n) { rfc1738_unescape(group); groups[n] = group; } diff -u -r -N squid-3.2.0.18/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc squid-3.2.0.19/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc --- squid-3.2.0.18/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc 2012-08-03 00:14:34.000000000 +1200 @@ -1092,7 +1092,7 @@ bufc[0] = '\134'; swi = 0; j = 1; - for (i = 0; i < s; i++) { + for (i = 0; i < s; ++i) { if (swi == 2) { bufc[j] = '\134'; j++; @@ -1256,20 +1256,20 @@ l->num_val = x; if (x > 0) { /* Display all values */ - for (i = 0; i < x; i++) { + for (i = 0; i < x; ++i) { j = l->val[i]->bv_len; memcpy(bufa, l->val[i]->bv_val, j); z = BinarySplit(bufa, j, '#', bufb, sizeof(bufb)); /* BINARY DEBUGGING * local_printfx("value[%" PRIuSIZE "]: BinarySplit(", (size_t) i); - for (k = 0; k < z; k++) { + for (k = 0; k < z; ++k) { c = (int) bufb[k]; if (c < 0) c = c + 256; local_printfx("%02X", c); } local_printfx(", "); - for (k = 0; k < (j - z - 1); k++) { + for (k = 0; k < (j - z - 1); ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1284,7 +1284,7 @@ /* bufa is the address, just compare it */ if (!(l->status & LDAP_IPV4_S) || (l->status & LDAP_IPV6_S)) break; /* Not looking for IPv4 */ - for (k = 0; k < z; k++) { + for (k = 0; k < z; ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1299,7 +1299,7 @@ if (memcmp(l->search_ip, bufb, y) == 0) { /* We got a match! - Scan 'ber' for 'cn' values */ z = ldap_count_values_len(ber); - for (j = 0; j < z; j++) { + for (j = 0; j < z; ++j) { // broken? xstrncpy(l->userid, ber[j]->bv_val, min(sizeof(l->userid),static_cast(ber[j]->bv_len))); xstrncpy(l->userid, ber[j]->bv_val, sizeof(l->userid)); /* Using bv_len of min() breaks the result by 2 chars */ @@ -1319,7 +1319,7 @@ /* bufa + 2 is the address (skip 2 digit port) */ if (!(l->status & LDAP_IPV4_S) || (l->status & LDAP_IPV6_S)) break; /* Not looking for IPv4 */ - for (k = 2; k < z; k++) { + for (k = 2; k < z; ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1334,7 +1334,7 @@ if (memcmp(l->search_ip, bufb, y) == 0) { /* We got a match! - Scan 'ber' for 'cn' values */ z = ldap_count_values_len(ber); - for (j = 0; j < z; j++) { + for (j = 0; j < z; ++j) { // broken? xstrncpy(l->userid, ber[j]->bv_val, min(sizeof(l->userid),static_cast(ber[j]->bv_len))); xstrncpy(l->userid, ber[j]->bv_val, sizeof(l->userid)); /* Using bv_len of min() breaks the result by 2 chars */ @@ -1354,7 +1354,7 @@ /* bufa + 2 is the address (skip 2 digit port) */ if (!(l->status & LDAP_IPV6_S)) break; /* Not looking for IPv6 */ - for (k = 2; k < z; k++) { + for (k = 2; k < z; ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1369,7 +1369,7 @@ if (memcmp(l->search_ip, bufb, y) == 0) { /* We got a match! - Scan 'ber' for 'cn' values */ z = ldap_count_values_len(ber); - for (j = 0; j < z; j++) { + for (j = 0; j < z; ++j) { // broken? xstrncpy(l->userid, ber[j]->bv_val, min(sizeof(l->userid),static_cast(ber[j]->bv_len))); xstrncpy(l->userid, ber[j]->bv_val, sizeof(l->userid)); /* Using bv_len of min() breaks the result by 2 chars */ @@ -1527,7 +1527,7 @@ /* Scan args */ if (k > 1) { - for (i = 1; i < k; i++) { + for (i = 1; i < k; ++i) { /* Classic / novelty usage schemes */ if (!strcmp(argv[i], "--help")) { DisplayUsage(); @@ -1540,7 +1540,7 @@ return 1; } else if (argv[i][0] == '-') { s = strlen(argv[i]); - for (j = 1; j < s; j++) { + for (j = 1; j < s; ++j) { switch (argv[i][j]) { case 'h': DisplayUsage(); @@ -1760,7 +1760,7 @@ k = strlen(bufa); /* BINARY DEBUGGING * local_printfx("while() -> bufa[%" PRIuSIZE "]: %s", k, bufa); - for (i = 0; i < k; i++) + for (i = 0; i < k; ++i) local_printfx("%02X", bufa[i]); local_printfx("\n"); * BINARY DEBUGGING */ diff -u -r -N squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_group.cc squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_group.cc --- squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_group.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_group.cc 2012-08-03 00:14:34.000000000 +1200 @@ -55,13 +55,13 @@ src = margs->glist; if (!src) return NULL; - for (n = 0; n < strlen(src); n++) + for (n = 0; n < strlen(src); ++n) if ((unsigned char) src[n] > 127) c++; if (c != 0) { p = (unsigned char *) xmalloc(strlen(src) + c); dupp = p; - for (n = 0; n < strlen(src); n++) { + for (n = 0; n < strlen(src); ++n) { s = (unsigned char) src[n]; if (s > 127 && s < 192) { *p = 194; diff -u -r -N squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_krb5.cc squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_krb5.cc --- squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_krb5.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_krb5.cc 2012-08-03 00:14:34.000000000 +1200 @@ -187,7 +187,7 @@ creds = (krb5_creds *) xmalloc(sizeof(*creds)); memset(creds, 0, sizeof(*creds)); - for (i = 0; i < nprinc; i++) { + for (i = 0; i < nprinc; ++i) { /* * get credentials */ @@ -324,7 +324,7 @@ xfree(mem_cache); if (principal) krb5_free_principal(kparam.context, principal); - for (i = 0; i < nprinc; i++) { + for (i = 0; i < nprinc; ++i) { if (principal_list[i]) krb5_free_principal(kparam.context, principal_list[i]); } diff -u -r -N squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_ldap.cc squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_ldap.cc --- squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_ldap.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_ldap.cc 2012-08-03 00:14:34.000000000 +1200 @@ -227,7 +227,7 @@ if (!domain) return NULL; - for (dp = domain; *dp; dp++) { + for (dp = domain; *dp; ++dp) { if (*dp == '.') i++; } @@ -239,12 +239,14 @@ bp = bindp; strcpy(bp, "dc="); bp += 3; - for (dp = domain; *dp; dp++) { + for (dp = domain; *dp; ++dp) { if (*dp == '.') { strcpy(bp, ",dc="); bp += 4; - } else - *bp++ = *dp; + } else { + *bp = *dp; + ++bp; + } } *bp = '\0'; return bindp; @@ -257,7 +259,7 @@ char *ldap_filter_esc, *ldf; i = 0; - for (ldap_filter_esc = filter; *ldap_filter_esc; ldap_filter_esc++) { + for (ldap_filter_esc = filter; *ldap_filter_esc; ++ldap_filter_esc) { if ((*ldap_filter_esc == '*') || (*ldap_filter_esc == '(') || (*ldap_filter_esc == ')') || @@ -267,7 +269,7 @@ ldap_filter_esc = (char *) xcalloc(strlen(filter) + i + 1, sizeof(char)); ldf = ldap_filter_esc; - for (; *filter; filter++) { + for (; *filter; ++filter) { if (*filter == '*') { strcpy(ldf, "\\2a"); ldf = ldf + 3; @@ -328,7 +330,7 @@ * Cleanup */ if (attr_value) { - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { xfree(attr_value[j]); } xfree(attr_value); @@ -398,7 +400,7 @@ */ retval = 0; ldepth = depth + 1; - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { /* Compare first CN= value assuming it is the same as the group name itself */ av = attr_value[j]; @@ -411,7 +413,7 @@ if (debug_enabled) { int n; debug((char *) "%s| %s: DEBUG: Entry %d \"%s\" in hex UTF-8 is ", LogTime(), PROGRAM, j + 1, av); - for (n = 0; av[n] != '\0'; n++) + for (n = 0; av[n] != '\0'; ++n) fprintf(stderr, "%02x", (unsigned char) av[n]); fprintf(stderr, "\n"); } @@ -446,7 +448,7 @@ * Cleanup */ if (attr_value) { - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { xfree(attr_value[j]); } xfree(attr_value); @@ -597,7 +599,7 @@ int il; if ((values = ldap_get_values_len(ld, msg, attr)) != NULL) { - for (il = 0; values[il] != NULL; il++) { + for (il = 0; values[il] != NULL; ++il) { attr_value = (char **) xrealloc(attr_value, (il + 1) * sizeof(char *)); if (!attr_value) @@ -871,7 +873,7 @@ * Loop over list of ldap servers of users domain */ nhosts = get_ldap_hostname_list(margs, &hlist, 0, domain); - for (i = 0; i < nhosts; i++) { + for (i = 0; i < nhosts; ++i) { port = 389; if (hlist[i].port != -1) port = hlist[i].port; @@ -940,7 +942,7 @@ if (host) xfree(host); host = NULL; - for (i = 0; i < nhosts; i++) { + for (i = 0; i < nhosts; ++i) { ld = tool_ldap_open(margs, hlist[i].host, port, ssl); if (!ld) @@ -1035,7 +1037,7 @@ * Compare group names */ retval = 0; - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { /* Compare first CN= value assuming it is the same as the group name itself */ av = attr_value[j]; @@ -1048,7 +1050,7 @@ if (debug_enabled) { int n; debug((char *) "%s| %s: DEBUG: Entry %d \"%s\" in hex UTF-8 is ", LogTime(), PROGRAM, j + 1, av); - for (n = 0; av[n] != '\0'; n++) + for (n = 0; av[n] != '\0'; ++n) fprintf(stderr, "%02x", (unsigned char) av[n]); fprintf(stderr, "\n"); } @@ -1068,7 +1070,7 @@ if (debug_enabled && max_attr > 0) { debug((char *) "%s| %s: DEBUG: Perform recursive group search\n", LogTime(), PROGRAM); } - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { av = attr_value[j]; if (search_group_tree(margs, ld, bindp, av, group, 1)) { @@ -1090,7 +1092,7 @@ * Cleanup */ if (attr_value) { - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { xfree(attr_value[j]); } xfree(attr_value); @@ -1176,7 +1178,7 @@ * Cleanup */ if (attr_value_2) { - for (j = 0; j < max_attr_2; j++) { + for (j = 0; j < max_attr_2; ++j) { xfree(attr_value_2[j]); } xfree(attr_value_2); @@ -1192,7 +1194,7 @@ * Cleanup */ if (attr_value) { - for (j = 0; j < max_attr; j++) { + for (j = 0; j < max_attr; ++j) { xfree(attr_value[j]); } xfree(attr_value); diff -u -r -N squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_resolv.cc squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_resolv.cc --- squid-3.2.0.18/helpers/external_acl/kerberos_ldap_group/support_resolv.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/kerberos_ldap_group/support_resolv.cc 2012-08-03 00:14:34.000000000 +1200 @@ -152,7 +152,7 @@ int i; hp = *hlist; - for (i = 0; i < nhosts; i++) { + for (i = 0; i < nhosts; ++i) { if (hp[i].host) xfree(hp[i].host); hp[i].host = NULL; diff -u -r -N squid-3.2.0.18/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc squid-3.2.0.19/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc --- squid-3.2.0.18/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc 2012-08-03 00:14:34.000000000 +1200 @@ -631,15 +631,19 @@ n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; - snprintf(escaped, 3, "%02x", (unsigned char) *src++); + *escaped = '\\'; + ++escaped; + snprintf(escaped, 3, "%02x", (unsigned char) *src); + ++src; escaped += 2; } break; default: - *escaped++ = *src++; - n++; - size--; + *escaped = *src; + ++escaped; + ++src; + ++n; + --size; } } *escaped = '\0'; @@ -678,13 +682,17 @@ case '\\': templ++; if (*templ) { - *filter++ = *templ++; - size--; + *filter = *templ; + ++filter; + ++templ; + --size; } break; default: - *filter++ = *templ++; - size--; + *filter = *templ; + ++filter; + ++templ; + --size; break; } } diff -u -r -N squid-3.2.0.18/helpers/external_acl/LM_group/ext_lm_group_acl.cc squid-3.2.0.19/helpers/external_acl/LM_group/ext_lm_group_acl.cc --- squid-3.2.0.18/helpers/external_acl/LM_group/ext_lm_group_acl.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/LM_group/ext_lm_group_acl.cc 2012-08-03 00:14:34.000000000 +1200 @@ -285,7 +285,7 @@ */ if (nStatus == NERR_Success) { if ((pTmpBuf = pBuf) != NULL) { - for (i = 0; i < dwEntriesRead; i++) { + for (i = 0; i < dwEntriesRead; ++i) { assert(pTmpBuf != NULL); if (pTmpBuf == NULL) { result = 0; @@ -341,7 +341,7 @@ strncpy(NTDomain, UserName, sizeof(NTDomain)); - for (j = 0; j < strlen(NTV_VALID_DOMAIN_SEPARATOR); j++) { + for (j = 0; j < strlen(NTV_VALID_DOMAIN_SEPARATOR); ++j) { if ((domain_qualify = strchr(NTDomain, NTV_VALID_DOMAIN_SEPARATOR[j])) != NULL) break; } @@ -422,7 +422,7 @@ */ if (nStatus == NERR_Success) { if ((pTmpBuf = pUsrBuf) != NULL) { - for (i = 0; i < dwEntriesRead; i++) { + for (i = 0; i < dwEntriesRead; ++i) { assert(pTmpBuf != NULL); if (pTmpBuf == NULL) { result = 0; @@ -579,7 +579,7 @@ continue; } username = strtok(buf, " "); - for (n = 0; (group = strtok(NULL, " ")) != NULL; n++) { + for (n = 0; (group = strtok(NULL, " ")) != NULL; ++n) { rfc1738_unescape(group); groups[n] = group; } diff -u -r -N squid-3.2.0.18/helpers/external_acl/unix_group/check_group.cc squid-3.2.0.19/helpers/external_acl/unix_group/check_group.cc --- squid-3.2.0.18/helpers/external_acl/unix_group/check_group.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/unix_group/check_group.cc 2012-08-03 00:14:34.000000000 +1200 @@ -169,7 +169,8 @@ break; case 'g': grents = (char**)realloc(grents, sizeof(*grents) * (ngroups+1)); - grents[ngroups++] = optarg; + grents[ngroups] = optarg; + ++ngroups; break; case '?': if (xisprint(optopt)) { @@ -223,7 +224,7 @@ } /* check groups supplied on the command line */ - for (i = 0; i < ngroups; i++) { + for (i = 0; i < ngroups; ++i) { if (check_pw == 1) { j += validate_user_pw(user, grents[i]); } diff -u -r -N squid-3.2.0.18/helpers/external_acl/wbinfo_group/ext_wbinfo_group_acl.8 squid-3.2.0.19/helpers/external_acl/wbinfo_group/ext_wbinfo_group_acl.8 --- squid-3.2.0.18/helpers/external_acl/wbinfo_group/ext_wbinfo_group_acl.8 2012-06-29 13:57:15.000000000 +1200 +++ squid-3.2.0.19/helpers/external_acl/wbinfo_group/ext_wbinfo_group_acl.8 2012-08-03 00:35:01.000000000 +1200 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "EXT_WBINFO_GROUP_ACL.PL.IN 1" -.TH EXT_WBINFO_GROUP_ACL.PL.IN 1 "2012-06-28" "perl v5.10.1" "User Contributed Perl Documentation" +.TH EXT_WBINFO_GROUP_ACL.PL.IN 1 "2012-08-02" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-3.2.0.18/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc squid-3.2.0.19/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc --- squid-3.2.0.18/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -243,7 +243,8 @@ } memcpy(domain, tmp.str, tmp.l); user = domain + tmp.l; - *user++ = '\0'; + *user = '\0'; + ++user; /* debug("fetching user name\n"); */ tmp = ntlm_fetch_string(&(auth->hdr), auth_length, &auth->user, auth->flags); @@ -429,7 +430,8 @@ free(d); continue; } - *c++ = '\0'; + *c= '\0'; + ++c; new_dc = (dc *) malloc(sizeof(dc)); if (!new_dc) { fprintf(stderr, "Malloc error while parsing DC options\n"); diff -u -r -N squid-3.2.0.18/include/version.h squid-3.2.0.19/include/version.h --- squid-3.2.0.18/include/version.h 2012-06-29 13:39:35.000000000 +1200 +++ squid-3.2.0.19/include/version.h 2012-08-03 00:16:03.000000000 +1200 @@ -9,7 +9,7 @@ */ #ifndef SQUID_RELEASE_TIME -#define SQUID_RELEASE_TIME 1340933908 +#define SQUID_RELEASE_TIME 1343909673 #endif #ifndef APP_SHORTNAME diff -u -r -N squid-3.2.0.18/lib/hash.cc squid-3.2.0.19/lib/hash.cc --- squid-3.2.0.18/lib/hash.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/lib/hash.cc 2012-08-03 00:14:34.000000000 +1200 @@ -71,8 +71,9 @@ unsigned int j = 0; unsigned int i = 0; while (*s) { - j++; - n ^= 271 * (*s++); + ++j; + n ^= 271 * *s; + ++s; } i = n ^ (j * 271); return i % size; @@ -121,7 +122,8 @@ case 1: HASH4; } - while (loop--) { + while (loop) { + --loop; HASH4; HASH4; HASH4; diff -u -r -N squid-3.2.0.18/lib/MemPoolChunked.cc squid-3.2.0.19/lib/MemPoolChunked.cc --- squid-3.2.0.18/lib/MemPoolChunked.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/lib/MemPoolChunked.cc 2012-08-03 00:14:34.000000000 +1200 @@ -184,7 +184,7 @@ { memMeterDel(pool->getMeter().alloc, pool->chunk_capacity); memMeterDel(pool->getMeter().idle, pool->chunk_capacity); - pool->chunkCount--; + -- pool->chunkCount; pool->allChunks.remove(this, memCompChunks); xfree(objCache); } @@ -230,7 +230,7 @@ /* then try perchunk freelist chain */ if (nextFreeChunk == NULL) { /* no chunk with frees, so create new one */ - saved_calls--; // compensate for the ++ above + -- saved_calls; // compensate for the ++ above createChunk(); } /* now we have some in perchunk freelist chain */ @@ -371,7 +371,7 @@ chunk = const_cast(*allChunks.find(Free, memCompObjChunks)); assert(splayLastResult == 0); assert(chunk->inuse_count > 0); - chunk->inuse_count--; + -- chunk->inuse_count; (void) VALGRIND_MAKE_MEM_DEFINED(Free, sizeof(void *)); freeCache = *(void **)Free; /* remove from global cache */ *(void **)Free = chunk->freeList; /* stuff into chunks freelist */ diff -u -r -N squid-3.2.0.18/lib/ntlmauth/ntlmauth.cc squid-3.2.0.19/lib/ntlmauth/ntlmauth.cc --- squid-3.2.0.18/lib/ntlmauth/ntlmauth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/lib/ntlmauth/ntlmauth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -143,7 +143,8 @@ fprintf(stderr, "ntlmssp: bad unicode: %04x\n", c); return rv; } - *d++ = c; + *d = c; + ++d; rv.l++; } } else { diff -u -r -N squid-3.2.0.18/lib/ntlmauth/support_bits.cci squid-3.2.0.19/lib/ntlmauth/support_bits.cci --- squid-3.2.0.18/lib/ntlmauth/support_bits.cci 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/lib/ntlmauth/support_bits.cci 2012-08-03 00:14:34.000000000 +1200 @@ -18,7 +18,7 @@ char *p = string, c; while ((c = *p)) { *p = xtoupper(c); - p++; + ++p; } } @@ -29,7 +29,7 @@ char *p = string, c; while ((c = *p)) { *p = xtolower(c); - p++; + ++p; } } @@ -53,7 +53,7 @@ char addrstr[10] = {0}; char hexstr[16 * 3 + 5] = {0}; char charstr[16 * 1 + 5] = {0}; - for (n = 1; n <= size; n++) { + for (n = 1; n <= size; ++n) { if (n % 16 == 1) { /* store address for this line */ snprintf(addrstr, sizeof(addrstr), "%.4x", (int) (p - data)); @@ -80,7 +80,7 @@ strncat(hexstr, " ", sizeof(hexstr) - strlen(hexstr) - 1); strncat(charstr, " ", sizeof(charstr) - strlen(charstr) - 1); } - p++; /* next byte */ + ++p; /* next byte */ } if (strlen(hexstr) > 0) { diff -u -r -N squid-3.2.0.18/Makefile.am squid-3.2.0.19/Makefile.am --- squid-3.2.0.18/Makefile.am 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/Makefile.am 2012-08-03 00:14:34.000000000 +1200 @@ -10,7 +10,7 @@ SUBDIRS += scripts icons errors doc helpers src tools test-suite DISTCLEANFILES = include/stamp-h include/stamp-h[0-9]* -DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'` +DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'` dist-hook: @ for subdir in include; do \ @@ -43,7 +43,7 @@ INSTALL \ QUICKSTART \ README \ - SPONSORS \ + SPONSORS.txt \ bootstrap.sh \ po4a.conf diff -u -r -N squid-3.2.0.18/Makefile.in squid-3.2.0.19/Makefile.in --- squid-3.2.0.18/Makefile.in 2012-06-29 13:39:21.000000000 +1200 +++ squid-3.2.0.19/Makefile.in 2012-08-03 00:15:45.000000000 +1200 @@ -337,7 +337,7 @@ INSTALL \ QUICKSTART \ README \ - SPONSORS \ + SPONSORS.txt \ bootstrap.sh \ po4a.conf diff -u -r -N squid-3.2.0.18/RELEASENOTES.html squid-3.2.0.19/RELEASENOTES.html --- squid-3.2.0.18/RELEASENOTES.html 2012-06-29 13:57:21.000000000 +1200 +++ squid-3.2.0.19/RELEASENOTES.html 2012-08-03 00:35:12.000000000 +1200 @@ -2,10 +2,10 @@ - Squid 3.2.0.18 release notes + Squid 3.2.0.19 release notes -

Squid 3.2.0.18 release notes

+

Squid 3.2.0.19 release notes

Squid Developers


@@ -24,18 +24,19 @@

2. Major new features since Squid-3.1

3. Changes to squid.conf since Squid-3.1

@@ -72,7 +73,7 @@

1. Notice

-

The Squid Team are pleased to announce the release of Squid-3.2.0.18 for testing.

+

The Squid Team are pleased to announce the release of Squid-3.2.0.19 for testing.

This new release is available for download from http://www.squid-cache.org/Versions/v3/3.2/ or the mirrors.

@@ -87,13 +88,19 @@

Although this release is deemed good enough for use in many setups, please note the existence of open bugs against Squid-3.2.

+

Some issues to note as currently known in this release which are not able to be fixed in the 3.2 series are:

+

+

    +
  • CVE-2009-0801 : interception proxies cannot relay certain requests to peers safely. see the CVE section below for details.
  • +
  • TCP logging of access.log does not recover from broken connections well.
  • +
+

+

Currently known issues which only depends on available developer time and may still be resolved in a future 3.2 release are:

    -
  • CVE-2009-0801 : interception proxies cannot relay certain requests to peers. see the CVE section below for details.
  • SMP Support still has a number of important bugs needing to be resolved. see the bugs list above for details.
  • Windows support is still incomplete.
  • -
  • TCP logging of access.log does not recover from broken connections well.
  • The lack of some features available in Squid-2.x series. See the regression sections below for full details.

@@ -111,7 +118,8 @@

The most important of these new features are:

    -
  • Fixed CVE-2009-0801 : NAT interception vulnerability to malicious clients.
  • +
  • CVE-2009-0801 : NAT interception vulnerability to malicious clients.
  • +
  • NCSA helper DES algorithm password limits
  • SMP scalability
  • Helper Multiplexer and On-Demand
  • Helper Name Changes
  • @@ -127,7 +135,7 @@

    Most user-facing changes are reflected in squid.conf (see below).

    -

    2.1 Fixed CVE-2009-0801 : NAT interception vulnerability to malicious clients. +

    2.1 CVE-2009-0801 : NAT interception vulnerability to malicious clients.

    Details in Advisory @@ -151,13 +159,34 @@ can not be used as feeder gateways into a cluster or peer hierarchy without strict validation.

    Known Issue: When non-strict validation fails Squid will relay the request, but can only do -so to the orginal destination IP the client was contacting. This means that interception -proxy Squid are unable to pass traffic reliably to peers in a cache hierarchy. +so safely to the orginal destination IP the client was contacting. The client original +destinatio IP is lost when relayign to peers in a hierarchy. This means the upstream peers +are at risk of cache poisoning from CVE-2009-0801 vulnerability. Developer time is required to implement safe transit of these requests. Please contact squid-dev if you are able to assist or sponsor the development.

    -

    2.2 SMP scalability +

    2.2 NCSA helper DES algorithm password limits +

    + +

    Details in Advisory +SQUID-2011:2

    + +

    The DES algorithm used by the NCSA Basic authentication helper has an +limit of 8 bytes but some implementations do not error when truncating +longer passwords down to this unsafe level.

    + +

    This both significantly lowers the threshold of difficulty decrypting +captured password files and hides from users the fact that the extra bits +of their chosen long password is not being utilized.

    + +

    The NCSA helper bundled with Squid will prevent passwords longer than 8 +characters being sent to the DES algorithm. The MD5 hash algorithm which +supports longer than 8 character passwords is also supported by this helper +and should be used instead.

    + + +

    2.3 SMP scalability

    The new "workers" squid.conf option can be used to launch multiple worker @@ -201,7 +230,7 @@ configuration" and "SMP-Related Macros" sections in squid.conf.documented.

    -

    2.3 Helper Multiplexer +

    2.4 Helper Multiplexer

    The helper multiplexer's purpose is to relieve some of the burden @@ -249,7 +278,7 @@

    -

    2.4 Helpers On-Demand +

    2.5 Helpers On-Demand

    Traditionally Squid has been configured with a fixed number of helpers and started them during @@ -285,7 +314,7 @@ of starting the maximum number of helpers will occur.

    -

    2.5 Helper Name Changes +

    2.6 Helper Name Changes

    To improve the understanding of what each helper does and where it should be used the helper binaries @@ -368,7 +397,7 @@

    -

    2.6 Multi-Lingual manuals +

    2.7 Multi-Lingual manuals

    The man(8) and man(1) pages bundled with Squid are now provided online for all @@ -381,7 +410,7 @@ This move begins the Localization of the internal administrator facing manuals.

    -

    2.7 Solaris 10 pthreads Support (Experimental) +

    2.8 Solaris 10 pthreads Support (Experimental)

    Automatic detection and use of the pthreads library available from Solaris 10

    @@ -393,7 +422,7 @@ We recommend giving AUFS a try for faster disk storage and encourage feedback.

    -

    2.8 Surrogate/1.0 protocol extensions to HTTP +

    2.9 Surrogate/1.0 protocol extensions to HTTP

    The Surrogate extensions to HTTP protocol enable an origin web server to specify separate @@ -418,7 +447,7 @@ is required to prevent an unacceptable surrogate ID of 'localhost' being generated.

    -

    2.9 Logging Infrastructure Updated +

    2.10 Logging Infrastructure Updated

    The advanced logging modules introduced in Squid-2.7 are now available from Squid-3.2.

    @@ -449,7 +478,7 @@ At present it will restart the affected Squid instance if the TCP connection is broken.

    -

    2.10 Client Bandwidth Limits +

    2.11 Client Bandwidth Limits

    In mobile environments, Squid may need to limit Squid-to-client bandwidth @@ -481,7 +510,7 @@ high-bandwidth environments.

    -

    2.11 Better eCAP Suport +

    2.12 Better eCAP Suport

    Support for libecap version 0.2.0 has been added with this series of Squid. Bringing @@ -491,7 +520,7 @@ against any older libecap releases.

    -

    2.12 Cache Manager access changes +

    2.13 Cache Manager access changes

    The Squid Cache Manager has previously only been accessible under the cache_object:// @@ -796,6 +825,18 @@

    New option max-stale= to provide a maximum staleness factor. Squid won't serve objects more stale than this even if it failed to validate the object.

    +
    reply_header_access
    +

    Added support for custom response header names.

    + +
    request_header_access
    +

    Added support for custom request header names.

    + +
    reply_header_replace
    +

    Added support for custom response header names.

    + +
    request_header_replace
    +

    Added support for custom request header names.

    +
    tcp_outgoing_address

    This parameter is now compatible with persistent server connections. The IPv6 magic 'to_ipv6' hacks needed in 3.1 are now no longer necessary.

    diff -u -r -N squid-3.2.0.18/scripts/find-alive.pl squid-3.2.0.19/scripts/find-alive.pl --- squid-3.2.0.18/scripts/find-alive.pl 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/scripts/find-alive.pl 2012-08-03 00:14:34.000000000 +1200 @@ -48,9 +48,13 @@ 'HttpStateData (\S+) destroyed', ], cbdata => [ - 'HttpStateData (\S+) created', + 'cbdataAlloc: (\S+)', 'cbdataFree: Freeing (\S+)', ], + FD => [ + 'fd_open.*\sFD (\d+)', + 'fd_close\s+FD (\d+)', + ], ); if (!$Pairs{$Thing}) { diff -u -r -N squid-3.2.0.18/SPONSORS squid-3.2.0.19/SPONSORS --- squid-3.2.0.18/SPONSORS 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/SPONSORS 1970-01-01 12:00:00.000000000 +1200 @@ -1,90 +0,0 @@ -In addition to the numerous volunteer developers (see CONTRIBUTORS), -the following organizations have provided financial or other support for -Squid: - -The National Science Foundation - - The NSF was the primary funding source for Squid development - from 1996-2000. Two grants (#NCR-9616602, #NCR-9521745) - received through the Advanced Networking Infrastructure - and Research (ANIR) Division were administered by the - University of California San Diego. - -MARA Systems AB - http://www.marasystems.com/ - - MARA systems has sponsored the bug fixing and maintentnance for - most Squid-2.5 releases, and a number of new features to be found - in Squid-3. - -Swell Technology - http://www.swelltech.com/ - - Swell Technology provides ongoing development and testing - support to the Squid project, as well as hardware donations - for Squid developers. - -Picture IQ - http://www.pictureiq.com/ - - Bought simple support for the Vary header, to help their - accelerator setups. - -SGI - http://www.sgi.com/ - - SGI has provided hardware donations for Squid developers. - -Zope Corporation - http://www.zope.com/ - - Zope Corporation funded the development of the ESI protocol - (http://www.esi.org) in Squid to provide greater cachability - of dynamic and personalized pages by caching common page - components. Zope engaged one of the core Squid developers - for the project. - -craigslist - http://www.craigslist.org/ - - craigslist has provided funding in recognition of the vital - role squid plays in their web serving architecture. - -webwasher AG - http://www.webwasher.com/ - - webwasher AG paid for improvements to Squid's iCAP client - implementation. You can find the results of this work - at http://devel.squid-cache.org/icap/ - -iiNet Ltd - http://www.iinet.net.au/ - - iiNet Ltd contributed significant development resources to - Squid during its early stages and was instrumental in its - early adoption in the local internet community. iiNet has also - recently supplied equipment to help develop and test the WCCPv2 - implementation in Squid-2.6 and Squid-3. - -Kaspersky Lab - http://www.kaspersky.com/ - - Kaspersky Lab funded initial development of ICAP support in - Squid-3. - -Barefruit - http://www.barefruit.com/ - - Barefruit has funded Squid3 development and maintenance, - with a focus on content adaptation (ICAP and eCAP) support. - -Palisade Systems - http://www.palisadesys.com/ - - Palisade Systems funded SSL Bump feature development in Squid3. - -Treehouse Networks, NZ - http://treenet.co.nz/ - - Treehouse Networks has contributed significant development resources - toward Squid-3 development and maintenance for their customer - gateways and CDN. - -BBC (UK) and Siemens IT Solutions and Services (UK) - - Provided developement and testing resources for Solaris /dev/poll - support. - -Yahoo! Inc. - http://www.yahoo.com/ - - Yahoo! Inc. supported the development of improved refresh - logics. Many thanks to Yahoo! Inc. for supporting the development - of these features. diff -u -r -N squid-3.2.0.18/SPONSORS.txt squid-3.2.0.19/SPONSORS.txt --- squid-3.2.0.18/SPONSORS.txt 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.2.0.19/SPONSORS.txt 2012-08-03 00:16:03.000000000 +1200 @@ -0,0 +1,111 @@ +In addition to the numerous volunteer developers (see CONTRIBUTORS), +the following organizations have provided non-financial support for +the Squid Project: + + +iiNet Ltd - http://www.iinet.net.au/ + + iiNet Ltd contributed significant development resources to + Squid during its early stages and was instrumental in its + early adoption in the local internet community. + In Squid-2.6 and 3.0 iiNet supplied equipment to help develop + and test the WCCPv2 implementation. + In Squid-3.2 iiNet sponsored development time to resolve + authentication problems. + +LaunchPad - http://launchpad.net/ + + Provide Bazaar mirroring services and host the Squid-3 developer + project code. + +Messagenet - http://messagenet.it/ + + Messagenet donated hardware and bandwidth for the wiki server + and most continuous integration testing. + +Palisade Systems - http://www.palisadesys.com/ + + Palisade Systems funded SSL Bump feature development in Squid3. + +The Measurement Factory - http://www.measurement-factory.com/ + + Measurement Factory has constributed significant resources + toward Squid-3 development and server maintenance. + +Treehouse Networks, NZ - http://treenet.co.nz/ + + Treehouse Networks has contributed significant resources + toward Squid-3 development and maintenance for their customer + gateways and CDN. + + +Barefruit - http://www.barefruit.com/ + + Barefruit has funded Squid-3.0 and 3.1 development and maintenance, + with a focus on content adaptation (ICAP and eCAP) support. + +BBC (UK) and Siemens IT Solutions and Services (UK) + + Provided developement and testing resources for Solaris /dev/poll + support in Squid-3.1. + +webwasher AG - http://www.webwasher.com/ + + webwasher AG paid for improvements to Squid-3.1 ICAP client + implementation. + +SourceForge - http://www.sourceforge.net/ + + Provide CVS mirroring services and hosted the Squid-2 developer + project code. + + +Kaspersky Lab - http://www.kaspersky.com/ + + Kaspersky Lab funded initial development of ICAP support in + Squid-3.0 + +MARA Systems AB - http://www.marasystems.com/ + + MARA systems has sponsored the bug fixing and maintenance for + most Squid-2.5 releases, and a number of new features to be found + in Squid-3.0. + +Zope Corporation - http://www.zope.com/ + + Zope Corporation funded the development of the ESI protocol + (http://www.esi.org) in Squid-3.0 to provide greater cachability + of dynamic and personalized pages by caching common page + components. + + +Picture IQ - http://www.pictureiq.com/ + + Picture IQ bought simple support for the Vary header to Squid-2.7, + to help their accelerator setups. + +Yahoo! Inc. - http://www.yahoo.com/ + + Yahoo! Inc. supported the development of improved refresh + logics. Many thanks to Yahoo! Inc. for supporting the development + of these features. + + +Swell Technology - http://www.swelltech.com/ + + Swell Technology provided development and testing support to the + Squid-2 project, as well as hardware donations for Squid developers. + + +SGI - http://www.sgi.com/ + + SGI has provided hardware donations for Squid developers. + + +The National Science Foundation + + The NSF was the primary funding source for Squid development + from 1996-2000. Two grants (#NCR-9616602, #NCR-9521745) + received through the Advanced Networking Infrastructure + and Research (ANIR) Division were administered by the + University of California San Diego. diff -u -r -N squid-3.2.0.18/src/AccessLogEntry.cc squid-3.2.0.19/src/AccessLogEntry.cc --- squid-3.2.0.18/src/AccessLogEntry.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/AccessLogEntry.cc 2012-08-03 00:14:34.000000000 +1200 @@ -17,3 +17,26 @@ else cache.caddr.NtoA(buf, bufsz); } + +AccessLogEntry::~AccessLogEntry() +{ + safe_free(headers.request); + +#if ICAP_CLIENT + safe_free(adapt.last_meta); +#endif + + safe_free(headers.reply); + safe_free(cache.authuser); + + safe_free(headers.adapted_request); + HTTPMSGUNLOCK(adapted_request); + + HTTPMSGUNLOCK(reply); + HTTPMSGUNLOCK(request); +#if ICAP_CLIENT + HTTPMSGUNLOCK(icap.reply); + HTTPMSGUNLOCK(icap.request); +#endif + cbdataReferenceDone(cache.port); +} diff -u -r -N squid-3.2.0.18/src/AccessLogEntry.h squid-3.2.0.19/src/AccessLogEntry.h --- squid-3.2.0.18/src/AccessLogEntry.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/AccessLogEntry.h 2012-08-03 00:14:34.000000000 +1200 @@ -40,17 +40,21 @@ #if ICAP_CLIENT #include "adaptation/icap/Elements.h" #endif +#include "RefCount.h" /* forward decls */ class HttpReply; class HttpRequest; -class AccessLogEntry +class AccessLogEntry: public RefCountable { public: + typedef RefCount Pointer; + AccessLogEntry() : url(NULL), tcpClient(), reply(NULL), request(NULL), adapted_request(NULL) {} + ~AccessLogEntry(); /// Fetch the client IP log string into the given buffer. /// Knows about several alternate locations of the IP @@ -131,11 +135,12 @@ msec(0), rfc931 (NULL), authuser (NULL), - extuser(NULL) + extuser(NULL), #if USE_SSL - ,ssluser(NULL) + ssluser(NULL), #endif - {; + port(NULL) { + ; } Ip::Address caddr; @@ -254,12 +259,11 @@ class StoreEntry; /* Should be in 'AccessLog.h' as the driver */ -extern void accessLogLogTo(customlog* log, AccessLogEntry* al, ACLChecklist* checklist = NULL); -extern void accessLogLog(AccessLogEntry *, ACLChecklist * checklist); +extern void accessLogLogTo(customlog* log, AccessLogEntry::Pointer &al, ACLChecklist* checklist = NULL); +extern void accessLogLog(AccessLogEntry::Pointer &, ACLChecklist * checklist); extern void accessLogRotate(void); extern void accessLogClose(void); extern void accessLogInit(void); -extern void accessLogFreeMemory(AccessLogEntry * aLogEntry); extern const char *accessLogTime(time_t); #endif /* SQUID_HTTPACCESSLOGENTRY_H */ diff -u -r -N squid-3.2.0.18/src/acl/IntRange.cc squid-3.2.0.19/src/acl/IntRange.cc --- squid-3.2.0.18/src/acl/IntRange.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/acl/IntRange.cc 2012-08-03 00:14:34.000000000 +1200 @@ -53,8 +53,10 @@ char *b = strchr(a, '-'); unsigned short port1, port2; - if (b) - *b++ = '\0'; + if (b) { + *b = '\0'; + ++b; + } port1 = xatos(a); diff -u -r -N squid-3.2.0.18/src/acl/RegexData.cc squid-3.2.0.19/src/acl/RegexData.cc --- squid-3.2.0.18/src/acl/RegexData.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/acl/RegexData.cc 2012-08-03 00:14:34.000000000 +1200 @@ -235,14 +235,20 @@ } } else if (RElen + largeREindex + 3 < BUFSIZ-1) { debugs(28, 2, "compileOptimisedREs: adding RE '" << wl->key << "'"); - if (largeREindex > 0) - largeRE[largeREindex++] = '|'; - largeRE[largeREindex++] = '('; - for (char * t = wl->key; *t != '\0'; t++) - largeRE[largeREindex++] = *t; - largeRE[largeREindex++] = ')'; + if (largeREindex > 0) { + largeRE[largeREindex] = '|'; + ++largeREindex; + } + largeRE[largeREindex] = '('; + ++largeREindex; + for (char * t = wl->key; *t != '\0'; ++t) { + largeRE[largeREindex] = *t; + ++largeREindex; + } + largeRE[largeREindex] = ')'; + ++largeREindex; largeRE[largeREindex] = '\0'; - numREs++; + ++numREs; } else { debugs(28, 2, "compileOptimisedREs: buffer full, generating new optimised RE..." ); newlistp = compileRE( newlistp, largeRE, flags ); diff -u -r -N squid-3.2.0.18/src/adaptation/icap/icap_log.cc squid-3.2.0.19/src/adaptation/icap/icap_log.cc --- squid-3.2.0.18/src/adaptation/icap/icap_log.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/adaptation/icap/icap_log.cc 2012-08-03 00:14:34.000000000 +1200 @@ -44,7 +44,7 @@ } } -void icapLogLog(AccessLogEntry *al, ACLChecklist * checklist) +void icapLogLog(AccessLogEntry::Pointer &al, ACLChecklist * checklist) { if (IcapLogfileStatus == LOG_ENABLE) accessLogLogTo(Config.Log.icaplogs, al, checklist); diff -u -r -N squid-3.2.0.18/src/adaptation/icap/icap_log.h squid-3.2.0.19/src/adaptation/icap/icap_log.h --- squid-3.2.0.18/src/adaptation/icap/icap_log.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/adaptation/icap/icap_log.h 2012-08-03 00:14:34.000000000 +1200 @@ -1,13 +1,16 @@ #ifndef ICAP_LOG_H_ #define ICAP_LOG_H_ +#include "RefCount.h" + +typedef RefCount AccessLogEntryPointer; class AccessLogEntry; class ACLChecklist; void icapLogClose(); void icapLogOpen(); void icapLogRotate(); -void icapLogLog(AccessLogEntry *al, ACLChecklist * checklist); +void icapLogLog(AccessLogEntryPointer &al, ACLChecklist * checklist); extern int IcapLogfileStatus; diff -u -r -N squid-3.2.0.18/src/adaptation/icap/ModXact.cc squid-3.2.0.19/src/adaptation/icap/ModXact.cc --- squid-3.2.0.18/src/adaptation/icap/ModXact.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/adaptation/icap/ModXact.cc 2012-08-03 00:14:34.000000000 +1200 @@ -1249,7 +1249,7 @@ Adaptation::Icap::Xaction::swanSong(); } -void prepareLogWithRequestDetails(HttpRequest *, AccessLogEntry *); +void prepareLogWithRequestDetails(HttpRequest *, AccessLogEntry::Pointer &); void Adaptation::Icap::ModXact::finalizeLogInfo() { @@ -1313,7 +1313,7 @@ packerClean(&p); mb.clean(); } - prepareLogWithRequestDetails(request_, &al); + prepareLogWithRequestDetails(request_, alep); Xaction::finalizeLogInfo(); } diff -u -r -N squid-3.2.0.18/src/adaptation/icap/ServiceRep.cc squid-3.2.0.19/src/adaptation/icap/ServiceRep.cc --- squid-3.2.0.18/src/adaptation/icap/ServiceRep.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/adaptation/icap/ServiceRep.cc 2012-08-03 00:14:34.000000000 +1200 @@ -209,7 +209,7 @@ void Adaptation::Icap::ServiceRep::noteGoneWaiter() { - theAllWaiters--; + --theAllWaiters; // in case the notified transaction did not take the connection slot busyCheckpoint(); diff -u -r -N squid-3.2.0.18/src/adaptation/icap/Xaction.cc squid-3.2.0.19/src/adaptation/icap/Xaction.cc --- squid-3.2.0.18/src/adaptation/icap/Xaction.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/adaptation/icap/Xaction.cc 2012-08-03 00:14:34.000000000 +1200 @@ -40,7 +40,9 @@ isRetriable(true), isRepeatable(true), ignoreLastWrite(false), - connector(NULL), reader(NULL), writer(NULL), closer(NULL) + connector(NULL), reader(NULL), writer(NULL), closer(NULL), + alep(new AccessLogEntry), + al(*alep) { debugs(93,3, typeName << " constructed, this=" << this << " [icapx" << id << ']'); // we should not call virtual status() here @@ -540,9 +542,8 @@ ACLChecklist *checklist = new ACLFilledChecklist(::Config.accessList.icap, al.request, dash_str); if (!::Config.accessList.icap || checklist->fastCheck() == ACCESS_ALLOWED) { finalizeLogInfo(); - icapLogLog(&al, checklist); + icapLogLog(alep, checklist); } - accessLogFreeMemory(&al); delete checklist; } } diff -u -r -N squid-3.2.0.18/src/adaptation/icap/Xaction.h squid-3.2.0.19/src/adaptation/icap/Xaction.h --- squid-3.2.0.18/src/adaptation/icap/Xaction.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/adaptation/icap/Xaction.h 2012-08-03 00:14:34.000000000 +1200 @@ -180,7 +180,8 @@ AsyncCall::Pointer writer; AsyncCall::Pointer closer; - AccessLogEntry al; + AccessLogEntry::Pointer alep; ///< icap.log entry + AccessLogEntry &al; ///< short for *alep timeval icap_tr_start; /*time when the ICAP transaction was created */ timeval icap_tio_start; /*time when the first ICAP request byte was scheduled for sending*/ diff -u -r -N squid-3.2.0.18/src/auth/basic/UserRequest.cc squid-3.2.0.19/src/auth/basic/UserRequest.cc --- squid-3.2.0.18/src/auth/basic/UserRequest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/auth/basic/UserRequest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -143,8 +143,10 @@ debugs(29, 5, HERE << "{" << (reply ? reply : "") << "}"); if (reply) { - if ((t = strchr(reply, ' '))) - *t++ = '\0'; + if ((t = strchr(reply, ' '))) { + *t = '\0'; + ++t; + } if (*reply == '\0') reply = NULL; diff -u -r -N squid-3.2.0.18/src/auth/digest/auth_digest.cc squid-3.2.0.19/src/auth/digest/auth_digest.cc --- squid-3.2.0.18/src/auth/digest/auth_digest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/auth/digest/auth_digest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -320,7 +320,7 @@ assert(nonce != NULL); if (nonce->references > 0) { - nonce->references--; + -- nonce->references; } else { debugs(29, 1, "authDigestNonceUnlink; Attempt to lower nonce " << nonce << " refcount below 0!"); } @@ -809,7 +809,8 @@ size_t nlen; size_t vlen; if ((p = (const char *)memchr(item, '=', ilen)) && (p - item < ilen)) { - nlen = p++ - item; + nlen = p - item; + ++p; vlen = ilen - (p - item); } else { nlen = ilen; diff -u -r -N squid-3.2.0.18/src/auth/digest/UserRequest.cc squid-3.2.0.19/src/auth/digest/UserRequest.cc --- squid-3.2.0.18/src/auth/digest/UserRequest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/auth/digest/UserRequest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -279,8 +279,10 @@ debugs(29, 9, HERE << "{" << (reply ? reply : "") << "}"); if (reply) { - if ((t = strchr(reply, ' '))) - *t++ = '\0'; + if ((t = strchr(reply, ' '))) { + *t = '\0'; + ++t; + } if (*reply == '\0' || *reply == '\n') reply = NULL; diff -u -r -N squid-3.2.0.18/src/auth/negotiate/UserRequest.cc squid-3.2.0.19/src/auth/negotiate/UserRequest.cc --- squid-3.2.0.18/src/auth/negotiate/UserRequest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/auth/negotiate/UserRequest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -270,7 +270,7 @@ blob = strchr(reply, ' '); if (blob) { - blob++; + ++blob; arg = strchr(blob + 1, ' '); } else { arg = NULL; @@ -278,8 +278,10 @@ if (strncasecmp(reply, "TT ", 3) == 0) { /* we have been given a blob to send to the client */ - if (arg) - *arg++ = '\0'; + if (arg) { + *arg = '\0'; + ++arg; + } safe_free(lm_request->server_blob); lm_request->request->flags.must_keepalive = 1; if (lm_request->request->flags.proxy_keepalive) { @@ -294,8 +296,10 @@ } else if (strncasecmp(reply, "AF ", 3) == 0 && arg != NULL) { /* we're finished, release the helper */ - if (arg) - *arg++ = '\0'; + if (arg) { + *arg = '\0'; + ++arg; + } auth_user_request->user()->username(arg); auth_user_request->denyMessage("Login successful"); @@ -334,8 +338,10 @@ } else if (strncasecmp(reply, "NA ", 3) == 0 && arg != NULL) { /* authentication failure (wrong password, etc.) */ - if (arg) - *arg++ = '\0'; + if (arg) { + *arg = '\0'; + ++arg; + } auth_user_request->denyMessage(arg); auth_user_request->user()->credentials(Auth::Failed); diff -u -r -N squid-3.2.0.18/src/auth/User.cc squid-3.2.0.19/src/auth/User.cc --- squid-3.2.0.18/src/auth/User.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/auth/User.cc 2012-08-03 00:14:34.000000000 +1200 @@ -111,7 +111,7 @@ dlinkDelete(&new_ipdata->node, &(from->ip_list)); cbdataFree(new_ipdata); /* catch incipient underflow */ - from->ipcount--; + -- from->ipcount; } else { /* add to our list. replace if already present. */ AuthUserIP *ipdata = static_cast(ip_list.head->data); @@ -131,7 +131,7 @@ cbdataFree(ipdata); /* catch incipient underflow */ assert(ipcount); - ipcount--; + -- ipcount; } ipdata = tempnode; @@ -257,7 +257,7 @@ cbdataFree(ipdata); /* catch incipient underflow */ assert(ipcount); - ipcount--; + -- ipcount; ipdata = tempnode; } @@ -279,7 +279,7 @@ cbdataFree(ipdata); /* catch incipient underflow */ assert(ipcount); - ipcount--; + -- ipcount; return; } @@ -316,7 +316,7 @@ cbdataFree(ipdata); /* catch incipient underflow */ assert(ipcount); - ipcount--; + -- ipcount; } ipdata = tempnode; diff -u -r -N squid-3.2.0.18/src/base/AsyncCall.cc squid-3.2.0.19/src/base/AsyncCall.cc --- squid-3.2.0.18/src/base/AsyncCall.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/base/AsyncCall.cc 2012-08-03 00:14:34.000000000 +1200 @@ -47,9 +47,10 @@ bool AsyncCall::cancel(const char *reason) { - if (isCanceled) - debugs(debugSection, debugLevel, HERE << "will not call " << name << - " [" << id << ']' << " also because " << reason); + debugs(debugSection, debugLevel, HERE << "will not call " << name << + " [" << id << "] " << (isCanceled ? "also " : "") << + "because " << reason); + isCanceled = reason; return false; } diff -u -r -N squid-3.2.0.18/src/base/TextException.cc squid-3.2.0.19/src/base/TextException.cc --- squid-3.2.0.18/src/base/TextException.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/base/TextException.cc 2012-08-03 00:14:34.000000000 +1200 @@ -51,13 +51,14 @@ s = strrchr(fname, '/'); if (s) - s++; + ++s; else s = fname; while (*s) { - j++; - n ^= 271 * (unsigned) *s++; + ++j; + n ^= 271 * (unsigned) *s; + ++s; } i = n ^ (j * 271); /*18bits of a 32 bit integer used for filename hash (max hash=262143), diff -u -r -N squid-3.2.0.18/src/cache_cf.cc squid-3.2.0.19/src/cache_cf.cc --- squid-3.2.0.18/src/cache_cf.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/cache_cf.cc 2012-08-03 00:14:34.000000000 +1200 @@ -169,12 +169,13 @@ void requirePathnameExists(const char *name, const char *path); static OBJH dump_config; #if USE_HTTP_VIOLATIONS -static void dump_http_header_access(StoreEntry * entry, const char *name, header_mangler header[]); -static void parse_http_header_access(header_mangler header[]); -static void free_http_header_access(header_mangler header[]); -static void dump_http_header_replace(StoreEntry * entry, const char *name, header_mangler header[]); -static void parse_http_header_replace(header_mangler * header); -static void free_http_header_replace(header_mangler * header); +static void free_HeaderManglers(HeaderManglers **pm); +static void dump_http_header_access(StoreEntry * entry, const char *name, const HeaderManglers *manglers); +static void parse_http_header_access(HeaderManglers **manglers); +#define free_http_header_access free_HeaderManglers +static void dump_http_header_replace(StoreEntry * entry, const char *name, const HeaderManglers *manglers); +static void parse_http_header_replace(HeaderManglers **manglers); +#define free_http_header_replace free_HeaderManglers #endif static void parse_denyinfo(acl_deny_info_list ** var); static void dump_denyinfo(StoreEntry * entry, const char *name, acl_deny_info_list * var); @@ -225,7 +226,7 @@ int i; int64_t ms = -1; - for (i = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0; i < Config.cacheSwap.n_configured; ++i) { assert (Config.cacheSwap.swapDirs[i].getRaw()); if (dynamic_cast(Config.cacheSwap.swapDirs[i].getRaw())-> @@ -273,7 +274,7 @@ path, xstrerror()); } } - for (i = 0; i < (int)globbuf.gl_pathc; i++) { + for (i = 0; i < (int)globbuf.gl_pathc; ++i) { error_count += parseOneConfigFile(globbuf.gl_pathv[i], depth); } globfree(&globbuf); @@ -431,7 +432,7 @@ Vector if_states; while (fgets(config_input_line, BUFSIZ, fp)) { - config_lineno++; + ++config_lineno; if ((token = strchr(config_input_line, '\n'))) *token = '\0'; @@ -455,7 +456,7 @@ continue; /* Not a valid #line directive, may be a comment */ while (*file && xisspace((unsigned char) *file)) - file++; + ++file; if (*file) { if (*file != '"') @@ -516,7 +517,7 @@ err_count += parseManyConfigFiles(tmp_line + 8, depth + 1); } else if (!parse_line(tmp_line)) { debugs(3, 0, HERE << cfg_filename << ":" << config_lineno << " unrecognized: '" << tmp_line << "'"); - err_count++; + ++err_count; } } @@ -810,7 +811,7 @@ // TODO: replace with a dedicated "purge" ACL option? Config2.onoff.enable_purge = (ACLMethodData::ThePurgeCount > 0); - Config2.onoff.mangle_request_headers = httpReqHdrManglersConfigured(); + Config2.onoff.mangle_request_headers = (Config.request_header_access != NULL); if (geteuid() == 0) { if (NULL != Config.effectiveUser) { @@ -1176,7 +1177,7 @@ char const * number_end = value; while ((*number_end >= '0' && *number_end <= '9')) { - number_end++; + ++number_end; } String number; @@ -1675,23 +1676,15 @@ #if USE_HTTP_VIOLATIONS static void -dump_http_header_access(StoreEntry * entry, const char *name, header_mangler header[]) +dump_http_header_access(StoreEntry * entry, const char *name, const HeaderManglers *manglers) { - int i; - - for (i = 0; i < HDR_ENUM_END; i++) { - if (header[i].access_list != NULL) { - storeAppendPrintf(entry, "%s ", name); - dump_acl_access(entry, httpHeaderNameById(i), - header[i].access_list); - } - } + if (manglers) + manglers->dumpAccess(entry, name); } static void -parse_http_header_access(header_mangler header[]) +parse_http_header_access(HeaderManglers **pm) { - int id, i; char *t = NULL; if ((t = strtok(NULL, w_space)) == NULL) { @@ -1700,64 +1693,34 @@ return; } - /* Now lookup index of header. */ - id = httpHeaderIdByNameDef(t, strlen(t)); - - if (strcmp(t, "All") == 0) - id = HDR_ENUM_END; - else if (strcmp(t, "Other") == 0) - id = HDR_OTHER; - else if (id == -1) { - debugs(3, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line); - debugs(3, 0, "parse_http_header_access: unknown header name '" << t << "'"); - return; - } - - if (id != HDR_ENUM_END) { - parse_acl_access(&header[id].access_list); - } else { - char *next_string = t + strlen(t) - 1; - *next_string = 'A'; - *(next_string + 1) = ' '; - - for (i = 0; i < HDR_ENUM_END; i++) { - char *new_string = xstrdup(next_string); - strtok(new_string, w_space); - parse_acl_access(&header[i].access_list); - safe_free(new_string); - } - } + if (!*pm) + *pm = new HeaderManglers; + HeaderManglers *manglers = *pm; + header_mangler *mangler = manglers->track(t); + assert(mangler); + parse_acl_access(&mangler->access_list); } static void -free_http_header_access(header_mangler header[]) +free_HeaderManglers(HeaderManglers **pm) { - int i; - - for (i = 0; i < HDR_ENUM_END; i++) { - free_acl_access(&header[i].access_list); + // we delete the entire http_header_* mangler configuration at once + if (const HeaderManglers *manglers = *pm) { + delete manglers; + *pm = NULL; } } static void -dump_http_header_replace(StoreEntry * entry, const char *name, header_mangler - header[]) +dump_http_header_replace(StoreEntry * entry, const char *name, const HeaderManglers *manglers) { - int i; - - for (i = 0; i < HDR_ENUM_END; i++) { - if (NULL == header[i].replacement) - continue; - - storeAppendPrintf(entry, "%s %s %s\n", name, httpHeaderNameById(i), - header[i].replacement); - } + if (manglers) + manglers->dumpReplacement(entry, name); } static void -parse_http_header_replace(header_mangler header[]) +parse_http_header_replace(HeaderManglers **pm) { - int id, i; char *t = NULL; if ((t = strtok(NULL, w_space)) == NULL) { @@ -1766,44 +1729,12 @@ return; } - /* Now lookup index of header. */ - id = httpHeaderIdByNameDef(t, strlen(t)); + const char *value = t + strlen(t) + 1; - if (strcmp(t, "All") == 0) - id = HDR_ENUM_END; - else if (strcmp(t, "Other") == 0) - id = HDR_OTHER; - else if (id == -1) { - debugs(3, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line); - debugs(3, 0, "parse_http_header_replace: unknown header name " << t << "."); - - return; - } - - if (id != HDR_ENUM_END) { - if (header[id].replacement != NULL) - safe_free(header[id].replacement); - - header[id].replacement = xstrdup(t + strlen(t) + 1); - } else { - for (i = 0; i < HDR_ENUM_END; i++) { - if (header[i].replacement != NULL) - safe_free(header[i].replacement); - - header[i].replacement = xstrdup(t + strlen(t) + 1); - } - } -} - -static void -free_http_header_replace(header_mangler header[]) -{ - int i; - - for (i = 0; i < HDR_ENUM_END; i++) { - if (header[i].replacement != NULL) - safe_free(header[i].replacement); - } + if (!*pm) + *pm = new HeaderManglers; + HeaderManglers *manglers = *pm; + manglers->setReplacement(t, value); } #endif @@ -1815,7 +1746,7 @@ int i; assert (entry); - for (i = 0; i < swap.n_configured; i++) { + for (i = 0; i < swap.n_configured; ++i) { s = dynamic_cast(swap.swapDirs[i].getRaw()); if (!s) continue; storeAppendPrintf(entry, "%s %s %s", name, s->type(), s->path); @@ -1924,7 +1855,7 @@ /* reconfigure existing dir */ - for (i = 0; i < swap->n_configured; i++) { + for (i = 0; i < swap->n_configured; ++i) { assert (swap->swapDirs[i].getRaw()); if ((strcasecmp(path_str, dynamic_cast(swap->swapDirs[i].getRaw())->path)) == 0) { @@ -2051,7 +1982,7 @@ { if (len < 1) return false; - for (; len >0 && *str; str++, len--) { + for (; len >0 && *str; ++str, --len) { if (! isdigit(*str)) return false; } @@ -2187,8 +2118,10 @@ char *mode, *nextmode; for (mode = nextmode = tmp; mode; mode = nextmode) { nextmode = strchr(mode, ','); - if (nextmode) - *nextmode++ = '\0'; + if (nextmode) { + *nextmode = '\0'; + ++nextmode; + } if (!strcasecmp(mode, "no-clr")) { if (p->options.htcp_only_clr) fatalf("parse_peer: can't set htcp-no-clr and htcp-only-clr simultaneously"); @@ -2555,7 +2488,7 @@ if (*domain == '!') { /* check for !.edu */ l->do_ping = 0; - domain++; + ++domain; } l->domain = xstrdup(domain); @@ -2997,7 +2930,7 @@ } while (*token && xisspace(*token)) - token++; + ++token; if (!*token) { self_destruct(); @@ -3509,7 +3442,8 @@ debugs(3, DBG_CRITICAL, s->protocol << "_port: missing ']' on IPv6 address: " << token); self_destruct(); } - *t++ = '\0'; + *t = '\0'; + ++t; if (*t != ':') { debugs(3, DBG_CRITICAL, s->protocol << "_port: missing Port in: " << token); self_destruct(); @@ -3695,12 +3629,12 @@ s->tcp_keepalive.idle = atoi(t); t = strchr(t, ','); if (t) { - t++; + ++t; s->tcp_keepalive.interval = atoi(t); t = strchr(t, ','); } if (t) { - t++; + ++t; s->tcp_keepalive.timeout = atoi(t); t = strchr(t, ','); } diff -u -r -N squid-3.2.0.18/src/CacheDigest.cc squid-3.2.0.19/src/CacheDigest.cc --- squid-3.2.0.18/src/CacheDigest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/CacheDigest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -159,35 +159,35 @@ if (!CBIT_TEST(cd->mask, hashed_keys[0])) { CBIT_SET(cd->mask, hashed_keys[0]); - on_xition_cnt++; + ++on_xition_cnt; } if (!CBIT_TEST(cd->mask, hashed_keys[1])) { CBIT_SET(cd->mask, hashed_keys[1]); - on_xition_cnt++; + ++on_xition_cnt; } if (!CBIT_TEST(cd->mask, hashed_keys[2])) { CBIT_SET(cd->mask, hashed_keys[2]); - on_xition_cnt++; + ++on_xition_cnt; } if (!CBIT_TEST(cd->mask, hashed_keys[3])) { CBIT_SET(cd->mask, hashed_keys[3]); - on_xition_cnt++; + ++on_xition_cnt; } statCounter.cd.on_xition_count.count(on_xition_cnt); } #endif - cd->count++; + ++ cd->count; } void cacheDigestDel(CacheDigest * cd, const cache_key * key) { assert(cd && key); - cd->del_count++; + ++ cd->del_count; /* we do not support deletions from the digest */ } @@ -208,16 +208,16 @@ const int is_on = 0 != CBIT_TEST(cd->mask, pos); if (is_on) - on_count++; + ++on_count; if (is_on != cur_seq_type || !pos) { seq_len_sum += cur_seq_len; - seq_count++; + ++seq_count; cur_seq_type = is_on; cur_seq_len = 0; } - cur_seq_len++; + ++cur_seq_len; } stats->bit_count = cd->mask_size * 8; diff -u -r -N squid-3.2.0.18/src/carp.cc squid-3.2.0.19/src/carp.cc --- squid-3.2.0.18/src/carp.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/carp.cc 2012-08-03 00:14:34.000000000 +1200 @@ -72,7 +72,7 @@ char *t; /* Clean up */ - for (k = 0; k < n_carp_peers; k++) { + for (k = 0; k < n_carp_peers; ++k) { cbdataReferenceDone(carp_peers[k]); } @@ -93,7 +93,7 @@ if (p->weight == 0) continue; - n_carp_peers++; + ++n_carp_peers; W += p->weight; } @@ -114,7 +114,7 @@ /* calculate this peers hash */ p->carp.hash = 0; - for (t = p->name; *t != 0; t++) + for (t = p->name; *t != 0; ++t) p->carp.hash += ROTATE_LEFT(p->carp.hash, 19) + (unsigned int) *t; p->carp.hash += p->carp.hash * 0x62531965; @@ -128,7 +128,8 @@ p->carp.load_factor = 0.0; /* add it to our list of peers */ - *P++ = cbdataReference(p); + *P = cbdataReference(p); + ++P; } /* Sort our list on weight */ @@ -150,7 +151,7 @@ X_last = 0.0; /* Empty X_0, nullifies the first pow statement */ - for (k = 1; k <= K; k++) { + for (k = 1; k <= K; ++k) { double Kk1 = (double) (K - k + 1); p = carp_peers[k - 1]; p->carp.load_multiplier = (Kk1 * (p->carp.load_factor - P_last)) / Xn; @@ -180,7 +181,7 @@ debugs(39, 2, "carpSelectParent: Calculating hash for " << urlCanonical(request)); /* select peer */ - for (k = 0; k < n_carp_peers; k++) { + for (k = 0; k < n_carp_peers; ++k) { String key; tp = carp_peers[k]; if (tp->options.carp_key.set) { @@ -221,7 +222,7 @@ if (key.size()==0) key=urlCanonical(request); - for (const char *c = key.rawBuf(), *e=key.rawBuf()+key.size(); c < e; c++) + for (const char *c = key.rawBuf(), *e=key.rawBuf()+key.size(); c < e; ++c) user_hash += ROTATE_LEFT(user_hash, 19) + *c; combined_hash = (user_hash ^ tp->carp.hash); combined_hash += combined_hash * 0x62531965; diff -u -r -N squid-3.2.0.18/src/cbdata.cc squid-3.2.0.19/src/cbdata.cc --- squid-3.2.0.18/src/cbdata.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/cbdata.cc 2012-08-03 00:14:34.000000000 +1200 @@ -310,7 +310,7 @@ c->valid = 1; c->locks = 0; c->cookie = (long) c ^ cbdata::Cookie; - cbdataCount++; + ++cbdataCount; #if USE_CBDATA_DEBUG c->file = file; @@ -319,6 +319,8 @@ c->addHistory("Alloc", file, line); dlinkAdd(c, &c->link, &cbdataEntries); debugs(45, 3, "cbdataAlloc: " << p << " " << file << ":" << line); +#else + debugs(45, 9, "cbdataAlloc: " << p); #endif return p; @@ -358,7 +360,7 @@ return NULL; } - cbdataCount--; + --cbdataCount; debugs(45, 9, "cbdataFree: Freeing " << p); #if USE_CBDATA_DEBUG @@ -421,7 +423,7 @@ assert(c->locks < INT_MAX); - c->locks++; + ++ c->locks; } void @@ -460,12 +462,12 @@ assert(c->locks > 0); - c->locks--; + -- c->locks; if (c->valid || c->locks) return; - cbdataCount--; + --cbdataCount; debugs(45, 9, "cbdataUnlock: Freeing " << p); @@ -583,7 +585,7 @@ storeAppendPrintf(sentry, "\n"); storeAppendPrintf(sentry, "types\tsize\tallocated\ttotal\n"); - for (int i = 1; i < cbdata_types; i++) { + for (int i = 1; i < cbdata_types; ++i) { MemAllocator *pool = cbdata_index[i].pool; if (pool) { diff -u -r -N squid-3.2.0.18/src/cf.data.pre squid-3.2.0.19/src/cf.data.pre --- squid-3.2.0.18/src/cf.data.pre 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/cf.data.pre 2012-08-03 00:14:34.000000000 +1200 @@ -1780,30 +1780,15 @@ * Intercepted traffic which passes verification is handled normally. - For now it also forces suspicious requests to go DIRECT to the - original destination, overriding client_dst_passthru for - intercepted requests which fail Host: verification. + * Intercepted requests which fail verification are sent + to the client original destination instead of DIRECT. + This overrides 'client_dst_passthru off'. For now suspicious intercepted CONNECT requests are always responded to with an HTTP 409 (Conflict) error page. -DOC_END - -NAME: client_dst_passthru -TYPE: onoff -DEFAULT: on -LOC: Config.onoff.client_dst_passthru -DOC_START - With NAT or TPROXY intercepted traffic Squid may pass the request - directly to the original client destination IP or seek a faster - source. - - This option (on by default) prevents cache_peer and alternative DNS - entries being used on intercepted traffic. Both of which lead to - the security vulnerability outlined below. - SECURITY WARNING: - This directive should only be disabled if cache_peer are required. + SECURITY NOTE: As described in CVE-2009-0801 when the Host: header alone is used to determine the destination of a request it becomes trivial for @@ -1815,7 +1800,32 @@ sandbox only verifies that the applet tries to contact the same IP as from where it was loaded at the IP level. The Host: header may be different from the connected IP and approved origin. + +DOC_END +NAME: client_dst_passthru +TYPE: onoff +DEFAULT: on +LOC: Config.onoff.client_dst_passthru +DOC_START + With NAT or TPROXY intercepted traffic Squid may pass the request + directly to the original client destination IP or seek a faster + source using the HTTP Host header. + + Using Host to locate alternative servers can provide faster + connectivity with a range of failure recovery options. + But can also lead to connectivity trouble when the client and + server are attempting stateful interactions unaware of the proxy. + + This option (on by default) prevents alternative DNS entries being + located to send intercepted traffic DIRECT to an origin server. + The clients original destination IP and port will be used instead. + + Regardless of this option setting, when dealing with intercepted + traffic Squid will verify the Host: header and any traffic which + fails Host verification will be treated as if this option were ON. + + see host_verify_strict for details on the verification process. DOC_END COMMENT_START @@ -4390,7 +4400,7 @@ NAME: request_header_access IFDEF: USE_HTTP_VIOLATIONS -TYPE: http_header_access[] +TYPE: http_header_access LOC: Config.request_header_access DEFAULT: none DOC_START @@ -4402,16 +4412,30 @@ This option replaces the old 'anonymize_headers' and the older 'http_anonymizer' option with something that is much - more configurable. This new method creates a list of ACLs - for each header, allowing you very fine-tuned header - mangling. - - This option only applies to request headers, i.e., from the - client to the server. - - You can only specify known headers for the header name. - Other headers are reclassified as 'Other'. You can also - refer to all the headers with 'All'. + more configurable. A list of ACLs for each header name allows + removal of specific header fields under specific conditions. + + This option only applies to outgoing HTTP request headers (i.e., + headers sent by Squid to the next HTTP hop such as a cache peer + or an origin server). The option has no effect during cache hit + detection. The equivalent adaptation vectoring point in ICAP + terminology is post-cache REQMOD. + + The option is applied to individual outgoing request header + fields. For each request header field F, Squid uses the first + qualifying sets of request_header_access rules: + + 1. Rules with header_name equal to F's name. + 2. Rules with header_name 'Other', provided F's name is not + on the hard-coded list of commonly used HTTP header names. + 3. Rules with header_name 'All'. + + Within that qualifying rule set, rule ACLs are checked as usual. + If ACLs of an "allow" rule match, the header field is allowed to + go through as is. If ACLs of a "deny" rule match, the header is + removed and request_header_replace is then checked to identify + if the removed header has a replacement. If no rules within the + set have matching ACLs, the header field is left as is. For example, to achieve the same behavior as the old 'http_anonymizer standard' option, you should use: @@ -4462,7 +4486,7 @@ NAME: reply_header_access IFDEF: USE_HTTP_VIOLATIONS -TYPE: http_header_access[] +TYPE: http_header_access LOC: Config.reply_header_access DEFAULT: none DOC_START @@ -4476,17 +4500,8 @@ server to the client. This is the same as request_header_access, but in the other - direction. - - This option replaces the old 'anonymize_headers' and the - older 'http_anonymizer' option with something that is much - more configurable. This new method creates a list of ACLs - for each header, allowing you very fine-tuned header - mangling. - - You can only specify known headers for the header name. - Other headers are reclassified as 'Other'. You can also - refer to all the headers with 'All'. + direction. Please see request_header_access for detailed + documentation. For example, to achieve the same behavior as the old 'http_anonymizer standard' option, you should use: @@ -4537,7 +4552,7 @@ NAME: request_header_replace header_replace IFDEF: USE_HTTP_VIOLATIONS -TYPE: http_header_replace[] +TYPE: http_header_replace LOC: Config.request_header_access DEFAULT: none DOC_START @@ -4556,7 +4571,7 @@ NAME: reply_header_replace IFDEF: USE_HTTP_VIOLATIONS -TYPE: http_header_replace[] +TYPE: http_header_replace LOC: Config.reply_header_access DEFAULT: none DOC_START diff -u -r -N squid-3.2.0.18/src/cf_gen.cc squid-3.2.0.19/src/cf_gen.cc --- squid-3.2.0.18/src/cf_gen.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/cf_gen.cc 2012-08-03 00:14:34.000000000 +1200 @@ -247,7 +247,7 @@ while (fp.getline(buff,MAX_LINE), fp.good() && state != sEXIT) { char *t; - linenum++; + ++linenum; if ((t = strchr(buff, '\n'))) *t = '\0'; @@ -297,28 +297,28 @@ ptr = buff + 8; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.comment = ptr; } else if (!strncmp(buff, "DEFAULT:", 8)) { ptr = buff + 8; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.defaults.preset.push_back(ptr); } else if (!strncmp(buff, "DEFAULT_IF_NONE:", 16)) { ptr = buff + 16; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.defaults.if_none.push_back(ptr); } else if (!strncmp(buff, "DEFAULT_DOC:", 12)) { ptr = buff + 12; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.defaults.docs.push_back(ptr); } else if (!strncmp(buff, "LOC:", 4)) { @@ -384,7 +384,6 @@ assert(0); /* should never get here */ break; } - } if (state != sEXIT) { @@ -677,7 +676,7 @@ if (!name.size()) return true; - for (int i = 0; defines[i].name; i++) { + for (int i = 0; defines[i].name; ++i) { if (name.compare(defines[i].name) == 0) return defines[i].defined; } @@ -690,7 +689,7 @@ { assert(name.size()); - for (int i = 0; defines[i].name; i++) { + for (int i = 0; defines[i].name; ++i) { if (name.compare(defines[i].name) == 0) return defines[i].enable; } diff -u -r -N squid-3.2.0.18/src/client_db.cc squid-3.2.0.19/src/client_db.cc --- squid-3.2.0.18/src/client_db.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/client_db.cc 2012-08-03 00:14:34.000000000 +1200 @@ -96,7 +96,7 @@ ++statCounter.client_http.clients; if ((statCounter.client_http.clients > max_clients) && !cleanup_running && cleanup_scheduled < 2) { - cleanup_scheduled++; + ++cleanup_scheduled; eventAdd("client_db garbage collector", clientdbScheduledGC, NULL, 90, 0); } @@ -163,15 +163,15 @@ debug_trap("clientdbUpdate: Failed to add entry"); if (p == AnyP::PROTO_HTTP) { - c->Http.n_requests++; - c->Http.result_hist[ltype]++; + ++ c->Http.n_requests; + ++ c->Http.result_hist[ltype]; kb_incr(&c->Http.kbytes_out, size); if (logTypeIsATcpHit(ltype)) kb_incr(&c->Http.hit_kbytes_out, size); } else if (p == AnyP::PROTO_ICP) { - c->Icp.n_requests++; - c->Icp.result_hist[ltype]++; + ++ c->Icp.n_requests; + ++ c->Icp.result_hist[ltype]; kb_incr(&c->Icp.kbytes_out, size); if (LOG_UDP_HIT == ltype) @@ -407,7 +407,7 @@ --statCounter.client_http.clients; - cleanup_removed++; + ++cleanup_removed; } if (bucket < CLIENT_DB_HASH_SIZE) diff -u -r -N squid-3.2.0.18/src/ClientDelayConfig.cc squid-3.2.0.19/src/ClientDelayConfig.cc --- squid-3.2.0.18/src/ClientDelayConfig.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ClientDelayConfig.cc 2012-08-03 00:14:34.000000000 +1200 @@ -38,7 +38,7 @@ { if (pools.size()) { storeAppendPrintf(entry, "%s %d\n", name, (int)pools.size()); - for (unsigned int i = 0; i < pools.size(); i++) + for (unsigned int i = 0; i < pools.size(); ++i) pools[i].dump(entry, i); } } @@ -51,7 +51,7 @@ } unsigned short pools_; ConfigParser::ParseUShort(&pools_); - for (int i = 0; i < pools_; i++) { + for (int i = 0; i < pools_; ++i) { pools.push_back(ClientDelayPool()); } } @@ -66,7 +66,7 @@ return; } - pool--; + --pool; pools[pool].rate = GetInteger(); pools[pool].highwatermark = GetInteger64(); @@ -89,7 +89,7 @@ void ClientDelayConfig::clean() { - for (unsigned int i = 0; i < pools.size(); i++) { + for (unsigned int i = 0; i < pools.size(); ++i) { aclDestroyAccessList(&pools[i].access); } } diff -u -r -N squid-3.2.0.18/src/client_side.cc squid-3.2.0.19/src/client_side.cc --- squid-3.2.0.18/src/client_side.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/client_side.cc 2012-08-03 00:14:34.000000000 +1200 @@ -214,7 +214,7 @@ static void clientUpdateStatCounters(log_type logType); static void clientUpdateHierCounters(HierarchyLogEntry *); static bool clientPingHasFinished(ping_data const *aPing); -void prepareLogWithRequestDetails(HttpRequest *, AccessLogEntry *); +void prepareLogWithRequestDetails(HttpRequest *, AccessLogEntry::Pointer &); #ifndef PURIFY static bool connIsUsable(ConnStateData * conn); #endif @@ -499,7 +499,7 @@ case CD_PARENT_HIT: case CD_SIBLING_HIT: - statCounter.cd.times_used++; + ++ statCounter.cd.times_used; break; #endif @@ -510,21 +510,21 @@ case FIRST_PARENT_MISS: case CLOSEST_PARENT_MISS: - statCounter.icp.times_used++; + ++ statCounter.icp.times_used; i = &someEntry->ping; if (clientPingHasFinished(i)) statCounter.icp.querySvcTime.count(tvSubUsec(i->start, i->stop)); if (i->timeout) - statCounter.icp.query_timeouts++; + ++ statCounter.icp.query_timeouts; break; case CLOSEST_PARENT: case CLOSEST_DIRECT: - statCounter.netdb.times_used++; + ++ statCounter.netdb.times_used; break; @@ -539,7 +539,7 @@ clientUpdateStatCounters(logType); if (request->errType != ERR_NONE) - statCounter.client_http.errors++; + ++ statCounter.client_http.errors; clientUpdateStatHistCounters(logType, tvSubMsec(start_time, current_time)); @@ -548,10 +548,10 @@ } void -prepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry * aLogEntry) +prepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry::Pointer &aLogEntry) { assert(request); - assert(aLogEntry); + assert(aLogEntry != NULL); if (Config.onoff.log_mime_hdrs) { Packer p; @@ -622,47 +622,47 @@ if (!out.size && !logType) debugs(33, 5, HERE << "logging half-baked transaction: " << log_uri); - al.icp.opcode = ICP_INVALID; - al.url = log_uri; - debugs(33, 9, "clientLogRequest: al.url='" << al.url << "'"); - - if (al.reply) { - al.http.code = al.reply->sline.status; - al.http.content_type = al.reply->content_type.termedBuf(); + al->icp.opcode = ICP_INVALID; + al->url = log_uri; + debugs(33, 9, "clientLogRequest: al.url='" << al->url << "'"); + + if (al->reply) { + al->http.code = al->reply->sline.status; + 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.termedBuf(); + al->http.code = loggingEntry()->mem_obj->getReply()->sline.status; + al->http.content_type = loggingEntry()->mem_obj->getReply()->content_type.termedBuf(); } - debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'"); + debugs(33, 9, "clientLogRequest: http.code='" << al->http.code << "'"); if (loggingEntry() && loggingEntry()->mem_obj) - al.cache.objectSize = loggingEntry()->contentLen(); + al->cache.objectSize = loggingEntry()->contentLen(); - al.cache.caddr.SetNoAddr(); + al->cache.caddr.SetNoAddr(); if (getConn() != NULL) { - al.cache.caddr = getConn()->log_addr; - al.cache.port = cbdataReference(getConn()->port); + al->cache.caddr = getConn()->log_addr; + al->cache.port = cbdataReference(getConn()->port); } - al.cache.requestSize = req_sz; - al.cache.requestHeadersSize = req_sz; + al->cache.requestSize = req_sz; + al->cache.requestHeadersSize = req_sz; - al.cache.replySize = out.size; - al.cache.replyHeadersSize = out.headers_sz; + al->cache.replySize = out.size; + al->cache.replyHeadersSize = out.headers_sz; - al.cache.highOffset = out.offset; + al->cache.highOffset = out.offset; - al.cache.code = logType; + al->cache.code = logType; - al.cache.msec = tvSubMsec(start_time, current_time); + al->cache.msec = tvSubMsec(start_time, current_time); if (request) - prepareLogWithRequestDetails(request, &al); + prepareLogWithRequestDetails(request, al); if (getConn() != NULL && getConn()->clientConnection != NULL && getConn()->clientConnection->rfc931[0]) - al.cache.rfc931 = getConn()->clientConnection->rfc931; + al->cache.rfc931 = getConn()->clientConnection->rfc931; #if USE_SSL && 0 @@ -670,19 +670,19 @@ * to snarf the ssl details some place earlier.. */ if (getConn() != NULL) - al.cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl); + al->cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl); #endif ACLFilledChecklist *checklist = clientAclChecklistCreate(Config.accessList.log, this); - if (al.reply) - checklist->reply = HTTPMSGLOCK(al.reply); + if (al->reply) + checklist->reply = HTTPMSGLOCK(al->reply); if (!Config.accessList.log || checklist->fastCheck() == ACCESS_ALLOWED) { if (request) - al.adapted_request = HTTPMSGLOCK(request); - accessLogLog(&al, checklist); + al->adapted_request = HTTPMSGLOCK(request); + accessLogLog(al, checklist); updateCounters(); if (getConn() != NULL && getConn()->clientConnection != NULL) @@ -690,8 +690,6 @@ } delete checklist; - - accessLogFreeMemory(&al); } void @@ -1441,7 +1439,7 @@ context->sendBody(rep, receivedData); else { assert(rep); - http->al.reply = HTTPMSGLOCK(rep); + http->al->reply = HTTPMSGLOCK(rep); context->sendStartOfMessage(rep, receivedData); } @@ -1787,9 +1785,9 @@ { if (http) { if (xerrno == ETIMEDOUT) - http->al.http.timedout = true; + http->al->http.timedout = true; else // even if xerrno is zero (which means read abort/eof) - http->al.http.aborted = true; + http->al->http.aborted = true; } } @@ -1923,7 +1921,7 @@ assert(end); } - for (; end > uriAndHTTPVersion; end--) { + for (; end > uriAndHTTPVersion; --end) { if (*end == '\n' || *end == '\r') continue; @@ -1974,9 +1972,11 @@ char *q = tmp_uri; t = uri; while (*t) { - if (!xisspace(*t)) - *q++ = *t; - t++; + if (!xisspace(*t)) { + *q = *t; + ++q; + } + ++t; } *q = '\0'; http->log_uri = xstrndup(rfc1738_escape_unescaped(tmp_uri), MAX_URL); @@ -2713,7 +2713,7 @@ { while (conn->in.notYetUsed > 0 && xisspace(conn->in.buf[0])) { memmove(conn->in.buf, conn->in.buf + 1, conn->in.notYetUsed - 1); - --conn->in.notYetUsed; + -- conn->in.notYetUsed; } } @@ -3141,7 +3141,7 @@ ClientHttpRequest *http = static_cast(io.data); debugs(33, DBG_IMPORTANT, "WARNING: Closing client connection due to lifetime timeout"); debugs(33, DBG_IMPORTANT, "\t" << http->uri); - http->al.http.timedout = true; + http->al->http.timedout = true; if (Comm::IsConnOpen(io.conn)) io.conn->close(); } @@ -3224,7 +3224,7 @@ commSetTcpKeepalive(params.conn->fd, s->tcp_keepalive.idle, s->tcp_keepalive.interval, s->tcp_keepalive.timeout); } - incoming_sockets_accepted++; + ++ incoming_sockets_accepted; // Socket is ready, setup the connection manager to start using it ConnStateData *connState = connStateCreate(params.conn, s); @@ -3251,7 +3251,7 @@ ch.src_addr = params.conn->remote; ch.my_addr = params.conn->local; - for (unsigned int pool = 0; pool < pools.size(); pool++) { + for (unsigned int pool = 0; pool < pools.size(); ++pool) { /* pools require explicit 'allow' to assign a client into them */ if (pools[pool].access) { @@ -3450,7 +3450,7 @@ commSetTcpKeepalive(params.conn->fd, s->tcp_keepalive.idle, s->tcp_keepalive.interval, s->tcp_keepalive.timeout); } - incoming_sockets_accepted++; + ++incoming_sockets_accepted; // Socket is ready, setup the connection manager to start using it ConnStateData *connState = connStateCreate(params.conn, s); @@ -3621,7 +3621,7 @@ AddOpenedHttpSocket(const Comm::ConnectionPointer &conn) { bool found = false; - for (int i = 0; i < NHttpSockets && !found; i++) { + for (int i = 0; i < NHttpSockets && !found; ++i) { if ((found = HttpSockets[i] < 0)) HttpSockets[i] = conn->fd; } @@ -3671,7 +3671,8 @@ ListeningStartedDialer(&clientListenerConnectionOpened, s, Ipc::fdnHttpSocket, sub)); Ipc::StartListening(SOCK_STREAM, IPPROTO_TCP, s->listenConn, Ipc::fdnHttpSocket, listenCall); - HttpSockets[NHttpSockets++] = -1; // set in clientListenerConnectionOpened + HttpSockets[NHttpSockets] = -1; // set in clientListenerConnectionOpened + ++NHttpSockets; } } @@ -3709,7 +3710,8 @@ ListeningStartedDialer(&clientListenerConnectionOpened, s, Ipc::fdnHttpsSocket, sub)); Ipc::StartListening(SOCK_STREAM, IPPROTO_TCP, s->listenConn, Ipc::fdnHttpsSocket, listenCall); - HttpSockets[NHttpSockets++] = -1; + HttpSockets[NHttpSockets] = -1; + ++NHttpSockets; } } #endif @@ -3772,7 +3774,7 @@ #endif // TODO see if we can drop HttpSockets array entirely */ - for (int i = 0; i < NHttpSockets; i++) { + for (int i = 0; i < NHttpSockets; ++i) { HttpSockets[i] = -1; } diff -u -r -N squid-3.2.0.18/src/client_side_reply.cc squid-3.2.0.19/src/client_side_reply.cc --- squid-3.2.0.18/src/client_side_reply.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/client_side_reply.cc 2012-08-03 00:14:34.000000000 +1200 @@ -117,7 +117,7 @@ /* prevent confusion over whether we default to persistent or not */ http->request->flags.proxy_keepalive = 0; - http->al.http.code = errstate->httpStatus; + http->al->http.code = errstate->httpStatus; createStoreEntry(method, request_flags()); #if USE_AUTH @@ -277,7 +277,7 @@ * this clientReplyContext does */ Comm::ConnectionPointer conn = http->getConn() != NULL ? http->getConn()->clientConnection : NULL; - FwdState::fwdStart(conn, http->storeEntry(), http->request); + FwdState::Start(conn, http->storeEntry(), http->request, http->al); /* Register with storage manager to receive updates when data comes in. */ @@ -633,7 +633,7 @@ /// Deny loops for accelerator and interceptor. TODO: deny in all modes? if (r->flags.loopdetect && (http->flags.accel || http->flags.intercepted)) { - http->al.http.code = HTTP_FORBIDDEN; + http->al->http.code = HTTP_FORBIDDEN; err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, http->getConn()->clientConnection->remote, http->request); createStoreEntry(r->method, request_flags()); errorAppendEntry(http->storeEntry(), err); @@ -662,7 +662,7 @@ /** Start forwarding to get the new object from network */ Comm::ConnectionPointer conn = http->getConn() != NULL ? http->getConn()->clientConnection : NULL; - FwdState::fwdStart(conn, http->storeEntry(), r); + FwdState::Start(conn, http->storeEntry(), r, http->al); } } @@ -677,7 +677,7 @@ { debugs(88, 4, "clientProcessOnlyIfCachedMiss: '" << RequestMethodStr(http->request->method) << " " << http->uri << "'"); - http->al.http.code = HTTP_GATEWAY_TIMEOUT; + http->al->http.code = HTTP_GATEWAY_TIMEOUT; ErrorState *err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL, http->getConn()->clientConnection->remote, http->request); removeClientStoreReference(&sc, http); @@ -2122,9 +2122,9 @@ size_t k; if ((k = headersEnd(buf, reqofs))) { - safe_free(http->al.headers.reply); - http->al.headers.reply = (char *)xcalloc(k + 1, 1); - xstrncpy(http->al.headers.reply, buf, k); + safe_free(http->al->headers.reply); + http->al->headers.reply = (char *)xcalloc(k + 1, 1); + xstrncpy(http->al->headers.reply, buf, k); } } diff -u -r -N squid-3.2.0.18/src/client_side_request.cc squid-3.2.0.19/src/client_side_request.cc --- squid-3.2.0.18/src/client_side_request.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/client_side_request.cc 2012-08-03 00:14:34.000000000 +1200 @@ -176,7 +176,8 @@ { start_time = current_time; setConn(aConn); - al.tcpClient = clientConnection = aConn->clientConnection; + al = new AccessLogEntry; + al->tcpClient = clientConnection = aConn->clientConnection; dlinkAdd(this, &active, &ClientActiveRequests); #if USE_ADAPTATION request_satisfaction_mode = false; @@ -198,7 +199,7 @@ request->cache_control->onlyIfCached(); } -/* +/** * This function is designed to serve a fairly specific purpose. * Occasionally our vBNS-connected caches can talk to each other, but not * the rest of the world. Here we try to detect frequent failures which @@ -210,19 +211,25 @@ * * Duane W., Sept 16, 1996 */ - -#define FAILURE_MODE_TIME 300 - static void checkFailureRatio(err_type etype, hier_code hcode) { - static double magic_factor = 100.0; - double n_good; - double n_bad; + // Can be set at compile time with -D compiler flag +#ifndef FAILURE_MODE_TIME +#define FAILURE_MODE_TIME 300 +#endif if (hcode == HIER_NONE) return; + // don't bother when ICP is disabled. + if (Config.Port.icp <= 0) + return; + + static double magic_factor = 100.0; + double n_good; + double n_bad; + n_good = magic_factor / (1.0 + request_failure_ratio); n_bad = magic_factor - n_good; @@ -235,11 +242,11 @@ case ERR_SECURE_CONNECT_FAIL: case ERR_READ_ERROR: - n_bad++; + ++n_bad; break; default: - n_good++; + ++n_good; } request_failure_ratio = n_bad / n_good; @@ -250,10 +257,10 @@ if (request_failure_ratio < 1.0) return; - debugs(33, 0, "Failure Ratio at "<< std::setw(4)<< + debugs(33, DBG_CRITICAL, "WARNING: Failure Ratio at "<< std::setw(4)<< std::setprecision(3) << request_failure_ratio); - debugs(33, 0, "Going into hit-only-mode for " << + debugs(33, DBG_CRITICAL, "WARNING: ICP going into HIT-only mode for " << FAILURE_MODE_TIME / 60 << " minutes..."); hit_only_mode_until = squid_curtime + FAILURE_MODE_TIME; @@ -280,7 +287,7 @@ loggingEntry(NULL); if (request) - checkFailureRatio(request->errType, al.hier.code); + checkFailureRatio(request->errType, al->hier.code); freeResources(); @@ -479,11 +486,11 @@ */ /* skip trailing space and commas */ while (l > 0 && (p[l-1] == ',' || xisspace(p[l-1]))) - l--; + --l; request->x_forwarded_for_iterator.cut(l); /* look for start of last item in list */ while (l > 0 && ! (p[l-1] == ',' || xisspace(p[l-1]))) - l--; + --l; asciiaddr = p+l; if ((addr = asciiaddr)) { request->indirect_client_addr = addr; @@ -537,7 +544,7 @@ if (ia != NULL && ia->count > 0) { // Is the NAT destination IP in DNS? - for (int i = 0; i < ia->count; i++) { + for (int i = 0; i < ia->count; ++i) { if (clientConn->local.matchIPAddr(ia->in_addrs[i]) == 0) { debugs(85, 3, HERE << "validate IP " << clientConn->local << " possible from Host:"); http->request->flags.hostVerified = 1; @@ -1013,7 +1020,7 @@ { HttpRequest *request = http->request; HttpHeader *req_hdr = &request->header; - int no_cache = 0; + bool no_cache = false; const char *str; request->imslen = -1; @@ -1027,14 +1034,14 @@ String s = req_hdr->getList(HDR_PRAGMA); if (strListIsMember(&s, "no-cache", ',')) - no_cache++; + no_cache=true; s.clean(); } if (request->cache_control) if (request->cache_control->noCache()) - no_cache++; + no_cache=true; /* * Work around for supporting the Reload button in IE browsers when Squid @@ -1047,20 +1054,20 @@ if (http->flags.accel && request->flags.ims) { if ((str = req_hdr->getStr(HDR_USER_AGENT))) { if (strstr(str, "MSIE 5.01") != NULL) - no_cache++; + no_cache=true; else if (strstr(str, "MSIE 5.0") != NULL) - no_cache++; + no_cache=true; else if (strstr(str, "MSIE 4.") != NULL) - no_cache++; + no_cache=true; else if (strstr(str, "MSIE 3.") != NULL) - no_cache++; + no_cache=true; } } } } if (request->method == METHOD_OTHER) { - no_cache++; + no_cache=true; } if (no_cache) { @@ -1330,7 +1337,7 @@ #endif logType = LOG_TCP_MISS; getConn()->stopReading(); // tunnels read for themselves - tunnelStart(this, &out.size, &al.http.code); + tunnelStart(this, &out.size, &al->http.code); return; } @@ -1489,8 +1496,8 @@ assert(calloutContext); /*Save the original request for logging purposes*/ - if (!calloutContext->http->al.request) - calloutContext->http->al.request = HTTPMSGLOCK(request); + if (!calloutContext->http->al->request) + calloutContext->http->al->request = HTTPMSGLOCK(request); // CVE-2009-0801: verify the Host: header is consistent with other known details. if (!calloutContext->host_header_verify_done) { diff -u -r -N squid-3.2.0.18/src/client_side_request.h squid-3.2.0.19/src/client_side_request.h --- squid-3.2.0.18/src/client_side_request.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/client_side_request.h 2012-08-03 00:14:34.000000000 +1200 @@ -116,7 +116,7 @@ log_type logType; struct timeval start_time; - AccessLogEntry al; + AccessLogEntry::Pointer al; ///< access.log entry struct { unsigned int accel:1; diff -u -r -N squid-3.2.0.18/src/comm/AcceptLimiter.cc squid-3.2.0.19/src/comm/AcceptLimiter.cc --- squid-3.2.0.18/src/comm/AcceptLimiter.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/AcceptLimiter.cc 2012-08-03 00:14:34.000000000 +1200 @@ -14,7 +14,7 @@ void Comm::AcceptLimiter::defer(Comm::TcpAcceptor *afd) { - afd->isLimited++; + ++ afd->isLimited; debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited); deferred.push_back(afd); } @@ -24,7 +24,7 @@ { for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; i++) { if (deferred[i] == afd) { - deferred[i]->isLimited--; + -- deferred[i]->isLimited; deferred[i] = NULL; // fast. kick() will skip empty entries later. debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited); } @@ -44,7 +44,7 @@ TcpAcceptor *temp = deferred.shift(); if (temp != NULL) { debugs(5, 5, HERE << " doing one."); - temp->isLimited--; + -- temp->isLimited; temp->acceptNext(); break; } diff -u -r -N squid-3.2.0.18/src/comm/Connection.cc squid-3.2.0.19/src/comm/Connection.cc --- squid-3.2.0.18/src/comm/Connection.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/Connection.cc 2012-08-03 00:14:34.000000000 +1200 @@ -61,8 +61,8 @@ if (isOpen()) { comm_close(fd); fd = -1; - if (getPeer()) - getPeer()->stats.conn_open--; + if (peer *p=getPeer()) + -- p->stats.conn_open; } } diff -u -r -N squid-3.2.0.18/src/comm/ConnOpener.cc squid-3.2.0.19/src/comm/ConnOpener.cc --- squid-3.2.0.18/src/comm/ConnOpener.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/ConnOpener.cc 2012-08-03 00:14:34.000000000 +1200 @@ -12,10 +12,7 @@ #include "ipcache.h" #include "SquidTime.h" -namespace Comm -{ -CBDATA_CLASS_INIT(ConnOpener); -}; +CBDATA_NAMESPACED_CLASS_INIT(Comm, ConnOpener); Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &c, AsyncCall::Pointer &handler, time_t ctimeout) : AsyncJob("Comm::ConnOpener"), @@ -131,6 +128,7 @@ } if (temporaryFd_ >= 0) { + debugs(5, 4, HERE << conn_ << " closing temp FD " << temporaryFd_); // it never reached fully open, so cleanup the FD handlers // Note that comm_close() sequence does not happen for partially open FD Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, NULL, NULL, 0); @@ -141,6 +139,7 @@ } fd_table[temporaryFd_].timeoutHandler = NULL; fd_table[temporaryFd_].timeout = 0; + close(temporaryFd_); fd_close(temporaryFd_); temporaryFd_ = -1; } @@ -228,7 +227,7 @@ if (callback_ == NULL || callback_->canceled()) return; - totalTries_++; + ++ totalTries_; switch (comm_connect_addr(temporaryFd_, conn_->remote) ) { @@ -252,7 +251,7 @@ break; default: - failRetries_++; + ++failRetries_; // check for timeout FIRST. if (squid_curtime - connectStart_ > connectTimeout_) { diff -u -r -N squid-3.2.0.18/src/comm/ModDevPoll.cc squid-3.2.0.19/src/comm/ModDevPoll.cc --- squid-3.2.0.18/src/comm/ModDevPoll.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/ModDevPoll.cc 2012-08-03 00:14:34.000000000 +1200 @@ -165,7 +165,7 @@ comm_flush_updates(); /* Push new event onto array */ - devpoll_update.cur++; + ++ devpoll_update.cur; devpoll_update.pfds[devpoll_update.cur].fd = fd; devpoll_update.pfds[devpoll_update.cur].events = events; devpoll_update.pfds[devpoll_update.cur].revents = 0; @@ -361,7 +361,7 @@ comm_flush_updates(); /* ensure latest changes are sent to /dev/poll */ num = ioctl(devpoll_fd, DP_POLL, &do_poll); - ++statCounter.select_loops; + ++ statCounter.select_loops; if (num >= 0) break; /* no error, skip out of loop */ @@ -421,7 +421,7 @@ F->read_handler = NULL; hdl(fd, F->read_data); PROF_stop(comm_read_handler); - statCounter.select_fds++; + ++ statCounter.select_fds; } else { debugs( 5, @@ -445,7 +445,7 @@ F->write_handler = NULL; hdl(fd, F->write_data); PROF_stop(comm_write_handler); - statCounter.select_fds++; + ++ statCounter.select_fds; } else { debugs( 5, diff -u -r -N squid-3.2.0.18/src/comm/ModEpoll.cc squid-3.2.0.19/src/comm/ModEpoll.cc --- squid-3.2.0.18/src/comm/ModEpoll.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/ModEpoll.cc 2012-08-03 00:14:34.000000000 +1200 @@ -258,7 +258,7 @@ for (;;) { num = epoll_wait(kdpfd, pevents, SQUID_MAXFD, msec); - ++statCounter.select_loops; + ++ statCounter.select_loops; if (num >= 0) break; @@ -300,7 +300,7 @@ F->read_handler = NULL; hdl(fd, F->read_data); PROF_stop(comm_write_handler); - statCounter.select_fds++; + ++ statCounter.select_fds; } else { debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no read handler for FD " << fd); // remove interest since no handler exist for this event. @@ -315,7 +315,7 @@ F->write_handler = NULL; hdl(fd, F->write_data); PROF_stop(comm_read_handler); - statCounter.select_fds++; + ++ statCounter.select_fds; } else { debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no write handler for FD " << fd); // remove interest since no handler exist for this event. diff -u -r -N squid-3.2.0.18/src/comm/ModPoll.cc squid-3.2.0.19/src/comm/ModPoll.cc --- squid-3.2.0.18/src/comm/ModPoll.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/ModPoll.cc 2012-08-03 00:14:34.000000000 +1200 @@ -216,7 +216,7 @@ PROF_start(comm_check_incoming); incoming_sockets_accepted = 0; - for (i = npfds = 0; i < nfds; i++) { + for (i = npfds = 0; i < nfds; ++i) { int events; fd = fds[i]; events = 0; @@ -241,7 +241,7 @@ } getCurrentTime(); - statCounter.syscalls.selects++; + ++ statCounter.syscalls.selects; if (poll(pfds, npfds, 0) < 1) { PROF_stop(comm_check_incoming); @@ -283,11 +283,15 @@ int nevents; udp_io_events = 0; - if (Comm::IsConnOpen(icpIncomingConn)) - fds[nfds++] = icpIncomingConn->fd; + if (Comm::IsConnOpen(icpIncomingConn)) { + fds[nfds] = icpIncomingConn->fd; + ++nfds; + } - if (icpIncomingConn != icpOutgoingConn && Comm::IsConnOpen(icpOutgoingConn)) - fds[nfds++] = icpOutgoingConn->fd; + if (icpIncomingConn != icpOutgoingConn && Comm::IsConnOpen(icpOutgoingConn)) { + fds[nfds] = icpOutgoingConn->fd; + ++nfds; + } if (nfds == 0) return; @@ -319,11 +323,12 @@ // XXX: only poll sockets that won't be deferred. But how do we identify them? - for (j = 0; j < NHttpSockets; j++) { + for (j = 0; j < NHttpSockets; ++j) { if (HttpSockets[j] < 0) continue; - fds[nfds++] = HttpSockets[j]; + fds[nfds] = HttpSockets[j]; + ++nfds; } nevents = comm_check_incoming_poll_handlers(nfds, fds); @@ -381,7 +386,7 @@ maxfd = Biggest_FD + 1; - for (int i = 0; i < maxfd; i++) { + for (int i = 0; i < maxfd; ++i) { int events; events = 0; /* Check each open socket for a handler. */ @@ -425,9 +430,9 @@ for (;;) { PROF_start(comm_poll_normal); - ++statCounter.syscalls.selects; + ++ statCounter.syscalls.selects; num = poll(pfds, nfds, msec); - ++statCounter.select_loops; + ++ statCounter.select_loops; PROF_stop(comm_poll_normal); if (num >= 0 || npending > 0) @@ -458,7 +463,7 @@ * limit in SunOS */ PROF_start(comm_handle_ready_fd); - for (size_t loopIndex = 0; loopIndex < nfds; loopIndex++) { + for (size_t loopIndex = 0; loopIndex < nfds; ++loopIndex) { fde *F; int revents = pfds[loopIndex].revents; fd = pfds[loopIndex].fd; @@ -498,7 +503,7 @@ F->flags.read_pending = 0; hdl(fd, F->read_data); PROF_stop(comm_read_handler); - statCounter.select_fds++; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_poll_udp_incoming(); @@ -519,7 +524,7 @@ F->write_handler = NULL; hdl(fd, F->write_data); PROF_stop(comm_write_handler); - statCounter.select_fds++; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_poll_udp_incoming(); @@ -595,11 +600,15 @@ if (DnsSocketA < 0 && DnsSocketB < 0) return; - if (DnsSocketA >= 0) - fds[nfds++] = DnsSocketA; + if (DnsSocketA >= 0) { + fds[nfds] = DnsSocketA; + ++nfds; + } - if (DnsSocketB >= 0) - fds[nfds++] = DnsSocketB; + if (DnsSocketB >= 0) { + fds[nfds] = DnsSocketB; + ++nfds; + } nevents = comm_check_incoming_poll_handlers(nfds, fds); diff -u -r -N squid-3.2.0.18/src/comm/ModSelect.cc squid-3.2.0.19/src/comm/ModSelect.cc --- squid-3.2.0.18/src/comm/ModSelect.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/ModSelect.cc 2012-08-03 00:14:34.000000000 +1200 @@ -215,7 +215,7 @@ FD_ZERO(&write_mask); incoming_sockets_accepted = 0; - for (i = 0; i < nfds; i++) { + for (i = 0; i < nfds; ++i) { fd = fds[i]; if (fd_table[fd].read_handler) { @@ -238,7 +238,7 @@ getCurrentTime(); - statCounter.syscalls.selects++; + ++ statCounter.syscalls.selects; if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1) return incoming_sockets_accepted; @@ -278,11 +278,15 @@ int nevents; udp_io_events = 0; - if (Comm::IsConnOpen(icpIncomingConn)) - fds[nfds++] = icpIncomingConn->fd; + if (Comm::IsConnOpen(icpIncomingConn)) { + fds[nfds] = icpIncomingConn->fd; + ++nfds; + } - if (Comm::IsConnOpen(icpOutgoingConn) && icpIncomingConn != icpOutgoingConn) - fds[nfds++] = icpOutgoingConn->fd; + if (Comm::IsConnOpen(icpOutgoingConn) && icpIncomingConn != icpOutgoingConn) { + fds[nfds] = icpOutgoingConn->fd; + ++nfds; + } if (nfds == 0) return; @@ -314,8 +318,10 @@ // XXX: only poll sockets that won't be deferred. But how do we identify them? for (const AnyP::PortCfg *s = Config.Sockaddr.http; s; s = s->next) { - if (Comm::IsConnOpen(s->listenConn)) - fds[nfds++] = s->listenConn->fd; + if (Comm::IsConnOpen(s->listenConn)) { + fds[nfds] = s->listenConn->fd; + ++nfds; + } } nevents = comm_check_incoming_select_handlers(nfds, fds); @@ -397,11 +403,11 @@ fdsp = (fd_mask *) & readfds; - for (j = 0; j < maxindex; j++) { + for (j = 0; j < maxindex; ++j) { if ((tmask = fdsp[j]) == 0) continue; /* no bits here */ - for (k = 0; k < FD_MASK_BITS; k++) { + for (k = 0; k < FD_MASK_BITS; ++k) { if (!EBIT_TEST(tmask, k)) continue; @@ -410,13 +416,13 @@ if (FD_ISSET(fd, &readfds) && fd_table[fd].flags.read_pending) { FD_SET(fd, &pendingfds); - pending++; + ++pending; } } } #if DEBUG_FDBITS - for (i = 0; i < maxfd; i++) { + for (i = 0; i < maxfd; ++i) { /* Check each open socket for a handler. */ if (fd_table[i].read_handler) { @@ -443,9 +449,9 @@ for (;;) { poll_time.tv_sec = msec / 1000; poll_time.tv_usec = (msec % 1000) * 1000; - statCounter.syscalls.selects++; + ++ statCounter.syscalls.selects; num = select(maxfd, &readfds, &writefds, NULL, &poll_time); - ++statCounter.select_loops; + ++ statCounter.select_loops; if (num >= 0 || pending > 0) break; @@ -481,11 +487,11 @@ maxindex = howmany(maxfd, FD_MASK_BITS); - for (j = 0; j < maxindex; j++) { + for (j = 0; j < maxindex; ++j) { if ((tmask = (fdsp[j] | pfdsp[j])) == 0) continue; /* no bits here */ - for (k = 0; k < FD_MASK_BITS; k++) { + for (k = 0; k < FD_MASK_BITS; ++k) { if (tmask == 0) break; /* no more bits left */ @@ -530,7 +536,7 @@ F->flags.read_pending = 0; commUpdateReadBits(fd, NULL); hdl(fd, F->read_data); - statCounter.select_fds++; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_select_udp_incoming(); @@ -546,11 +552,11 @@ fdsp = (fd_mask *) & writefds; - for (j = 0; j < maxindex; j++) { + for (j = 0; j < maxindex; ++j) { if ((tmask = fdsp[j]) == 0) continue; /* no bits here */ - for (k = 0; k < FD_MASK_BITS; k++) { + for (k = 0; k < FD_MASK_BITS; ++k) { if (tmask == 0) break; /* no more bits left */ @@ -592,7 +598,7 @@ F->write_handler = NULL; commUpdateWriteBits(fd, NULL); hdl(fd, F->write_data); - statCounter.select_fds++; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_select_udp_incoming(); @@ -637,11 +643,15 @@ if (DnsSocketA < 0 && DnsSocketB < 0) return; - if (DnsSocketA >= 0) - fds[nfds++] = DnsSocketA; + if (DnsSocketA >= 0) { + fds[nfds] = DnsSocketA; + ++nfds; + } - if (DnsSocketB >= 0) - fds[nfds++] = DnsSocketB; + if (DnsSocketB >= 0) { + fds[nfds] = DnsSocketB; + ++nfds; + } nevents = comm_check_incoming_select_handlers(nfds, fds); @@ -700,7 +710,7 @@ struct stat sb; debugs(5, 0, "examine_select: Examining open file descriptors..."); - for (fd = 0; fd < Squid_MaxFD; fd++) { + for (fd = 0; fd < Squid_MaxFD; ++fd) { FD_ZERO(&read_x); FD_ZERO(&write_x); tv.tv_sec = tv.tv_usec = 0; @@ -712,7 +722,7 @@ else continue; - statCounter.syscalls.selects++; + ++ statCounter.syscalls.selects; errno = 0; if (!fstat(fd, &sb)) { @@ -772,10 +782,10 @@ { if (handler && !FD_ISSET(fd, &global_readfds)) { FD_SET(fd, &global_readfds); - nreadfds++; + ++nreadfds; } else if (!handler && FD_ISSET(fd, &global_readfds)) { FD_CLR(fd, &global_readfds); - nreadfds--; + --nreadfds; } } @@ -784,10 +794,10 @@ { if (handler && !FD_ISSET(fd, &global_writefds)) { FD_SET(fd, &global_writefds); - nwritefds++; + ++nwritefds; } else if (!handler && FD_ISSET(fd, &global_writefds)) { FD_CLR(fd, &global_writefds); - nwritefds--; + --nwritefds; } } diff -u -r -N squid-3.2.0.18/src/comm/ModSelectWin32.cc squid-3.2.0.19/src/comm/ModSelectWin32.cc --- squid-3.2.0.18/src/comm/ModSelectWin32.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm/ModSelectWin32.cc 2012-08-03 00:14:34.000000000 +1200 @@ -217,7 +217,7 @@ FD_ZERO(&write_mask); incoming_sockets_accepted = 0; - for (i = 0; i < nfds; i++) { + for (i = 0; i < nfds; ++i) { fd = fds[i]; if (fd_table[fd].read_handler) { @@ -240,13 +240,13 @@ getCurrentTime(); - statCounter.syscalls.selects++; + ++ statCounter.syscalls.selects; if (select(maxfd, &read_mask, &write_mask, &errfds, &zero_tv) < 1) return incoming_sockets_accepted; - for (i = 0; i < nfds; i++) { + for (i = 0; i < nfds; ++i) { fd = fds[i]; if (FD_ISSET(fd, &read_mask)) { @@ -281,11 +281,15 @@ int nevents; udp_io_events = 0; - if (Comm::IsConnOpen(icpIncomingConn)) - fds[nfds++] = icpIncomingConn->fd; + if (Comm::IsConnOpen(icpIncomingConn)) { + fds[nfds] = icpIncomingConn->fd; + ++nfds; + } - if (Comm::IsConnOpen(icpOutgoingConn) && icpIncomingConn != icpOutgoingConn) - fds[nfds++] = icpOutgoingConn->fd; + if (Comm::IsConnOpen(icpOutgoingConn) && icpIncomingConn != icpOutgoingConn) { + fds[nfds] = icpOutgoingConn->fd; + ++nfds; + } if (nfds == 0) return; @@ -317,8 +321,10 @@ // XXX: only poll sockets that won't be deferred. But how do we identify them? for (const AnyP::PortCfg *s = Config.Sockaddr.http; s; s = s->next) { - if (Comm::IsConnOpen(s->listenConn)) - fds[nfds++] = s->listenConn->fd; + if (Comm::IsConnOpen(s->listenConn)) { + fds[nfds] = s->listenConn->fd; + ++nfds; + } } nevents = comm_check_incoming_select_handlers(nfds, fds); @@ -393,11 +399,11 @@ FD_ZERO(&pendingfds); - for (j = 0; j < (int) readfds.fd_count; j++) { + for (j = 0; j < (int) readfds.fd_count; ++j) { register int readfds_handle = readfds.fd_array[j]; no_bits = 1; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { if ( fd_table[fd].win32.handle == readfds_handle ) { if (fd_table[fd].flags.open) { no_bits = 0; @@ -411,12 +417,12 @@ if (FD_ISSET(fd, &readfds) && fd_table[fd].flags.read_pending) { FD_SET(fd, &pendingfds); - pending++; + ++pending; } } #if DEBUG_FDBITS - for (i = 0; i < maxfd; i++) { + for (i = 0; i < maxfd; ++i) { /* Check each open socket for a handler. */ if (fd_table[i].read_handler) { @@ -478,13 +484,13 @@ assert(readfds.fd_count <= (unsigned int) Biggest_FD); assert(pendingfds.fd_count <= (unsigned int) Biggest_FD); - for (j = 0; j < (int) readfds.fd_count; j++) { + for (j = 0; j < (int) readfds.fd_count; ++j) { register int readfds_handle = readfds.fd_array[j]; register int pendingfds_handle = pendingfds.fd_array[j]; register int osfhandle; no_bits = 1; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { osfhandle = fd_table[fd].win32.handle; if (( osfhandle == readfds_handle ) || @@ -530,7 +536,7 @@ F->flags.read_pending = 0; commUpdateReadBits(fd, NULL); hdl(fd, F->read_data); - statCounter.select_fds++; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_select_udp_incoming(); @@ -545,10 +551,10 @@ assert(errfds.fd_count <= (unsigned int) Biggest_FD); - for (j = 0; j < (int) errfds.fd_count; j++) { + for (j = 0; j < (int) errfds.fd_count; ++j) { register int errfds_handle = errfds.fd_array[j]; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { if ( fd_table[fd].win32.handle == errfds_handle ) break; } @@ -560,18 +566,18 @@ F->write_handler = NULL; commUpdateWriteBits(fd, NULL); hdl(fd, F->write_data); - statCounter.select_fds++; + ++ statCounter.select_fds; } } } assert(writefds.fd_count <= (unsigned int) Biggest_FD); - for (j = 0; j < (int) writefds.fd_count; j++) { + for (j = 0; j < (int) writefds.fd_count; ++j) { register int writefds_handle = writefds.fd_array[j]; no_bits = 1; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { if ( fd_table[fd].win32.handle == writefds_handle ) { if (fd_table[fd].flags.open) { no_bits = 0; @@ -613,7 +619,7 @@ F->write_handler = NULL; commUpdateWriteBits(fd, NULL); hdl(fd, F->write_data); - statCounter.select_fds++; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_select_udp_incoming(); @@ -657,11 +663,15 @@ if (DnsSocketA < 0 && DnsSocketB < 0) return; - if (DnsSocketA >= 0) - fds[nfds++] = DnsSocketA; + if (DnsSocketA >= 0) { + fds[nfds] = DnsSocketA; + ++nfds; + } - if (DnsSocketB >= 0) - fds[nfds++] = DnsSocketB; + if (DnsSocketB >= 0) { + fds[nfds] = DnsSocketB; + ++nfds; + } nevents = comm_check_incoming_select_handlers(nfds, fds); @@ -720,7 +730,7 @@ struct stat sb; debugs(5, 0, "examine_select: Examining open file descriptors..."); - for (fd = 0; fd < Squid_MaxFD; fd++) { + for (fd = 0; fd < Squid_MaxFD; ++fd) { FD_ZERO(&read_x); FD_ZERO(&write_x); tv.tv_sec = tv.tv_usec = 0; @@ -732,7 +742,7 @@ else continue; - statCounter.syscalls.selects++; + ++ statCounter.syscalls.selects; errno = 0; if (!fstat(fd, &sb)) { @@ -792,10 +802,10 @@ { if (handler && !FD_ISSET(fd, &global_readfds)) { FD_SET(fd, &global_readfds); - nreadfds++; + ++nreadfds; } else if (!handler && FD_ISSET(fd, &global_readfds)) { FD_CLR(fd, &global_readfds); - nreadfds--; + --nreadfds; } } @@ -804,10 +814,10 @@ { if (handler && !FD_ISSET(fd, &global_writefds)) { FD_SET(fd, &global_writefds); - nwritefds++; + ++nwritefds; } else if (!handler && FD_ISSET(fd, &global_writefds)) { FD_CLR(fd, &global_writefds); - nwritefds--; + --nwritefds; } } diff -u -r -N squid-3.2.0.18/src/comm.cc squid-3.2.0.19/src/comm.cc --- squid-3.2.0.18/src/comm.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/comm.cc 2012-08-03 00:14:34.000000000 +1200 @@ -123,7 +123,7 @@ assert(data == COMMIO_FD_READCB(fd)); assert(ccb->active()); /* Attempt a read */ - statCounter.syscalls.sock.reads++; + ++ statCounter.syscalls.sock.reads; errno = 0; int retval; retval = FD_READ_METHOD(fd, ccb->buf, ccb->size); @@ -316,7 +316,7 @@ int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, Ip::Address &from) { - statCounter.syscalls.sock.recvfroms++; + ++ statCounter.syscalls.sock.recvfroms; int x = 0; struct addrinfo *AI = NULL; @@ -407,7 +407,7 @@ static comm_err_t commBind(int s, struct addrinfo &inaddr) { - statCounter.syscalls.sock.binds++; + ++ statCounter.syscalls.sock.binds; if (bind(s, inaddr.ai_addr, inaddr.ai_addrlen) == 0) { debugs(50, 6, "commBind: bind socket FD " << s << " to " << fd_table[s].local_addr); @@ -519,7 +519,7 @@ PROF_start(comm_open); /* Create socket for accepting new connections. */ - statCounter.syscalls.sock.sockets++; + ++ statCounter.syscalls.sock.sockets; /* Setup the socket addrinfo details for use */ addr.GetAddrInfo(AI); @@ -820,7 +820,7 @@ if (!F->flags.called_connect) { F->flags.called_connect = 1; - statCounter.syscalls.sock.connects++; + ++ statCounter.syscalls.sock.connects; x = connect(sock, AI->ai_addr, AI->ai_addrlen); @@ -1055,7 +1055,7 @@ fd_close(params.fd); /* update fdstat */ close(params.fd); - statCounter.syscalls.sock.closes++; + ++ statCounter.syscalls.sock.closes; /* When one connection closes, give accept() a chance, if need be */ Comm::AcceptLimiter::Instance().kick(); @@ -1090,7 +1090,11 @@ return; /* The following fails because ipc.c is doing calls to pipe() to create sockets! */ - assert(isOpen(fd)); + if (!isOpen(fd)) { + debugs(50, DBG_IMPORTANT, HERE << "BUG 3556: FD " << fd << " is not an open socket."); + // XXX: do we need to run close(fd) or fd_close(fd) here? + return; + } assert(F->type != FD_FILE); @@ -1163,7 +1167,7 @@ struct addrinfo *AI = NULL; PROF_start(comm_udp_sendto); - statCounter.syscalls.sock.sendtos++; + ++ statCounter.syscalls.sock.sendtos; debugs(50, 3, "comm_udp_sendto: Attempt to send UDP packet to " << to_addr << " using FD " << fd << " using Port " << comm_local_port(fd) ); @@ -1735,7 +1739,7 @@ int fd; fde *F = NULL; - for (fd = 0; fd <= Biggest_FD; fd++) { + for (fd = 0; fd <= Biggest_FD; ++fd) { F = &fd_table[fd]; if (!F->flags.open) @@ -1793,7 +1797,7 @@ fde *F = NULL; AsyncCall::Pointer callback; - for (fd = 0; fd <= Biggest_FD; fd++) { + for (fd = 0; fd <= Biggest_FD; ++fd) { F = &fd_table[fd]; if (writeTimedOut(fd)) { @@ -2096,7 +2100,7 @@ PROF_start(comm_open); /* Create socket for accepting new connections. */ - statCounter.syscalls.sock.sockets++; + ++ statCounter.syscalls.sock.sockets; /* Setup the socket addrinfo details for use */ struct addrinfo AI; diff -u -r -N squid-3.2.0.18/src/ConfigParser.cc squid-3.2.0.19/src/ConfigParser.cc --- squid-3.2.0.18/src/ConfigParser.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ConfigParser.cc 2012-08-03 00:14:34.000000000 +1200 @@ -66,7 +66,7 @@ fn = ++t; while (*t && *t != '\"' && *t != '\'') - t++; + ++t; *t = '\0'; @@ -144,7 +144,7 @@ const char * next = s+1; // may point to 0 memmove(s, next, strlen(next) + 1); } - s++; + ++s; } if (*s != '"') { @@ -164,7 +164,7 @@ const char *s = var.termedBuf(); bool needQuote = false; - for (const char *l = s; !needQuote && *l != '\0'; l++ ) + for (const char *l = s; !needQuote && *l != '\0'; ++l ) needQuote = !isalnum(*l); if (!needQuote) @@ -172,7 +172,7 @@ quotedStr.clean(); quotedStr.append('"'); - for (; *s != '\0'; s++) { + for (; *s != '\0'; ++s) { if (*s == '"' || *s == '\\') quotedStr.append('\\'); quotedStr.append(*s); diff -u -r -N squid-3.2.0.18/src/debug.cc squid-3.2.0.19/src/debug.cc --- squid-3.2.0.18/src/debug.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/debug.cc 2012-08-03 00:14:34.000000000 +1200 @@ -225,7 +225,7 @@ return; } - for (i = 0; i < MAX_DEBUG_SECTIONS; i++) + for (i = 0; i < MAX_DEBUG_SECTIONS; ++i) Debug::Levels[i] = l; } @@ -395,7 +395,7 @@ struct syslog_facility_name *n; - for (n = syslog_facility_names; n->name; n++) { + for (n = syslog_facility_names; n->name; ++n) { if (strcmp(n->name, facility) == 0) { syslog_facility = n->facility; return; @@ -427,7 +427,7 @@ return; } - for (i = 0; i < MAX_DEBUG_SECTIONS; i++) + for (i = 0; i < MAX_DEBUG_SECTIONS; ++i) Debug::Levels[i] = 0; if (options) { @@ -484,7 +484,7 @@ */ /* Rotate numbers 0 through N up one */ for (int i = Debug::rotateNumber; i > 1;) { - i--; + --i; snprintf(from, MAXPATHLEN, "%s.%d", debug_log_file, i - 1); snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i); #if _SQUID_MSWIN_ @@ -664,7 +664,7 @@ Ctx ctx_enter(const char *descr) { - Ctx_Current_Level++; + ++Ctx_Current_Level; if (Ctx_Current_Level <= CTX_MAX_LEVEL) Ctx_Descrs[Ctx_Current_Level] = descr; @@ -695,7 +695,7 @@ ctx_print(void) { /* lock so _db_print will not call us recursively */ - Ctx_Lock++; + ++Ctx_Lock; /* ok, user saw [0,Ctx_Reported_Level] descriptions */ /* first inform about entries popped since user saw them */ @@ -711,14 +711,14 @@ /* report new contexts that were pushed since last report */ while (Ctx_Reported_Level < Ctx_Current_Level) { - Ctx_Reported_Level++; - Ctx_Valid_Level++; + ++Ctx_Reported_Level; + ++Ctx_Valid_Level; _db_print("ctx: enter level %2d: '%s'\n", Ctx_Reported_Level, ctx_get_descr(Ctx_Reported_Level)); } /* unlock */ - Ctx_Lock--; + --Ctx_Lock; } /* checks for nulls and overflows */ diff -u -r -N squid-3.2.0.18/src/Debug.h squid-3.2.0.19/src/Debug.h --- squid-3.2.0.18/src/Debug.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/Debug.h 2012-08-03 00:14:34.000000000 +1200 @@ -73,6 +73,8 @@ /* levels 2-8 are still being discussed amongst the developers */ #define DBG_DATA 9 /**< output is a large data dump only necessary for advanced debugging */ +#define DBG_PARSE_NOTE(x) (opt_parse_cfg_only?0:(x)) /**< output is always to be displayed on '-k parse' but at level-x normally. */ + class Debug { diff -u -r -N squid-3.2.0.18/src/DelayConfig.cc squid-3.2.0.19/src/DelayConfig.cc --- squid-3.2.0.18/src/DelayConfig.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DelayConfig.cc 2012-08-03 00:14:34.000000000 +1200 @@ -77,7 +77,7 @@ return; } - pool--; + --pool; DelayPools::delay_data[pool].createPool(delay_class_); } @@ -93,7 +93,7 @@ return; } - pool--; + --pool; if (!DelayPools::delay_data[pool].theComposite().getRaw()) { debugs(3, 0, "parse_delay_pool_rates: Ignoring pool " << pool + 1 << " attempt to set rates with class not set"); @@ -138,7 +138,7 @@ storeAppendPrintf(entry, "%s %d\n", name, DelayPools::pools()); - for (i = 0; i < DelayPools::pools(); i++) + for (i = 0; i < DelayPools::pools(); ++i) DelayPools::delay_data[i].dump (entry, i); } diff -u -r -N squid-3.2.0.18/src/DelayId.cc squid-3.2.0.19/src/DelayId.cc --- squid-3.2.0.18/src/DelayId.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DelayId.cc 2012-08-03 00:14:34.000000000 +1200 @@ -105,7 +105,7 @@ return DelayId(); } - for (pool = 0; pool < DelayPools::pools(); pool++) { + for (pool = 0; pool < DelayPools::pools(); ++pool) { /* pools require explicit 'allow' to assign a client into them */ if (!DelayPools::delay_data[pool].access) { diff -u -r -N squid-3.2.0.18/src/delay_pools.cc squid-3.2.0.19/src/delay_pools.cc --- squid-3.2.0.18/src/delay_pools.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/delay_pools.cc 2012-08-03 00:14:34.000000000 +1200 @@ -743,7 +743,7 @@ storeAppendPrintf(sentry, "\t\tCurrent:"); - for (unsigned int i = 0; i < buckets.size(); i++) { + for (unsigned int i = 0; i < buckets.size(); ++i) { storeAppendPrintf(sentry, " %d:", buckets.key_map[i]); buckets.values[i].stats(sentry); } diff -u -r -N squid-3.2.0.18/src/DescriptorSet.cc squid-3.2.0.19/src/DescriptorSet.cc --- squid-3.2.0.18/src/DescriptorSet.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DescriptorSet.cc 2012-08-03 00:14:34.000000000 +1200 @@ -37,7 +37,8 @@ return false; // already have it assert(size_ < capacity_); // \todo: replace with Must() - const int pos = size_++; + const int pos = size_; + ++size_; index_[fd] = pos; descriptors_[pos] = fd; return true; // really added diff -u -r -N squid-3.2.0.18/src/disk.cc squid-3.2.0.19/src/disk.cc --- squid-3.2.0.18/src/disk.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/disk.cc 2012-08-03 00:14:34.000000000 +1200 @@ -79,7 +79,7 @@ fd = open(path, mode, 0644); - statCounter.syscalls.disk.opens++; + ++ statCounter.syscalls.disk.opens; if (fd < 0) { debugs(50, 3, "file_open: error opening file " << path << ": " << xstrerror()); @@ -145,7 +145,7 @@ fd_close(fd); - statCounter.syscalls.disk.closes++; + ++ statCounter.syscalls.disk.closes; PROF_stop(file_close); } @@ -247,7 +247,7 @@ debugs(6, 3, "diskHandleWrite: FD " << fd << " len = " << len); - statCounter.syscalls.disk.writes++; + ++ statCounter.syscalls.disk.writes; fd_bytes(fd, len, FD_WRITE); @@ -443,7 +443,7 @@ #endif debugs(6, 3, "diskHandleRead: FD " << fd << " seeking to offset " << ctrl_dat->offset); lseek(fd, ctrl_dat->offset, SEEK_SET); /* XXX ignore return? */ - ++statCounter.syscalls.disk.seeks; + ++ statCounter.syscalls.disk.seeks; F->disk.offset = ctrl_dat->offset; } @@ -453,7 +453,7 @@ if (len > 0) F->disk.offset += len; - statCounter.syscalls.disk.reads++; + ++ statCounter.syscalls.disk.reads; fd_bytes(fd, len, FD_READ); @@ -507,7 +507,7 @@ void safeunlink(const char *s, int quiet) { - statCounter.syscalls.disk.unlinks++; + ++ statCounter.syscalls.disk.unlinks; if (unlink(s) < 0 && !quiet) debugs(50, 1, "safeunlink: Couldn't delete " << s << ": " << xstrerror()); diff -u -r -N squid-3.2.0.18/src/DiskIO/AIO/AIODiskFile.cc squid-3.2.0.19/src/DiskIO/AIO/AIODiskFile.cc --- squid-3.2.0.18/src/DiskIO/AIO/AIODiskFile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/AIO/AIODiskFile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -99,7 +99,7 @@ error(true); } else { closed = false; - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79, 3, HERE << ": opened FD " << fd); } @@ -159,7 +159,7 @@ qe->aq_e_aiocb.aio_buf = request->buf; /* Account */ - strategy->aq.aq_numpending++; + ++ strategy->aq.aq_numpending; /* Initiate aio */ if (aio_read(&qe->aq_e_aiocb) < 0) { diff -u -r -N squid-3.2.0.18/src/DiskIO/AIO/AIODiskIOStrategy.cc squid-3.2.0.19/src/DiskIO/AIO/AIODiskIOStrategy.cc --- squid-3.2.0.18/src/DiskIO/AIO/AIODiskIOStrategy.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/AIO/AIODiskIOStrategy.cc 2012-08-03 00:14:34.000000000 +1200 @@ -136,7 +136,7 @@ /* Loop through all slots */ - for (i = 0; i < MAX_ASYNCOP; i++) { + for (i = 0; i < MAX_ASYNCOP; ++i) { if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_USED) { aqe = &aq.aq_queue[i]; /* Active, get status */ @@ -223,7 +223,7 @@ { /* Later we should use something a little more .. efficient :) */ - for (int i = 0; i < MAX_ASYNCOP; i++) { + for (int i = 0; i < MAX_ASYNCOP; ++i) { if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_FREE) /* Found! */ return i; diff -u -r -N squid-3.2.0.18/src/DiskIO/AIO/aio_win32.cc squid-3.2.0.19/src/DiskIO/AIO/aio_win32.cc --- squid-3.2.0.18/src/DiskIO/AIO/aio_win32.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/AIO/aio_win32.cc 2012-08-03 00:14:34.000000000 +1200 @@ -319,7 +319,7 @@ FILE_FLAG_OVERLAPPED, /* file attributes */ NULL /* handle to template file */ )) != INVALID_HANDLE_VALUE) { - statCounter.syscalls.disk.opens++; + ++ statCounter.syscalls.disk.opens; fd = _open_osfhandle((long) hndl, 0); commSetCloseOnExec(fd); fd_open(fd, FD_FILE, path); @@ -336,7 +336,7 @@ { CloseHandle((HANDLE)_get_osfhandle(fd)); fd_close(fd); - statCounter.syscalls.disk.closes++; + ++ statCounter.syscalls.disk.closes; } diff -u -r -N squid-3.2.0.18/src/DiskIO/Blocking/BlockingFile.cc squid-3.2.0.19/src/DiskIO/Blocking/BlockingFile.cc --- squid-3.2.0.18/src/DiskIO/Blocking/BlockingFile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/Blocking/BlockingFile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -82,7 +82,7 @@ error(true); } else { closed = false; - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79, 3, "BlockingFile::open: opened FD " << fd); } @@ -106,7 +106,7 @@ if (fd > -1) { closed = true; file_close(fd); - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; } } diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskDaemon/DiskdFile.cc squid-3.2.0.19/src/DiskIO/DiskDaemon/DiskdFile.cc --- squid-3.2.0.18/src/DiskIO/DiskDaemon/DiskdFile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskDaemon/DiskdFile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -75,7 +75,8 @@ assert (aPath); debugs(79, 3, "DiskdFile::DiskdFile: " << aPath); path_ = xstrdup (aPath); - id = diskd_stats.sio_id++; + id = diskd_stats.sio_id; + ++diskd_stats.sio_id; } DiskdFile::~DiskdFile() @@ -112,7 +113,7 @@ ioRequestor = NULL; } - diskd_stats.open.ops++; + ++diskd_stats.open.ops; } void @@ -145,7 +146,7 @@ return; } - diskd_stats.create.ops++; + ++diskd_stats.create.ops; } void @@ -174,7 +175,7 @@ return; } - diskd_stats.read.ops++; + ++diskd_stats.read.ops; } void @@ -200,7 +201,7 @@ return; } - diskd_stats.close.ops++; + ++diskd_stats.close.ops; } bool @@ -280,10 +281,10 @@ debugs(79, 3, "storeDiskdOpenDone: status " << M->status); if (M->status < 0) { - diskd_stats.open.fail++; + ++diskd_stats.open.fail; errorOccured = true; } else { - diskd_stats.open.success++; + ++diskd_stats.open.success; } ioCompleted(); @@ -297,10 +298,10 @@ debugs(79, 3, "storeDiskdCreateDone: status " << M->status); if (M->status < 0) { - diskd_stats.create.fail++; + ++diskd_stats.create.fail; errorOccured = true; } else { - diskd_stats.create.success++; + ++diskd_stats.create.success; } ioCompleted(); @@ -338,7 +339,7 @@ return; } - diskd_stats.write.ops++; + ++diskd_stats.write.ops; } void @@ -360,10 +361,10 @@ debugs(79, 3, "DiskdFile::closeDone: status " << M->status); if (M->status < 0) { - diskd_stats.close.fail++; + ++diskd_stats.close.fail; errorOccured = true; } else { - diskd_stats.close.success++; + ++diskd_stats.close.success; } ioCompleted(); @@ -385,14 +386,14 @@ readRequest->RefCountDereference(); if (M->status < 0) { - diskd_stats.read.fail++; + ++diskd_stats.read.fail; ioCompleted(); errorOccured = true; ioRequestor->readCompleted(NULL, -1, DISK_ERROR, readRequest); return; } - diskd_stats.read.success++; + ++diskd_stats.read.success; ioCompleted(); ioRequestor->readCompleted (IO->shm.buf + M->shm_offset, M->status, DISK_OK, readRequest); @@ -410,13 +411,13 @@ if (M->status < 0) { errorOccured = true; - diskd_stats.write.fail++; + ++diskd_stats.write.fail; ioCompleted(); ioRequestor->writeCompleted (DISK_ERROR,0, writeRequest); return; } - diskd_stats.write.success++; + ++diskd_stats.write.success; ioCompleted(); ioRequestor->writeCompleted (DISK_OK,M->status, writeRequest); } diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc squid-3.2.0.19/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc --- squid-3.2.0.18/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc 2012-08-03 00:14:34.000000000 +1200 @@ -87,7 +87,7 @@ void DiskdIOStrategy::openFailed() { - diskd_stats.open_fail_queue_len++; + ++diskd_stats.open_fail_queue_len; } DiskFile::Pointer @@ -151,7 +151,7 @@ // shm.put (shm_offset); } - diskd_stats.unlink.ops++; + ++diskd_stats.unlink.ops; } void @@ -238,7 +238,7 @@ char *aBuf = NULL; int i; - for (i = 0; i < nbufs; i++) { + for (i = 0; i < nbufs; ++i) { if (CBIT_TEST(inuse_map, i)) continue; @@ -254,7 +254,7 @@ assert(aBuf); assert(aBuf >= buf); assert(aBuf < buf + (nbufs * SHMBUF_BLKSZ)); - diskd_stats.shmbuf_count++; + ++diskd_stats.shmbuf_count; if (diskd_stats.max_shmuse < diskd_stats.shmbuf_count) diskd_stats.max_shmuse = diskd_stats.shmbuf_count; @@ -284,7 +284,7 @@ inuse_map = (char *)xcalloc((nbufs + 7) / 8, 1); diskd_stats.shmbuf_count += nbufs; - for (int i = 0; i < nbufs; i++) { + for (int i = 0; i < nbufs; ++i) { CBIT_SET(inuse_map, i); put (i * SHMBUF_BLKSZ); } @@ -297,9 +297,9 @@ ++statCounter.syscalls.disk.unlinks; if (M->status < 0) - diskd_stats.unlink.fail++; + ++diskd_stats.unlink.fail; else - diskd_stats.unlink.success++; + ++diskd_stats.unlink.success; } void @@ -400,8 +400,8 @@ last_seq_no = M->seq_no; if (0 == x) { - diskd_stats.sent_count++; - away++; + ++diskd_stats.sent_count; + ++away; } else { debugs(79, 1, "storeDiskdSend: msgsnd: " << xstrerror()); cbdataReferenceDone(M->callback_data); @@ -549,7 +549,7 @@ int retval = 0; if (away >= magic2) { - diskd_stats.block_queue_len++; + ++diskd_stats.block_queue_len; retval = 1; /* We might not have anything to do, but our queue * is full.. */ @@ -574,7 +574,7 @@ break; } - diskd_stats.recv_count++; + ++diskd_stats.recv_count; --away; handle(&M); retval = 1; /* Return that we've actually done some work */ diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskThreads/aiops.cc squid-3.2.0.19/src/DiskIO/DiskThreads/aiops.cc --- squid-3.2.0.18/src/DiskIO/DiskThreads/aiops.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskThreads/aiops.cc 2012-08-03 00:14:34.000000000 +1200 @@ -313,7 +313,7 @@ assert(NUMTHREADS); - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc(); threadp->status = _THREAD_STARTING; threadp->current_req = NULL; @@ -473,7 +473,7 @@ done_queue.tailp = &request->next; pthread_mutex_unlock(&done_queue.mutex); CommIO::NotifyIOCompleted(); - threadp->requests++; + ++ threadp->requests; } /* while forever */ return NULL; @@ -1040,7 +1040,7 @@ threadp = threads; - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, (unsigned long)threadp->thread, threadp->requests); threadp = threadp->next; } diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskThreads/aiops_win32.cc squid-3.2.0.19/src/DiskIO/DiskThreads/aiops_win32.cc --- squid-3.2.0.18/src/DiskIO/DiskThreads/aiops_win32.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskThreads/aiops_win32.cc 2012-08-03 00:14:34.000000000 +1200 @@ -305,7 +305,7 @@ assert(NUMTHREADS); - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc(); threadp->status = _THREAD_STARTING; threadp->current_req = NULL; @@ -364,7 +364,7 @@ threadp = threads; - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { threadp->exit = 1; hthreads[i] = threadp->thread; threadp = threadp->next; @@ -378,7 +378,7 @@ WaitForMultipleObjects(NUMTHREADS, hthreads, TRUE, 2000); - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { CloseHandle(hthreads[i]); } @@ -550,7 +550,7 @@ CommIO::NotifyIOCompleted(); Sleep(0); - threadp->requests++; + ++ threadp->requests; } /* while forever */ CloseHandle(cond); @@ -1153,7 +1153,7 @@ threadp = threads; - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, threadp->dwThreadId, threadp->requests); threadp = threadp->next; } diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskThreads/async_io.cc squid-3.2.0.19/src/DiskIO/DiskThreads/async_io.cc --- squid-3.2.0.18/src/DiskIO/DiskThreads/async_io.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskThreads/async_io.cc 2012-08-03 00:14:34.000000000 +1200 @@ -57,7 +57,7 @@ squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.open_start++; + ++squidaio_counts.open_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -75,7 +75,7 @@ squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.close_start++; + ++squidaio_counts.close_start; aioCancel(fd); ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; @@ -95,7 +95,7 @@ dlink_node *m, *next; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.cancel++; + ++squidaio_counts.cancel; for (m = used_list.head; m; m = next) { next = m->next; @@ -137,7 +137,7 @@ int seekmode; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.write_start++; + ++squidaio_counts.write_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = callback; @@ -166,7 +166,7 @@ int seekmode; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.read_start++; + ++squidaio_counts.read_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = callback; @@ -195,7 +195,7 @@ squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.stat_start++; + ++squidaio_counts.stat_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -212,7 +212,7 @@ { squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.unlink_start++; + ++squidaio_counts.unlink_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc squid-3.2.0.19/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc --- squid-3.2.0.18/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -96,7 +96,7 @@ } #endif - Opening_FD++; + ++Opening_FD; ioRequestor = callback; @@ -145,7 +145,7 @@ } #endif - Opening_FD++; + ++Opening_FD; ioRequestor = callback; @@ -179,7 +179,7 @@ DiskThreadsDiskFile::openDone(int unused, const char *unused2, int anFD, int errflag) { debugs(79, 3, "DiskThreadsDiskFile::openDone: FD " << anFD << ", errflag " << errflag); - Opening_FD--; + --Opening_FD; fd = anFD; @@ -189,7 +189,7 @@ debugs(79, 1, "\t" << path_); errorOccured = true; } else { - store_open_disk_fd++; + ++store_open_disk_fd; commSetCloseOnExec(fd); fd_open(fd, FD_FILE, path_); } @@ -215,7 +215,7 @@ file_close(fd); #endif - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; } } diff -u -r -N squid-3.2.0.18/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc squid-3.2.0.19/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc --- squid-3.2.0.18/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc 2012-08-03 00:14:34.000000000 +1200 @@ -94,7 +94,7 @@ int retval = 0; assert(initialised); - squidaio_counts.check_callback++; + ++squidaio_counts.check_callback; for (;;) { if ((resultp = squidaio_poll_done()) == NULL) diff -u -r -N squid-3.2.0.18/src/DiskIO/IpcIo/IpcIoFile.cc squid-3.2.0.19/src/DiskIO/IpcIo/IpcIoFile.cc --- squid-3.2.0.18/src/DiskIO/IpcIo/IpcIoFile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/IpcIo/IpcIoFile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -835,7 +835,7 @@ return false; } - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79,3, HERE << "rock db opened " << path << ": FD " << TheFile); return true; } @@ -847,7 +847,7 @@ file_close(TheFile); debugs(79,3, HERE << "rock db closed " << path << ": FD " << TheFile); TheFile = -1; - store_open_disk_fd--; + --store_open_disk_fd; } } diff -u -r -N squid-3.2.0.18/src/DiskIO/Mmapped/MmappedFile.cc squid-3.2.0.19/src/DiskIO/Mmapped/MmappedFile.cc --- squid-3.2.0.18/src/DiskIO/Mmapped/MmappedFile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/DiskIO/Mmapped/MmappedFile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -80,7 +80,7 @@ debugs(79,3, HERE << "open error: " << xstrerror()); error_ = true; } else { - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79,3, HERE << "FD " << fd); // setup mapping boundaries @@ -108,7 +108,7 @@ if (fd >= 0) { file_close(fd); fd = -1; - store_open_disk_fd--; + --store_open_disk_fd; } } diff -u -r -N squid-3.2.0.18/src/dns_internal.cc squid-3.2.0.19/src/dns_internal.cc --- squid-3.2.0.18/src/dns_internal.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/dns_internal.cc 2012-08-03 00:14:34.000000000 +1200 @@ -299,7 +299,7 @@ // TODO generate a test packet to probe this NS from EDNS size and ability. #endif debugs(78, 3, "idnsAddNameserver: Added nameserver #" << nns << " (" << A << ")"); - nns++; + ++nns; } static void @@ -327,7 +327,7 @@ strcpy(searchpath[npc].domain, buf); Tolower(searchpath[npc].domain); debugs(78, 3, "idnsAddPathComponent: Added domain #" << npc << ": " << searchpath[npc].domain); - npc++; + ++npc; } @@ -559,7 +559,7 @@ if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { keyname = (char *) xmalloc(++MaxSubkeyLen); - for (i = 0; i < (int) InterfacesCount; i++) { + for (i = 0; i < (int) InterfacesCount; ++i) { DWORD j; j = MaxSubkeyLen; if (RegEnumKeyEx(hndKey, i, keyname, &j, NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) { @@ -686,7 +686,7 @@ storeAppendPrintf(sentry, "IP ADDRESS # QUERIES # REPLIES\n"); storeAppendPrintf(sentry, "---------------------------------------------- --------- ---------\n"); - for (i = 0; i < nns; i++) { + for (i = 0; i < nns; ++i) { storeAppendPrintf(sentry, "%-45s %9d %9d\n", /* Let's take the maximum: (15 IPv4/45 IPv6) */ nameservers[i].S.NtoA(buf,MAX_IPSTRLEN), nameservers[i].nqueries, @@ -696,18 +696,18 @@ storeAppendPrintf(sentry, "\nRcode Matrix:\n"); storeAppendPrintf(sentry, "RCODE"); - for (i = 0; i < MAX_ATTEMPT; i++) + for (i = 0; i < MAX_ATTEMPT; ++i) storeAppendPrintf(sentry, " ATTEMPT%d", i + 1); storeAppendPrintf(sentry, " PROBLEM\n"); - for (j = 0; j < MAX_RCODE; j++) { + for (j = 0; j < MAX_RCODE; ++j) { if (j > 10 && j < 16) continue; // unassigned by IANA. storeAppendPrintf(sentry, "%5d", j); - for (i = 0; i < MAX_ATTEMPT; i++) + for (i = 0; i < MAX_ATTEMPT; ++i) storeAppendPrintf(sentry, " %8d", RcodeMatrix[j][i]); storeAppendPrintf(sentry, " : %s\n",Rcodes[j]); @@ -716,7 +716,7 @@ if (npc) { storeAppendPrintf(sentry, "\nSearch list:\n"); - for (i=0; i < npc; i++) + for (i=0; i < npc; ++i) storeAppendPrintf(sentry, "%s\n", searchpath[i].domain); storeAppendPrintf(sentry, "\n"); @@ -920,7 +920,7 @@ x = comm_udp_sendto(DnsSocketA, nameservers[ns].S, q->buf, q->sz); } - q->nsends++; + ++ q->nsends; q->sent_t = current_time; @@ -938,7 +938,7 @@ fd_bytes(DnsSocketA, x, FD_WRITE); } - nameservers[ns].nqueries++; + ++ nameservers[ns].nqueries; q->queue_t = current_time; dlinkAdd(q, &q->lru, &lru_list); q->pending = 1; @@ -950,7 +950,7 @@ { int i; - for (i = 0; i < nns; i++) { + for (i = 0; i < nns; ++i) { if (nameservers[i].S != from) continue; @@ -986,7 +986,7 @@ unsigned short first_id = id; while (idnsFindQuery(id)) { - id++; + ++id; if (id == first_id) { debugs(78, 1, "idnsQueryID: Warning, too many pending DNS requests"); @@ -1129,7 +1129,7 @@ // the altered NS was limiting the whole group. max_shared_edns = q->edns_seen; // may be limited by one of the others still - for (int i = 0; i < nns; i++) + for (int i = 0; i < nns; ++i) max_shared_edns = min(max_shared_edns, nameservers[i].last_seen_edns); } else { nameservers[from_ns].last_seen_edns = q->edns_seen; @@ -1150,7 +1150,7 @@ if (!q->need_vc) { q->need_vc = 1; - q->nsends--; + -- q->nsends; idnsSendQuery(q); } else { // Strange: A TCP DNS response with the truncation bit (TC) set. @@ -1168,7 +1168,7 @@ q->rcode = -n; debugs(78, 3, "idnsGrokReply: error " << rfc1035ErrorMessage(n) << " (" << q->rcode << ")"); - if (q->rcode == 2 && ++q->attempt < MAX_ATTEMPT) { + if (q->rcode == 2 && (++ q->attempt) < MAX_ATTEMPT) { /* * RCODE 2 is "Server failure - The name server was * unable to process this query due to a problem with @@ -1193,9 +1193,9 @@ strcat(q->name, "."); strcat(q->name, searchpath[q->domain].domain); debugs(78, 3, "idnsGrokReply: searchpath used for " << q->name); - q->domain++; + ++ q->domain; } else { - q->attempt++; + ++ q->attempt; } rfc1035MessageDestroy(&message); @@ -1263,7 +1263,8 @@ */ Ip::Address bugbypass; - while (max--) { + while (max) { + --max; len = comm_udp_recvfrom(fd, rbuf, SQUID_UDP_SO_RCVBUF, 0, bugbypass); from = bugbypass; // BUG BYPASS. see notes above. @@ -1291,7 +1292,7 @@ fd_bytes(fd, len, FD_READ); assert(N); - (*N)++; + ++(*N); debugs(78, 3, "idnsRead: FD " << fd << ": received " << len << " bytes from " << from); @@ -1299,7 +1300,7 @@ ns = idnsFromKnownNameserver(from); if (ns >= 0) { - nameservers[ns].nreplies++; + ++ nameservers[ns].nreplies; } // Before unknown_nameservers check to avoid flooding cache.log on attacks, @@ -1458,7 +1459,7 @@ if (rcode < MAX_RCODE) if (attempt < MAX_ATTEMPT) - RcodeMatrix[rcode][attempt]++; + ++ RcodeMatrix[rcode][attempt]; } /* ====================================================================== */ @@ -1553,7 +1554,7 @@ memDataInit(MEM_IDNS_QUERY, "idns_query", sizeof(idns_query), 0); memset(RcodeMatrix, '\0', sizeof(RcodeMatrix)); idns_lookup_hash = hash_create((HASHCMP *) strcmp, 103, hash_string); - init++; + ++init; } #if WHEN_EDNS_RESPONSES_ARE_PARSED @@ -1582,7 +1583,7 @@ DnsSocketB = -1; } - for (int i = 0; i < nns; i++) { + for (int i = 0; i < nns; ++i) { if (nsvc *vc = nameservers[i].vc) { if (Comm::IsConnOpen(vc->conn)) vc->conn->close(); @@ -1670,9 +1671,9 @@ q->xact_id.change(); q->query_id = idnsQueryID(); - for (i = 0; i < strlen(name); i++) + for (i = 0; i < strlen(name); ++i) if (name[i] == '.') - nd++; + ++nd; if (Config.onoff.res_defnames && npc > 0 && name[strlen(name)-1] != '.') { q->do_searchpath = 1; @@ -1771,7 +1772,7 @@ case DNS_REQ: - for (i = 0; i < nns; i++) + for (i = 0; i < nns; ++i) n += nameservers[i].nqueries; Answer = snmp_var_new_integer(Var->name, Var->name_length, @@ -1781,7 +1782,7 @@ break; case DNS_REP: - for (i = 0; i < nns; i++) + for (i = 0; i < nns; ++i) n += nameservers[i].nreplies; Answer = snmp_var_new_integer(Var->name, Var->name_length, diff -u -r -N squid-3.2.0.18/src/dnsserver.cc squid-3.2.0.19/src/dnsserver.cc --- squid-3.2.0.18/src/dnsserver.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/dnsserver.cc 2012-08-03 00:14:34.000000000 +1200 @@ -265,7 +265,7 @@ continue; } printf(" %s", ntoabuf); - i++; + ++i; aiptr = aiptr->ai_next; } @@ -428,7 +428,7 @@ if (_SQUID_RES_NSADDR_COUNT == MAXNS) { fprintf(stderr, "Too many -s options, only %d are allowed\n", MAXNS); } else { - _SQUID_RES_NSADDR_COUNT++; + ++ _SQUID_RES_NSADDR_COUNT; memcpy(&_SQUID_RES_NSADDR6_LIST(_SQUID_RES_NSADDR6_COUNT++), &((struct sockaddr_in6*)AI->ai_addr)->sin6_addr, sizeof(struct in6_addr)); } #else diff -u -r -N squid-3.2.0.18/src/errorpage.cc squid-3.2.0.19/src/errorpage.cc --- squid-3.2.0.18/src/errorpage.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/errorpage.cc 2012-08-03 00:14:34.000000000 +1200 @@ -236,7 +236,7 @@ if (error_text) { int i; - for (i = ERR_NONE + 1; i < error_page_count; i++) + for (i = ERR_NONE + 1; i < error_page_count; ++i) safe_free(error_text[i]); safe_free(error_text); @@ -258,7 +258,7 @@ { int i; - for (i = 0; i < error_hard_text_count; i++) + for (i = 0; i < error_hard_text_count; ++i) if (error_hard_text[i].type == type) return error_hard_text[i].text; @@ -378,11 +378,14 @@ if (!pos) { /* skip any initial whitespace. */ - while (pos < hdr.size() && xisspace(hdr[pos])) pos++; + while (pos < hdr.size() && xisspace(hdr[pos])) + ++pos; } else { // IFF we terminated the tag on whitespace or ';' we need to skip to the next ',' or end of header. - while (pos < hdr.size() && hdr[pos] != ',') pos++; - if (hdr[pos] == ',') pos++; + while (pos < hdr.size() && hdr[pos] != ',') + ++pos; + if (hdr[pos] == ',') + ++pos; } /* @@ -407,11 +410,12 @@ if (*dt != '-' && *dt != '*' && (*dt < 'a' || *dt > 'z') ) invalid_byte = true; else - dt++; // move to next destination byte. + ++dt; // move to next destination byte. } - pos++; + ++pos; } - *dt++ = '\0'; // nul-terminated the filename content string before system use. + *dt = '\0'; // nul-terminated the filename content string before system use. + ++dt; debugs(4, 9, HERE << "STATE: dt='" << dt << "', lang='" << lang << "', pos=" << pos << ", buf='" << ((pos < hdr.size()) ? hdr.substr(pos,hdr.size()) : "") << "'"); @@ -519,12 +523,12 @@ static int errorPageId(const char *page_name) { - for (int i = 0; i < ERR_MAX; i++) { + for (int i = 0; i < ERR_MAX; ++i) { if (strcmp(err_type_str[i], page_name) == 0) return i; } - for (size_t j = 0; j < ErrorDynamicPages.size(); j++) { + for (size_t j = 0; j < ErrorDynamicPages.size(); ++j) { if (strcmp(ErrorDynamicPages.items[j]->page_name, page_name) == 0) return j + ERR_MAX; } diff -u -r -N squid-3.2.0.18/src/esi/Esi.cc squid-3.2.0.19/src/esi/Esi.cc --- squid-3.2.0.18/src/esi/Esi.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/esi/Esi.cc 2012-08-03 00:14:34.000000000 +1200 @@ -993,7 +993,8 @@ flags.error = 1; } else { /* added ok, push onto the stack */ - parserState.stack[parserState.stackdepth++] = element; + parserState.stack[parserState.stackdepth] = element; + ++parserState.stackdepth; } } @@ -1024,12 +1025,15 @@ position = localbuf + strlen (localbuf); for (i = 0; i < specifiedattcount && attr[i]; i += 2) { - *position++ = ' '; + *position = ' '; + ++position; /* TODO: handle thisNode gracefully */ assert (xstrncpy (position, attr[i], sizeof(localbuf) + (position - localbuf))); position += strlen (position); - *position++ = '='; - *position++ = '\"'; + *position = '='; + ++position; + *position = '\"'; + ++position; const char *chPtr = attr[i + 1]; char ch; while ((ch = *chPtr++) != '\0') { @@ -1037,14 +1041,17 @@ assert( xstrncpy(position, """, sizeof(localbuf) + (position-localbuf)) ); position += 6; } else { - *(position++) = ch; + *position = ch; + ++position; } } position += strlen (position); - *position++ = '\"'; + *position = '\"'; + ++position; } - *position++ = '>'; + *position = '>'; + ++position; *position = '\0'; addLiteral (localbuf, position - localbuf); @@ -1134,7 +1141,8 @@ localbuf[1] = '/'; assert (xstrncpy (&localbuf[2], el, sizeof(localbuf) - 3)); position = localbuf + strlen (localbuf); - *position++ = '>'; + *position = '>'; + ++position; *position = '\0'; addLiteral (localbuf, position - localbuf); break; @@ -1283,7 +1291,8 @@ if (!parserState.stackdepth) { debugs(86, 5, "empty parser stack, inserting the top level node"); assert (tree.getRaw()); - parserState.stack[parserState.stackdepth++] = tree; + parserState.stack[parserState.stackdepth] = tree; + ++parserState.stackdepth; } if (rep && !parserState.inited()) diff -u -r -N squid-3.2.0.18/src/esi/Libxml2Parser.cc squid-3.2.0.19/src/esi/Libxml2Parser.cc --- squid-3.2.0.18/src/esi/Libxml2Parser.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/esi/Libxml2Parser.cc 2012-08-03 00:14:34.000000000 +1200 @@ -56,8 +56,8 @@ xmlChar **tmp = (xmlChar **)atts; while (tmp && *tmp != NULL) { - count++; - tmp++; + ++count; + ++tmp; } // we increased on every key and value diff -u -r -N squid-3.2.0.18/src/eui/Eui48.cc squid-3.2.0.19/src/eui/Eui48.cc --- squid-3.2.0.18/src/eui/Eui48.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/eui/Eui48.cc 2012-08-03 00:14:34.000000000 +1200 @@ -485,7 +485,7 @@ } /* Find MAC address from net table */ - for (i = 0 ; i < NetTable->dwNumEntries ; i++) { + for (i = 0 ; i < NetTable->dwNumEntries ; ++i) { in_addr a; a.s_addr = NetTable->table[i].dwAddr; if (c == a && (NetTable->table[i].dwType > 2)) { diff -u -r -N squid-3.2.0.18/src/external_acl.cc squid-3.2.0.19/src/external_acl.cc --- squid-3.2.0.18/src/external_acl.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/external_acl.cc 2012-08-03 00:14:34.000000000 +1200 @@ -264,12 +264,15 @@ if (member) { /* Split in header and member */ - *member++ = '\0'; + *member = '\0'; + ++member; - if (!xisalnum(*member)) - format->separator = *member++; - else + if (!xisalnum(*member)) { + format->separator = *member; + ++member; + } else { format->separator = ','; + } format->member = xstrdup(member); @@ -568,6 +571,10 @@ case _external_acl_format::EXT_ACL_##a: \ storeAppendPrintf(sentry, " %%%s", #a); \ break +#define DUMP_EXT_ACL_TYPE_FMT(a, fmt, ...) \ + case _external_acl_format::EXT_ACL_##a: \ + storeAppendPrintf(sentry, fmt, ##__VA_ARGS__); \ + break #if USE_AUTH DUMP_EXT_ACL_TYPE(LOGIN); #endif @@ -592,28 +599,17 @@ DUMP_EXT_ACL_TYPE(PATH); DUMP_EXT_ACL_TYPE(METHOD); #if USE_SSL - - case _external_acl_format::EXT_ACL_USER_CERT_RAW: - storeAppendPrintf(sentry, " %%USER_CERT"); - break; - - case _external_acl_format::EXT_ACL_USER_CERTCHAIN_RAW: - storeAppendPrintf(sentry, " %%USER_CERTCHAIN"); - break; - - case _external_acl_format::EXT_ACL_USER_CERT: - storeAppendPrintf(sentry, " %%USER_CERT_%s", format->header); - break; - - case _external_acl_format::EXT_ACL_CA_CERT: - storeAppendPrintf(sentry, " %%USER_CERT_%s", format->header); - break; + DUMP_EXT_ACL_TYPE_FMT(USER_CERT_RAW, " %%USER_CERT_RAW"); + DUMP_EXT_ACL_TYPE_FMT(USER_CERTCHAIN_RAW, " %%USER_CERTCHAIN_RAW"); + DUMP_EXT_ACL_TYPE_FMT(USER_CERT, " %%USER_CERT_%s", format->header); + DUMP_EXT_ACL_TYPE_FMT(CA_CERT, " %%CA_CERT_%s", format->header); #endif #if USE_AUTH DUMP_EXT_ACL_TYPE(EXT_USER); #endif DUMP_EXT_ACL_TYPE(EXT_LOG); DUMP_EXT_ACL_TYPE(TAG); + DUMP_EXT_ACL_TYPE_FMT(PERCENT, " %%%%"); default: fatal("unknown external_acl format error"); break; @@ -659,7 +655,7 @@ anEntry->def = this; hash_join(cache, anEntry); dlinkAdd(anEntry, &anEntry->lru, &lru_list); - cache_entries++; + ++cache_entries; } void @@ -1297,7 +1293,8 @@ value = strchr(token, '='); if (value) { - *value++ = '\0'; /* terminate the token, and move up to the value */ + *value = '\0'; /* terminate the token, and move up to the value */ + ++value; if (state->def->quote == external_acl::QUOTE_METHOD_URL) rfc1738_unescape(value); diff -u -r -N squid-3.2.0.18/src/fd.cc squid-3.2.0.19/src/fd.cc --- squid-3.2.0.18/src/fd.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fd.cc 2012-08-03 00:14:34.000000000 +1200 @@ -97,7 +97,7 @@ assert(!opening); while (Biggest_FD >= 0 && !fd_table[Biggest_FD].flags.open) - Biggest_FD--; + --Biggest_FD; } void @@ -118,7 +118,7 @@ Comm::SetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0); F->flags.open = 0; fdUpdateBiggest(fd, 0); - Number_FD--; + --Number_FD; *F = fde(); } @@ -267,7 +267,7 @@ if (desc) xstrncpy(F->desc, desc, FD_DESC_SZ); - Number_FD++; + ++Number_FD; } void @@ -299,7 +299,7 @@ int i; fde *F; - for (i = 0; i < Squid_MaxFD; i++) { + for (i = 0; i < Squid_MaxFD; ++i) { F = &fd_table[i]; if (!F->flags.open) diff -u -r -N squid-3.2.0.18/src/fde.cc squid-3.2.0.19/src/fde.cc --- squid-3.2.0.18/src/fde.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fde.cc 2012-08-03 00:14:34.000000000 +1200 @@ -99,7 +99,7 @@ storeAppendPrintf(dumpEntry, "---- ------ ---- -------- -------- --------------------- ------------------------------\n"); #endif - for (i = 0; i < Squid_MaxFD; i++) { + for (i = 0; i < Squid_MaxFD; ++i) { fd_table[i].dumpStats(*dumpEntry, i); } } @@ -123,6 +123,6 @@ void fde::noteUse(PconnPool *pool) { - pconn.uses++; + ++ pconn.uses; pconn.pool = pool; } diff -u -r -N squid-3.2.0.18/src/filemap.cc squid-3.2.0.19/src/filemap.cc --- squid-3.2.0.18/src/filemap.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/filemap.cc 2012-08-03 00:14:34.000000000 +1200 @@ -90,7 +90,7 @@ bitmap[file_number >> LONG_BIT_SHIFT] |= bitmask; - usedSlots_++; + ++usedSlots_; return file_number; } @@ -107,7 +107,7 @@ { unsigned long bitmask = (1L << (file_number & LONG_BIT_MASK)); bitmap[file_number >> LONG_BIT_SHIFT] &= ~bitmask; - usedSlots_--; + --usedSlots_; } bool @@ -135,14 +135,14 @@ word = suggestion >> LONG_BIT_SHIFT; - for (unsigned int count = 0; count < nwords; count++) { + for (unsigned int count = 0; count < nwords; ++count) { if (bitmap[word] != ALL_ONES) break; word = (word + 1) % nwords; } - for (unsigned char bit = 0; bit < BITS_IN_A_LONG; bit++) { + for (unsigned char bit = 0; bit < BITS_IN_A_LONG; ++bit) { suggestion = ((unsigned long) word << LONG_BIT_SHIFT) | bit; if (!testBit(suggestion)) { diff -u -r -N squid-3.2.0.18/src/format/Format.cc squid-3.2.0.19/src/format/Format.cc --- squid-3.2.0.18/src/format/Format.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/format/Format.cc 2012-08-03 00:14:34.000000000 +1200 @@ -261,36 +261,44 @@ break; case '\r': - *p++ = '\\'; - *p++ = 'r'; - str++; + *p = '\\'; + ++p; + *p = 'r'; + ++p; + ++str; break; case '\n': - *p++ = '\\'; - *p++ = 'n'; - str++; + *p = '\\'; + ++p; + *p = 'n'; + ++p; + ++str; break; case '\t': - *p++ = '\\'; - *p++ = 't'; - str++; + *p = '\\'; + ++p; + *p = 't'; + ++p; + ++str; break; default: - *p++ = '\\'; - *p++ = *str; - str++; + *p = '\\'; + ++p; + *p = *str; + ++p; + ++str; break; } } - *p++ = '\0'; + *p = '\0'; } void -Format::Format::assemble(MemBuf &mb, AccessLogEntry *al, int logSequenceNumber) const +Format::Format::assemble(MemBuf &mb, const AccessLogEntryPointer &al, int logSequenceNumber) const { char tmp[1024]; String sb; diff -u -r -N squid-3.2.0.18/src/format/Format.h squid-3.2.0.19/src/format/Format.h --- squid-3.2.0.18/src/format/Format.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/format/Format.h 2012-08-03 00:14:34.000000000 +1200 @@ -1,6 +1,7 @@ #ifndef _SQUID_FORMAT_FORMAT_H #define _SQUID_FORMAT_FORMAT_H +#include "RefCount.h" /* * Squid configuration allows users to define custom formats in * several components. @@ -14,6 +15,7 @@ */ class AccessLogEntry; +typedef RefCount AccessLogEntryPointer; class MemBuf; class StoreEntry; @@ -36,7 +38,7 @@ bool parse(char *def); /// assemble the state information into a formatted line. - void assemble(MemBuf &mb, AccessLogEntry *al, int logSequenceNumber) const; + void assemble(MemBuf &mb, const AccessLogEntryPointer &al, int logSequenceNumber) const; /// dump this whole list of formats into the provided StoreEntry void dump(StoreEntry * entry, const char *name); diff -u -r -N squid-3.2.0.18/src/format/Quoting.cc squid-3.2.0.19/src/format/Quoting.cc --- squid-3.2.0.18/src/format/Quoting.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/format/Quoting.cc 2012-08-03 00:14:34.000000000 +1200 @@ -46,21 +46,29 @@ while ((c = *(const unsigned char *) header++) != '\0') { if (c == '\r') { - *buf_cursor++ = '\\'; - *buf_cursor++ = 'r'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = 'r'; + ++buf_cursor; } else if (c == '\n') { - *buf_cursor++ = '\\'; - *buf_cursor++ = 'n'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = 'n'; + ++buf_cursor; } else if (c <= 0x1F || c >= 0x7F || c == '%' || c == ' ') { - *buf_cursor++ = '%'; + *buf_cursor = '%'; + ++buf_cursor; i = c * 2; - *buf_cursor++ = c2x[i]; - *buf_cursor++ = c2x[i + 1]; + *buf_cursor = c2x[i]; + ++buf_cursor; + *buf_cursor = c2x[i + 1]; + ++buf_cursor; } else { - *buf_cursor++ = (char) c; + *buf_cursor = (char) c; + ++buf_cursor; } } @@ -108,11 +116,15 @@ while ((c = *(const unsigned char *) header++) != '\0') { #if !OLD_LOG_MIME if (c == '\r') { - *buf_cursor++ = '\\'; - *buf_cursor++ = 'r'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = 'r'; + ++buf_cursor; } else if (c == '\n') { - *buf_cursor++ = '\\'; - *buf_cursor++ = 'n'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = 'n'; + ++buf_cursor; } else #endif if (c <= 0x1F @@ -135,19 +147,25 @@ #endif || c == '[' || c == ']') { - *buf_cursor++ = '%'; + *buf_cursor = '%'; + ++buf_cursor; i = c * 2; - *buf_cursor++ = c2x[i]; - *buf_cursor++ = c2x[i + 1]; + *buf_cursor = c2x[i]; + ++buf_cursor; + *buf_cursor = c2x[i + 1]; + ++buf_cursor; #if !OLD_LOG_MIME } else if (c == '\\') { - *buf_cursor++ = '\\'; - *buf_cursor++ = '\\'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = '\\'; + ++buf_cursor; #endif } else { - *buf_cursor++ = (char) c; + *buf_cursor = (char) c; + ++buf_cursor; } } diff -u -r -N squid-3.2.0.18/src/format/Token.cc squid-3.2.0.19/src/format/Token.cc --- squid-3.2.0.18/src/format/Token.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/format/Token.cc 2012-08-03 00:14:34.000000000 +1200 @@ -210,7 +210,7 @@ char * Format::Token::scanForToken(TokenTableEntry const table[], char *cur) { - for (TokenTableEntry const *lte = table; lte->configTag != NULL; lte++) { + for (TokenTableEntry const *lte = table; lte->configTag != NULL; ++lte) { debugs(46, 8, HERE << "compare tokens '" << lte->configTag << "' with '" << cur << "'"); if (strncmp(lte->configTag, cur, strlen(lte->configTag)) == 0) { type = lte->tokenType; @@ -268,8 +268,8 @@ break; } - cur++; - l--; + ++cur; + --l; } goto done; @@ -278,29 +278,29 @@ if (!*cur) goto done; - cur++; + ++cur; // select quoting style for his particular token switch (*cur) { case '"': quote = LOG_QUOTE_QUOTES; - cur++; + ++cur; break; case '\'': quote = LOG_QUOTE_RAW; - cur++; + ++cur; break; case '[': quote = LOG_QUOTE_MIMEBLOB; - cur++; + ++cur; break; case '#': quote = LOG_QUOTE_URL; - cur++; + ++cur; break; default: @@ -310,12 +310,12 @@ if (*cur == '-') { left = 1; - cur++; + ++cur; } if (*cur == '0') { zero = 1; - cur++; + ++cur; } if (xisdigit(*cur)) @@ -326,7 +326,7 @@ if (*cur == '{') { char *cp; - cur++; + ++cur; l = strcspn(cur, "}"); cp = (char *)xmalloc(l + 1); xstrncpy(cp, cur, l + 1); @@ -334,14 +334,14 @@ cur += l; if (*cur == '}') - cur++; + ++cur; } type = LFT_NONE; // Scan each registered token namespace debugs(46, 9, HERE << "check for token in " << TheConfig.tokens.size() << " namespaces."); - for (std::list::const_iterator itr = TheConfig.tokens.begin(); itr != TheConfig.tokens.end(); itr++) { + for (std::list::const_iterator itr = TheConfig.tokens.begin(); itr != TheConfig.tokens.end(); ++itr) { debugs(46, 7, HERE << "check for possible " << itr->prefix << ":: token"); const size_t len = itr->prefix.size(); if (itr->prefix.cmp(cur, len) == 0 && cur[len] == ':' && cur[len+1] == ':') { @@ -386,7 +386,7 @@ if (*cur == ' ') { space = 1; - cur++; + ++cur; } done: @@ -414,12 +414,15 @@ char *cp = strchr(header, ':'); if (cp) { - *cp++ = '\0'; + *cp = '\0'; + ++cp; - if (*cp == ',' || *cp == ';' || *cp == ':') - data.header.separator = *cp++; - else + if (*cp == ',' || *cp == ';' || *cp == ':') { + data.header.separator = *cp; + ++cp; + } else { data.header.separator = ','; + } data.header.element = cp; @@ -499,7 +502,7 @@ int i; divisor = 1000000; - for (i = widthMax; i > 1; i--) + for (i = widthMax; i > 1; --i) divisor /= 10; if (!divisor) diff -u -r -N squid-3.2.0.18/src/forward.cc squid-3.2.0.19/src/forward.cc --- squid-3.2.0.18/src/forward.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/forward.cc 2012-08-03 00:14:34.000000000 +1200 @@ -33,6 +33,7 @@ #include "squid-old.h" #include "forward.h" +#include "AccessLogEntry.h" #include "acl/FilledChecklist.h" #include "acl/Gadgets.h" #include "CacheManager.h" @@ -84,6 +85,11 @@ if (Comm::IsConnOpen(fwd->serverConnection())) { comm_remove_close_handler(fwd->serverConnection()->fd, fwdServerClosedWrapper, fwd); + debugs(17, 3, HERE << "store entry aborted; closing " << + fwd->serverConnection()); + fwd->serverConnection()->close(); + } else { + debugs(17, 7, HERE << "store entry aborted; no connection to close"); } fwd->serverDestinations.clean(); fwd->self = NULL; @@ -91,7 +97,8 @@ /**** PUBLIC INTERFACE ********************************************************/ -FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRequest * r) +FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRequest * r, const AccessLogEntryPointer &alp): + al(alp) { debugs(17, 2, HERE << "Forwarding client request " << client << ", url=" << e->url() ); entry = e; @@ -124,18 +131,44 @@ const bool isIntercepted = request && !request->flags.redirected && (request->flags.intercepted || request->flags.spoof_client_ip); const bool useOriginalDst = Config.onoff.client_dst_passthru || (request && !request->flags.hostVerified); if (isIntercepted && useOriginalDst) { - Comm::ConnectionPointer p = new Comm::Connection(); - p->remote = clientConn->local; - p->peerType = ORIGINAL_DST; - getOutgoingAddress(request, p); - serverDestinations.push_back(p); - - // destination "found". continue with the forwarding. + selectPeerForIntercepted(); +#if STRICT_ORIGINAL_DST + // 3.2 does not suppro re-wrapping inside CONNECT. + // our only alternative is to fake destination "found" and continue with the forwarding. startConnectionOrFail(); - } else { - // do full route options selection - peerSelect(&serverDestinations, request, entry, fwdPeerSelectionCompleteWrapper, this); + return; +#endif } + // do full route options selection + peerSelect(&serverDestinations, request, entry, fwdPeerSelectionCompleteWrapper, this); +} + +/// bypasses peerSelect() when dealing with intercepted requests +void +FwdState::selectPeerForIntercepted() +{ + // use pinned connection if available + Comm::ConnectionPointer p; + if (ConnStateData *client = request->pinnedConnection()) + p = client->validatePinnedConnection(request, NULL); + + if (Comm::IsConnOpen(p)) { + /* duplicate peerSelectPinned() effects */ + p->peerType = PINNED; + entry->ping_status = PING_DONE; /* Skip ICP */ + + debugs(17, 3, HERE << "reusing a pinned conn: " << *p); + serverDestinations.push_back(p); + } + + // use client original destination as second preferred choice + p = new Comm::Connection(); + p->peerType = ORIGINAL_DST; + p->remote = clientConn->local; + getOutgoingAddress(request, p); + + debugs(17, 3, HERE << "using client original destination: " << *p); + serverDestinations.push_back(p); } void @@ -216,7 +249,7 @@ * allocate a FwdState. */ void -FwdState::fwdStart(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request) +FwdState::Start(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request, const AccessLogEntryPointer &al) { /** \note * client_addr == no_addr indicates this is an "internal" request @@ -278,7 +311,7 @@ return; default: - FwdState::Pointer fwd = new FwdState(clientConn, entry, request); + FwdState::Pointer fwd = new FwdState(clientConn, entry, request, al); fwd->start(fwd); return; } @@ -287,6 +320,13 @@ } void +FwdState::fwdStart(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request) +{ + // Hides AccessLogEntry.h from code that does not supply ALE anyway. + Start(clientConn, entry, request, NULL); +} + +void FwdState::startConnectionOrFail() { debugs(17, 3, HERE << entry->url()); @@ -480,6 +520,9 @@ if (flags.dont_retry) return false; + if (request->bodyNibbled()) + return false; + // NP: not yet actually connected anywhere. retry is safe. if (!flags.connected_okay) return true; @@ -487,9 +530,6 @@ if (!checkRetriable()) return false; - if (request->bodyNibbled()) - return false; - return true; } @@ -750,6 +790,7 @@ } serverConn = conn; + flags.connected_okay = true; debugs(17, 3, HERE << serverConnection() << ": '" << entry->url() << "'" ); @@ -768,7 +809,6 @@ } #endif - flags.connected_okay = true; dispatch(); } @@ -845,11 +885,12 @@ else serverConn = NULL; if (Comm::IsConnOpen(serverConn)) { + flags.connected_okay = true; #if 0 if (!serverConn->getPeer()) serverConn->peerType = HIER_DIRECT; #endif - n_tries++; + ++n_tries; request->flags.pinned = 1; if (pinned_connection->pinnedAuth()) request->flags.auth = 1; @@ -886,11 +927,12 @@ // if we found an open persistent connection to use. use it. if (openedPconn) { serverConn = temp; + flags.connected_okay = true; debugs(17, 3, HERE << "reusing pconn " << serverConnection()); - n_tries++; + ++n_tries; if (!serverConnection()->getPeer()) - origin_tries++; + ++origin_tries; comm_add_close_handler(serverConnection()->fd, fwdServerClosedWrapper, this); @@ -987,7 +1029,7 @@ #endif if (serverConnection()->getPeer() != NULL) { - serverConnection()->getPeer()->stats.fetches++; + ++ serverConnection()->getPeer()->stats.fetches; request->peer_login = serverConnection()->getPeer()->login; request->peer_domain = serverConnection()->getPeer()->domain; httpStart(this); @@ -1116,19 +1158,19 @@ int j; storeAppendPrintf(s, "Status"); - for (j = 0; j <= MAX_FWD_STATS_IDX; j++) { - storeAppendPrintf(s, "\ttry#%d", j + 1); + for (j = 1; j < MAX_FWD_STATS_IDX; ++j) { + storeAppendPrintf(s, "\ttry#%d", j); } storeAppendPrintf(s, "\n"); - for (i = 0; i <= (int) HTTP_INVALID_HEADER; i++) { + for (i = 0; i <= (int) HTTP_INVALID_HEADER; ++i) { if (FwdReplyCodes[0][i] == 0) continue; storeAppendPrintf(s, "%3d", i); - for (j = 0; j <= MAX_FWD_STATS_IDX; j++) { + for (j = 0; j <= MAX_FWD_STATS_IDX; ++j) { storeAppendPrintf(s, "\t%d", FwdReplyCodes[j][i]); } @@ -1204,7 +1246,7 @@ if (tries > MAX_FWD_STATS_IDX) tries = MAX_FWD_STATS_IDX; - FwdReplyCodes[tries][status]++; + ++ FwdReplyCodes[tries][status]; } /**** PRIVATE NON-MEMBER FUNCTIONS ********************************************/ diff -u -r -N squid-3.2.0.18/src/forward.h squid-3.2.0.19/src/forward.h --- squid-3.2.0.18/src/forward.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/forward.h 2012-08-03 00:14:34.000000000 +1200 @@ -3,6 +3,8 @@ /* forward decls */ +class AccessLogEntry; +typedef RefCount AccessLogEntryPointer; class ErrorState; class HttpRequest; @@ -32,6 +34,9 @@ ~FwdState(); static void initModule(); + /// Initiates request forwarding to a peer or origin server. + static void Start(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp); + /// Same as Start() but no master xaction info (AccessLogEntry) available. static void fwdStart(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *); /// This is the real beginning of server connection. Call it whenever @@ -66,9 +71,10 @@ private: // hidden for safer management of self; use static fwdStart - FwdState(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *); + FwdState(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp); void start(Pointer aSelf); + void selectPeerForIntercepted(); static void logReplyStatus(int tries, http_status status); void doneWithRetries(); void completed(); @@ -79,6 +85,8 @@ public: StoreEntry *entry; HttpRequest *request; + AccessLogEntryPointer al; ///< info for the future access.log entry + static void abort(void*); private: diff -u -r -N squid-3.2.0.18/src/fqdncache.cc squid-3.2.0.19/src/fqdncache.cc --- squid-3.2.0.18/src/fqdncache.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fqdncache.cc 2012-08-03 00:14:34.000000000 +1200 @@ -175,7 +175,7 @@ int k; hash_remove_link(fqdn_table, (hash_link *) f); - for (k = 0; k < (int) f->name_count; k++) + for (k = 0; k < (int) f->name_count; ++k) safe_free(f->names[k]); debugs(35, 5, "fqdncacheRelease: Released FQDN record for '" << hashKeyStr(&f->hash) << "'."); @@ -247,7 +247,7 @@ fqdncacheRelease(f); - removed++; + ++removed; } debugs(35, 9, "fqdncache_purgelru: removed " << removed << " entries"); @@ -440,7 +440,7 @@ debugs(35, 3, "fqdncacheParse: " << nr << " answers for '" << name << "'"); assert(answers); - for (k = 0; k < nr; k++) { + for (k = 0; k < nr; ++k) { if (answers[k]._class != RFC1035_CLASS_IN) continue; @@ -455,7 +455,8 @@ continue; } - f->names[f->name_count++] = xstrdup(answers[k].rdata); + f->names[f->name_count] = xstrdup(answers[k].rdata); + ++ f->name_count; } else if (answers[k].type != RFC1035_TYPE_CNAME) continue; @@ -535,7 +536,7 @@ generic_cbdata *c; addr.NtoA(name,MAX_IPSTRLEN); debugs(35, 4, "fqdncache_nbgethostbyaddr: Name '" << name << "'."); - FqdncacheStats.requests++; + ++FqdncacheStats.requests; if (name[0] == '\0') { debugs(35, 4, "fqdncache_nbgethostbyaddr: Invalid name!"); @@ -559,9 +560,9 @@ debugs(35, 4, "fqdncache_nbgethostbyaddr: HIT for '" << name << "'"); if (f->flags.negcached) - FqdncacheStats.negative_hits++; + ++ FqdncacheStats.negative_hits; else - FqdncacheStats.hits++; + ++ FqdncacheStats.hits; f->handler = handler; @@ -573,7 +574,7 @@ } debugs(35, 5, "fqdncache_nbgethostbyaddr: MISS for '" << name << "'"); - FqdncacheStats.misses++; + ++ FqdncacheStats.misses; f = fqdncacheCreateEntry(name); f->handler = handler; f->handlerData = cbdataReference(handlerData); @@ -654,7 +655,7 @@ } addr.NtoA(name,MAX_IPSTRLEN); - FqdncacheStats.requests++; + ++ FqdncacheStats.requests; f = fqdncache_get(name); if (NULL == f) { @@ -663,11 +664,11 @@ fqdncacheRelease(f); f = NULL; } else if (f->flags.negcached) { - FqdncacheStats.negative_hits++; + ++ FqdncacheStats.negative_hits; // ignore f->error_message: the caller just checks FQDN cache presence return NULL; } else { - FqdncacheStats.hits++; + ++ FqdncacheStats.hits; f->lastref = squid_curtime; // ignore f->error_message: the caller just checks FQDN cache presence return f->names[0]; @@ -675,7 +676,7 @@ /* no entry [any more] */ - FqdncacheStats.misses++; + ++ FqdncacheStats.misses; if (flags & FQDN_LOOKUP_IF_MISS) { fqdncache_nbgethostbyaddr(addr, NULL, NULL); @@ -736,7 +737,7 @@ ttl, (int) f->name_count); - for (k = 0; k < (int) f->name_count; k++) + for (k = 0; k < (int) f->name_count; ++k) storeAppendPrintf(sentry, " %s", f->names[k]); storeAppendPrintf(sentry, "\n"); @@ -775,7 +776,7 @@ fqdncacheUnlockEntry(fqdncache_entry * f) { assert(f->locks > 0); - f->locks--; + -- f->locks; if (fqdncacheExpiredEntry(f)) fqdncacheRelease(f); @@ -788,7 +789,7 @@ fqdncache_entry *f = (fqdncache_entry *)data; int k; - for (k = 0; k < (int) f->name_count; k++) + for (k = 0; k < (int) f->name_count; ++k) safe_free(f->names[k]); safe_free(f->hash.key); @@ -857,7 +858,7 @@ while (hostnames) { fce->names[j] = xstrdup(hostnames->key); Tolower(fce->names[j]); - j++; + ++j; hostnames = hostnames->next; if (j >= FQDN_MAX_NAMES) diff -u -r -N squid-3.2.0.18/src/fs/coss/store_dir_coss.cc squid-3.2.0.19/src/fs/coss/store_dir_coss.cc --- squid-3.2.0.18/src/fs/coss/store_dir_coss.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fs/coss/store_dir_coss.cc 2012-08-03 00:14:34.000000000 +1200 @@ -96,7 +96,7 @@ while (strlen(pathtmp) && pathtmp[strlen(pathtmp) - 1] == '.') pathtmp[strlen(pathtmp) - 1] = '\0'; - for (pathtmp2 = pathtmp; *pathtmp2 == '.'; pathtmp2++); + for (pathtmp2 = pathtmp; *pathtmp2 == '.'; ++pathtmp2); snprintf(path, MAXPATHLEN - 64, Config.Log.swap, pathtmp2); if (strncmp(path, Config.Log.swap, MAXPATHLEN - 64) == 0) { @@ -174,7 +174,7 @@ cstate->flags.reading = 0; if (errflag) { - StoreFScoss::GetInstance().stats.read.fail++; + ++ StoreFScoss::GetInstance().stats.read.fail; if (errflag > 0) { errno = errflag; @@ -185,7 +185,7 @@ rlen = -1; } else { - StoreFScoss::GetInstance().stats.read.success++; + ++ StoreFScoss::GetInstance().stats.read.success; if (cstate->readbuffer == NULL) { cstate->readbuffer = (char *)xmalloc(cstate->st_size); @@ -217,17 +217,17 @@ if (errflag) { - StoreFScoss::GetInstance().stats.stripe_write.fail++; + ++ StoreFScoss::GetInstance().stats.stripe_write.fail; debugs(79, 1, "storeCossWriteMemBufDone: got failure (" << errflag << ")"); debugs(79, 1, "size=" << cossWrite->membuf->diskend - cossWrite->membuf->diskstart); } else { - StoreFScoss::GetInstance().stats.stripe_write.success++; + ++ StoreFScoss::GetInstance().stats.stripe_write.success; } dlinkDelete(&cossWrite->membuf->node, &membufs); cbdataFree(cossWrite->membuf); - StoreFScoss::GetInstance().stats.stripes--; + -- StoreFScoss::GetInstance().stats.stripes; } void @@ -368,7 +368,7 @@ RebuildState *rb = (RebuildState *)data; CossSwapDir *sd = rb->sd; sd->startMembuf(); - StoreController::store_dirs_rebuilding--; + -- StoreController::store_dirs_rebuilding; storeCossDirCloseTmpSwapLog(rb->sd); storeRebuildComplete(&rb->counts); cbdataFree(rb); @@ -385,7 +385,7 @@ assert(rb != NULL); /* load a number of objects per invocation */ - for (int aCount = 0; aCount < rb->speed; aCount++) { + for (int aCount = 0; aCount < rb->speed; ++aCount) { if (fread(&s, ss, 1, rb->log) != 1) { debugs(47, 1, "Done reading " << rb->sd->path << " swaplog (" << rb->n_read << " entries)"); fclose(rb->log); @@ -394,7 +394,7 @@ return; } - rb->n_read++; + ++ rb->n_read; if (s.op <= SWAP_LOG_NOP) continue; @@ -430,8 +430,8 @@ e->release(); /* Fake an unlink here, this is a bad hack :( */ storeCossRemove(rb->sd, e); - rb->counts.objcount--; - rb->counts.cancelcount++; + -- rb->counts.objcount; + ++ rb->counts.cancelcount; } continue; } else { @@ -441,7 +441,7 @@ (int) x) debugs(47, 1, "WARNING: " << rb->counts.bad_log_op << " invalid swap log entries found"); - rb->counts.invalid++; + ++ rb->counts.invalid; continue; } @@ -456,7 +456,7 @@ } if (EBIT_TEST(s.flags, KEY_PRIVATE)) { - rb->counts.badflags++; + ++ rb->counts.badflags; continue; } @@ -466,11 +466,11 @@ if (e) { /* key already exists, current entry is newer */ /* keep old, ignore new */ - rb->counts.dupcount++; + ++ rb->counts.dupcount; continue; } - rb->counts.objcount++; + ++ rb->counts.objcount; e = rb->sd->addDiskRestore(s.key, s.swap_filen, @@ -557,7 +557,7 @@ fp = storeCossDirOpenTmpSwapLog(sd, &clean, &zero); debugs(47, 1, "Rebuilding COSS storage in " << sd->path << " (" << (clean ? "CLEAN" : "DIRTY") << ")"); rb->log = fp; - StoreController::store_dirs_rebuilding++; + ++ StoreController::store_dirs_rebuilding; if (!clean || fp == NULL) { /* COSS cannot yet rebuild from a dirty state. If the log @@ -941,7 +941,7 @@ closeLog(); - n_coss_dirs--; + --n_coss_dirs; safe_free(ioModule); @@ -1106,7 +1106,7 @@ int check = blksz; while (check > 1) { - nbits++; + ++nbits; check >>= 1; } diff -u -r -N squid-3.2.0.18/src/fs/coss/store_io_coss.cc squid-3.2.0.19/src/fs/coss/store_io_coss.cc --- squid-3.2.0.18/src/fs/coss/store_io_coss.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fs/coss/store_io_coss.cc 2012-08-03 00:14:34.000000000 +1200 @@ -71,10 +71,10 @@ if (which == COSS_ALLOC_REALLOC) { checkf = e->swap_filen; - StoreFScoss::GetInstance().stats.alloc.realloc++; + ++ StoreFScoss::GetInstance().stats.alloc.realloc; } else { checkf = -1; - StoreFScoss::GetInstance().stats.alloc.alloc++; + ++ StoreFScoss::GetInstance().stats.alloc.alloc; } if (e->swap_file_sz > 0) @@ -88,7 +88,7 @@ * tried to allocate past the end of the disk, so wrap * back to the beginning */ - StoreFScoss::GetInstance().stats.disk_overflows++; + ++ StoreFScoss::GetInstance().stats.disk_overflows; current_membuf->flags.full = 1; current_membuf->diskend = current_offset; current_membuf->maybeWrite(this); @@ -103,7 +103,7 @@ /* * Skip the blank space at the end of the stripe. start over. */ - StoreFScoss::GetInstance().stats.stripe_overflows++; + ++ StoreFScoss::GetInstance().stats.stripe_overflows; current_membuf->flags.full = 1; current_offset = current_membuf->diskend; current_membuf->maybeWrite(this); @@ -123,7 +123,7 @@ current_offset = ((current_offset + blksz_mask) >> blksz_bits ) << blksz_bits; return storeCossDiskOffsetToFileno(retofs); } else { - StoreFScoss::GetInstance().stats.alloc.collisions++; + ++ StoreFScoss::GetInstance().stats.alloc.collisions; debugs(79, 3, "CossSwapDir::allocate: Collision"); return -1; } @@ -144,8 +144,8 @@ cur_size -= fs.blksize * sizeInBlocks(e.swap_file_sz); --n_disk_objects; } - StoreFScoss::GetInstance().stats.unlink.ops++; - StoreFScoss::GetInstance().stats.unlink.success++; + ++ StoreFScoss::GetInstance().stats.unlink.ops; + ++ StoreFScoss::GetInstance().stats.unlink.success; storeCossRemove(this, &e); } @@ -163,7 +163,7 @@ * the squid code is broken */ assert(e.mem_obj->object_sz != -1); - StoreFScoss::GetInstance().stats.create.ops++; + ++ StoreFScoss::GetInstance().stats.create.ops; /* * this one is kinda strange - Eric called allocate(), then @@ -194,7 +194,7 @@ storeCossAdd(this, &e); cstate->lockMemBuf(); - StoreFScoss::GetInstance().stats.create.success++; + ++ StoreFScoss::GetInstance().stats.create.success; return sio; } @@ -207,7 +207,7 @@ sfileno f = e.swap_filen; debugs(79, 3, "storeCossOpen: offset " << f); - StoreFScoss::GetInstance().stats.open.ops++; + ++ StoreFScoss::GetInstance().stats.open.ops; StoreIOState::Pointer sio = new CossState (this); cstate = dynamic_cast(sio.getRaw()); @@ -232,14 +232,14 @@ if (p) { cstate->readbuffer = (char *)xmalloc(cstate->st_size); memcpy(cstate->readbuffer, p, cstate->st_size); - StoreFScoss::GetInstance().stats.open_mem_hits++; + ++ StoreFScoss::GetInstance().stats.open_mem_hits; } else { /* Do the allocation */ /* this is the first time we've been called on a new sio * read the whole object into memory, then return the * requested amount */ - StoreFScoss::GetInstance().stats.open_mem_misses++; + ++ StoreFScoss::GetInstance().stats.open_mem_misses; /* * This bit of code actually does the LRU disk thing - we realloc * a place for the object here, and the file_read() reads the object @@ -251,8 +251,8 @@ if (sio->swap_filen == -1) { /* We have to clean up neatly .. */ - StoreFScoss::GetInstance().stats.open.fail++; - numcollisions++; + ++ StoreFScoss::GetInstance().stats.open.fail; + ++numcollisions; debugs(79, 2, "storeCossOpen: Reallocation of " << e.swap_dirn << "/" << e.swap_filen << " failed"); /* XXX XXX XXX Will squid call storeUnlink for this object? */ return NULL; @@ -281,7 +281,7 @@ */ } - StoreFScoss::GetInstance().stats.open.success++; + ++ StoreFScoss::GetInstance().stats.open.success; return sio; } @@ -291,8 +291,8 @@ { debugs(79, 3, "storeCossClose: offset " << swap_filen); - StoreFScoss::GetInstance().stats.close.ops++; - StoreFScoss::GetInstance().stats.close.success++; + ++ StoreFScoss::GetInstance().stats.close.ops; + ++ StoreFScoss::GetInstance().stats.close.success; SD->storeCossMemBufUnlock(this); doCallback(0); } @@ -303,7 +303,7 @@ char *p; CossSwapDir *SD = (CossSwapDir *)INDEXSD(swap_dirn); - StoreFScoss::GetInstance().stats.read.ops++; + ++ StoreFScoss::GetInstance().stats.read.ops; assert(read.callback == NULL); assert(read.callback_data == NULL); read.callback = callback; @@ -348,7 +348,7 @@ * the squid code is broken */ assert(e->mem_obj->object_sz != -1); - StoreFScoss::GetInstance().stats.write.ops++; + ++ StoreFScoss::GetInstance().stats.write.ops; debugs(79, 3, "storeCossWrite: offset " << offset_ << ", len " << (unsigned long int) size); diskoffset = SD->storeCossFilenoToDiskOffset(swap_filen) + offset_; @@ -361,7 +361,7 @@ if (free_func) (free_func) ((char *)buf); - StoreFScoss::GetInstance().stats.write.success++; + ++ StoreFScoss::GetInstance().stats.write.success; } off_t @@ -484,7 +484,7 @@ debugs(79, 3, "storeCossMemBufUnlock: unlocking " << t << ", lockcount " << t->lockcount); - t->lockcount--; + -- t->lockcount; cstate->locked_membuf = NULL; @@ -542,7 +542,7 @@ void CossMemBuf::write(CossSwapDir * SD) { - StoreFScoss::GetInstance().stats.stripe_write.ops++; + ++ StoreFScoss::GetInstance().stats.stripe_write.ops; debugs(79, 3, "CossMemBuf::write: offset " << diskstart << ", len " << (diskend - diskstart)); flags.writing = 1; /* XXX Remember that diskstart/diskend are block offsets! */ @@ -594,7 +594,7 @@ if ((o >= (off_t)newmb->diskstart) && (o < (off_t)newmb->diskend)) { e->release(); - numreleased++; + ++numreleased; } else break; } @@ -602,7 +602,7 @@ if (numreleased > 0) debugs(79, 3, "CossSwapDir::createMemBuf: this allocation released " << numreleased << " storeEntries"); - StoreFScoss::GetInstance().stats.stripes++; + ++ StoreFScoss::GetInstance().stats.stripes; return newmb; } diff -u -r -N squid-3.2.0.18/src/fs/rock/RockRebuild.cc squid-3.2.0.19/src/fs/rock/RockRebuild.cc --- squid-3.2.0.18/src/fs/rock/RockRebuild.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fs/rock/RockRebuild.cc 2012-08-03 00:14:34.000000000 +1200 @@ -143,7 +143,7 @@ if (buf.contentSize() < static_cast(sizeof(header))) { debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " << "Ignoring truncated cache entry meta data at " << dbOffset); - counts.invalid++; + ++counts.invalid; return; } memcpy(&header, buf.content(), sizeof(header)); @@ -151,7 +151,7 @@ if (!header.sane()) { debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " << "Ignoring malformed cache entry meta data at " << dbOffset); - counts.invalid++; + ++counts.invalid; return; } buf.consume(sizeof(header)); // optimize to avoid memmove() @@ -161,7 +161,7 @@ if (!storeRebuildParseEntry(buf, loadedE, key, counts, header.payloadSize)) { // skip empty slots if (loadedE.swap_filen > 0 || loadedE.swap_file_sz > 0) { - counts.invalid++; + ++counts.invalid; //sd->unlink(filen); leave garbage on disk, it should not hurt } return; @@ -171,7 +171,7 @@ if (!storeRebuildKeepEntry(loadedE, key, counts)) return; - counts.objcount++; + ++counts.objcount; // loadedE->dump(5); sd->addEntry(filen, header, loadedE); diff -u -r -N squid-3.2.0.18/src/fs/ufs/store_dir_ufs.cc squid-3.2.0.19/src/fs/ufs/store_dir_ufs.cc --- squid-3.2.0.18/src/fs/ufs/store_dir_ufs.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fs/ufs/store_dir_ufs.cc 2012-08-03 00:14:34.000000000 +1200 @@ -395,7 +395,7 @@ if (!e) break; /* no more objects */ - removed++; + ++removed; e->release(); } @@ -557,7 +557,7 @@ if (!pathIsDirectory(path)) return true; - for (int j = 0; j < l1; j++) { + for (int j = 0; j < l1; ++j) { char const *aPath = swapSubDir(j); if (!pathIsDirectory(aPath)) @@ -572,7 +572,7 @@ { LOCAL_ARRAY(char, name, MAXPATHLEN); - for (int i = 0; i < l1; i++) { + for (int i = 0; i < l1; ++i) { snprintf(name, MAXPATHLEN, "%s/%02X", path, i); int should_exist; @@ -584,7 +584,7 @@ debugs(47, 1, "Making directories in " << name); - for (int k = 0; k < l2; k++) { + for (int k = 0; k < l2; ++k) { snprintf(name, MAXPATHLEN, "%s/%02X/%02X", path, i, k); createDirectory(name, should_exist); } @@ -609,7 +609,7 @@ while (strlen(pathtmp) && pathtmp[strlen(pathtmp) - 1] == '.') pathtmp[strlen(pathtmp) - 1] = '\0'; - for (pathtmp2 = pathtmp; *pathtmp2 == '.'; pathtmp2++); + for (pathtmp2 = pathtmp; *pathtmp2 == '.'; ++pathtmp2); snprintf(lpath, MAXPATHLEN - 64, Config.Log.swap, pathtmp2); if (strncmp(lpath, Config.Log.swap, MAXPATHLEN - 64) == 0) { @@ -729,6 +729,19 @@ } void +UFSSwapDir::undoAddDiskRestore(StoreEntry *e) +{ + debugs(47, 5, HERE << *e); + replacementRemove(e); // checks swap_dirn so do it before we invalidate it + // Do not unlink the file as it might be used by a subsequent entry. + mapBitReset(e->swap_filen); + e->swap_filen = -1; + e->swap_dirn = -1; + cur_size -= fs.blksize * sizeInBlocks(e->swap_file_sz); + --n_disk_objects; +} + +void UFSSwapDir::rebuild() { ++StoreController::store_dirs_rebuilding; @@ -1132,7 +1145,8 @@ if (UFSSwapDir::FilenoBelongsHere(fn, D0, D1, D2)) continue; - files[k++] = swapfileno; + files[k] = swapfileno; + ++k; } closedir(dir_pointer); @@ -1145,7 +1159,7 @@ if (k > 10) k = 10; - for (n = 0; n < k; n++) { + for (n = 0; n < k; ++n) { debugs(36, 3, "storeDirClean: Cleaning file "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << files[n]); snprintf(p2, MAXPATHLEN + 1, "%s/%08X", p1, files[n]); safeunlink(p2, 0); @@ -1177,7 +1191,7 @@ */ UFSDirToGlobalDirMapping = (int *)xcalloc(NumberOfUFSDirs, sizeof(*UFSDirToGlobalDirMapping)); - for (i = 0, n = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0, n = 0; i < Config.cacheSwap.n_configured; ++i) { /* This is bogus, the controller should just clean each instance once */ sd = dynamic_cast (INDEXSD(i)); @@ -1188,7 +1202,8 @@ assert (usd); - UFSDirToGlobalDirMapping[n++] = i; + UFSDirToGlobalDirMapping[n] = i; + ++n; j += (usd->l1 * usd->l2); } @@ -1205,7 +1220,7 @@ /* if the rebuild is finished, start cleaning directories. */ if (0 == StoreController::store_dirs_rebuilding) { n = DirClean(swap_index); - swap_index++; + ++swap_index; } eventAdd("storeDirClean", CleanEvent, NULL, @@ -1305,7 +1320,7 @@ { debugs(79, 3, "storeUfsUnlink: dirno " << index << ", fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e.swap_filen); - if (e.swap_status == SWAPOUT_DONE && EBIT_TEST(e.flags, ENTRY_VALIDATED)) { + if (e.swap_status == SWAPOUT_DONE) { cur_size -= fs.blksize * sizeInBlocks(e.swap_file_sz); --n_disk_objects; } diff -u -r -N squid-3.2.0.18/src/fs/ufs/ufscommon.cc squid-3.2.0.19/src/fs/ufs/ufscommon.cc --- squid-3.2.0.18/src/fs/ufs/ufscommon.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fs/ufs/ufscommon.cc 2012-08-03 00:14:34.000000000 +1200 @@ -386,7 +386,7 @@ if (!rb->isDone()) eventAdd("storeRebuild", RebuildStep, rb, 0.01, 1); else { - StoreController::store_dirs_rebuilding--; + -- StoreController::store_dirs_rebuilding; storeRebuildComplete(&rb->counts); delete rb; } @@ -457,12 +457,12 @@ assert(fd > -1); /* lets get file stats here */ - n_read++; + ++n_read; if (fstat(fd, &sb) < 0) { debugs(47, 1, "commonUfsDirRebuildFromDirectory: fstat(FD " << fd << "): " << xstrerror()); file_close(fd); - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; return; } @@ -477,7 +477,7 @@ (int64_t)sb.st_size); file_close(fd); - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; if (!loaded) { @@ -489,7 +489,7 @@ if (!storeRebuildKeepEntry(tmpe, key, counts)) return; - counts.objcount++; + ++counts.objcount; // tmpe.dump(5); currentEntry(sd->addDiskRestore(key, filn, @@ -531,10 +531,10 @@ return; } - n_read++; + ++n_read; if (!swapData.sane()) { - counts.invalid++; + ++counts.invalid; return; } @@ -567,27 +567,9 @@ currentEntry (Store::Root().get(swapData.key)); if (currentEntry() != NULL && swapData.lastref >= e->lastref) { - /* - * Make sure we don't unlink the file, it might be - * in use by a subsequent entry. Also note that - * we don't have to subtract from cur_size because - * adding to cur_size happens in the cleanup procedure. - */ - currentEntry()->expireNow(); - currentEntry()->releaseRequest(); - - if (currentEntry()->swap_filen > -1) { - UFSSwapDir *sdForThisEntry = dynamic_cast(INDEXSD(currentEntry()->swap_dirn)); - assert (sdForThisEntry); - sdForThisEntry->replacementRemove(currentEntry()); - sdForThisEntry->mapBitReset(currentEntry()->swap_filen); - currentEntry()->swap_filen = -1; - currentEntry()->swap_dirn = -1; - } - - currentEntry()->release(); - counts.objcount--; - counts.cancelcount++; + undoAdd(); + --counts.objcount; + ++counts.cancelcount; } return; } else { @@ -597,7 +579,7 @@ if (0.0 == x - (double) (int) x) debugs(47, 1, "WARNING: " << counts.bad_log_op << " invalid swap log entries found"); - counts.invalid++; + ++counts.invalid; return; } @@ -605,12 +587,12 @@ ++counts.scancount; // XXX: should not this be incremented earlier? if (!sd->validFileno(swapData.swap_filen, 0)) { - counts.invalid++; + ++counts.invalid; return; } if (EBIT_TEST(swapData.flags, KEY_PRIVATE)) { - counts.badflags++; + ++counts.badflags; return; } @@ -634,7 +616,7 @@ if (used && !disk_entry_newer) { /* log entry is old, ignore it */ - counts.clashcount++; + ++counts.clashcount; return; } else if (used && currentEntry() && currentEntry()->swap_filen == swapData.swap_filen && currentEntry()->swap_dirn == sd->index) { /* swapfile taken, same URL, newer, update meta */ @@ -672,37 +654,26 @@ * were in a slow rebuild and the the swap file number got taken * and the validation procedure hasn't run. */ assert(flags.need_to_validate); - counts.clashcount++; + ++counts.clashcount; return; } else if (currentEntry() && !disk_entry_newer) { /* key already exists, current entry is newer */ /* keep old, ignore new */ - counts.dupcount++; + ++counts.dupcount; return; } else if (currentEntry()) { /* key already exists, this swapfile not being used */ /* junk old, load new */ - currentEntry()->expireNow(); - currentEntry()->releaseRequest(); - - if (currentEntry()->swap_filen > -1) { - UFSSwapDir *sdForThisEntry = dynamic_cast(INDEXSD(currentEntry()->swap_dirn)); - sdForThisEntry->replacementRemove(currentEntry()); - /* Make sure we don't actually unlink the file */ - sdForThisEntry->mapBitReset(currentEntry()->swap_filen); - currentEntry()->swap_filen = -1; - currentEntry()->swap_dirn = -1; - } - - currentEntry()->release(); - counts.dupcount++; + undoAdd(); + --counts.objcount; + ++counts.dupcount; } else { /* URL doesnt exist, swapfile not in use */ /* load new */ (void) 0; } - counts.objcount++; + ++counts.objcount; currentEntry(sd->addDiskRestore(swapData.key, swapData.swap_filen, @@ -718,6 +689,27 @@ storeDirSwapLog(currentEntry(), SWAP_LOG_ADD); } +/// undo the effects of adding an entry in rebuildFromSwapLog() +void +RebuildState::undoAdd() +{ + StoreEntry *added = currentEntry(); + assert(added); + currentEntry(NULL); + + // TODO: Why bother with these two if we are going to release?! + added->expireNow(); + added->releaseRequest(); + + if (added->swap_filen > -1) { + UFSSwapDir *sde = dynamic_cast(INDEXSD(added->swap_dirn)); + assert(sde); + sde->undoAddDiskRestore(added); + } + + added->release(); +} + int RebuildState::getNextFile(sfileno * filn_p, int *size) { @@ -753,7 +745,7 @@ td = opendir(fullpath); - dirs_opened++; + ++dirs_opened; if (td == NULL) { debugs(47, 1, "commonUfsDirGetNextFile: opendir: " << fullpath << ": " << xstrerror()); @@ -768,7 +760,7 @@ } if (td != NULL && (entry = readdir(td)) != NULL) { - in_dir++; + ++in_dir; if (sscanf(entry->d_name, "%x", &fn) != 1) { debugs(47, 3, "commonUfsDirGetNextFile: invalid " << entry->d_name); @@ -797,7 +789,7 @@ if (fd < 0) debugs(47, 1, "commonUfsDirGetNextFile: " << fullfilename << ": " << xstrerror()); else - store_open_disk_fd++; + ++store_open_disk_fd; continue; } diff -u -r -N squid-3.2.0.18/src/fs/ufs/ufscommon.h squid-3.2.0.19/src/fs/ufs/ufscommon.h --- squid-3.2.0.18/src/fs/ufs/ufscommon.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/fs/ufs/ufscommon.h 2012-08-03 00:14:34.000000000 +1200 @@ -104,6 +104,8 @@ uint32_t refcount, uint16_t flags, int clean); + /// Undo the effects of UFSSwapDir::addDiskRestore(). + void undoAddDiskRestore(StoreEntry *e); int validFileno(sfileno filn, int flag) const; int mapBitAllocate(); virtual ConfigOption *getOptionTree() const; @@ -404,6 +406,7 @@ void rebuildFromDirectory(); void rebuildFromSwapLog(); void rebuildStep(); + void undoAdd(); int getNextFile(sfileno *, int *size); StoreEntry *currentEntry() const; void currentEntry(StoreEntry *); diff -u -r -N squid-3.2.0.18/src/ftp.cc squid-3.2.0.19/src/ftp.cc --- squid-3.2.0.18/src/ftp.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ftp.cc 2012-08-03 00:14:34.000000000 +1200 @@ -485,8 +485,8 @@ { const char *url = entry->url(); debugs(9, 3, HERE << "'" << url << "'" ); - statCounter.server.all.requests++; - statCounter.server.ftp.requests++; + ++ statCounter.server.all.requests; + ++ statCounter.server.ftp.requests; theSize = -1; mdtm = -1; @@ -711,7 +711,7 @@ { int i; - for (i = 0; i < 12; i++) + for (i = 0; i < 12; ++i) if (!strcasecmp(buf, Month[i])) return 1; @@ -779,13 +779,15 @@ return p; } - for (t = strtok(xbuf, w_space); t && n_tokens < MAX_TOKENS; t = strtok(NULL, w_space)) - tokens[n_tokens++] = xstrdup(t); + for (t = strtok(xbuf, w_space); t && n_tokens < MAX_TOKENS; t = strtok(NULL, w_space)) { + tokens[n_tokens] = xstrdup(t); + ++n_tokens; + } xfree(xbuf); /* locate the Month field */ - for (i = 3; i < n_tokens - 2; i++) { + for (i = 3; i < n_tokens - 2; ++i) { char *size = tokens[i - 1]; char *month = tokens[i]; char *day = tokens[i + 1]; @@ -821,7 +823,7 @@ copyFrom += strlen(tbuf); while (strchr(w_space, *copyFrom)) - copyFrom++; + ++copyFrom; } else { /* XXX assumes a single space between date and filename * suggested by: Nathan.Bailey@cc.monash.edu.au and @@ -862,7 +864,7 @@ ct += strlen(tokens[2]); while (xisspace(*ct)) - ct++; + ++ct; if (!*ct) ct = NULL; @@ -936,7 +938,7 @@ ct = strstr(ct, ","); if (ct) { - ct++; + ++ct; } } @@ -952,7 +954,7 @@ found: - for (i = 0; i < n_tokens; i++) + for (i = 0; i < n_tokens; ++i) xfree(tokens[i]); if (!p->name) @@ -998,7 +1000,7 @@ html->init(); html->Printf("%s\n", line); - for (p = line; *p && xisspace(*p); p++); + for (p = line; *p && xisspace(*p); ++p); if (*p && !xisspace(*p)) flags.listformat_unknown = 1; @@ -1124,7 +1126,7 @@ end = sbuf + len - 1; while (*end != '\r' && *end != '\n' && end > sbuf) - end--; + --end; usable = end - sbuf; @@ -1145,7 +1147,7 @@ debugs(9, 3, HERE << (unsigned long int)len << " bytes to play with"); line = (char *)memAllocate(MEM_4K_BUF); - end++; + ++end; s = sbuf; s += strspn(s, crlf); @@ -1279,12 +1281,12 @@ DelayId delayId = entry->mem_obj->mostBytesAllowed(); delayId.bytesIn(io.size); #endif - IOStats.Ftp.reads++; + ++ IOStats.Ftp.reads; - for (j = io.size - 1, bin = 0; j; bin++) + for (j = io.size - 1, bin = 0; j; ++bin) j >>= 1; - IOStats.Ftp.read_hist[bin]++; + ++ IOStats.Ftp.read_hist[bin]; } if (io.flag != COMM_OK) { @@ -1557,20 +1559,24 @@ unsigned const char *p; unsigned char *r; - for (p = (unsigned const char *)buf, n = 1; *p; n++, p++) + for (p = (unsigned const char *)buf, n = 1; *p; ++n, ++p) if (*p == 255) - n++; + ++n; ret = (char *)xmalloc(n); - for (p = (unsigned const char *)buf, r=(unsigned char *)ret; *p; p++) { - *r++ = *p; + for (p = (unsigned const char *)buf, r=(unsigned char *)ret; *p; ++p) { + *r = *p; + ++r; - if (*p == 255) - *r++ = 255; + if (*p == 255) { + *r = 255; + ++r; + } } - *r++ = '\0'; + *r = '\0'; + ++r; assert((r - (unsigned char *)ret) == n ); return ret; } @@ -1652,7 +1658,7 @@ end = sbuf + len - 1; while (*end != '\r' && *end != '\n' && end > sbuf) - end--; + --end; usable = end - sbuf; @@ -1665,7 +1671,7 @@ } debugs(9, 3, HERE << len << " bytes to play with"); - end++; + ++end; s = sbuf; s += strspn(s, crlf); @@ -1865,7 +1871,7 @@ debugs(9, 3, HERE); if (ftpState->flags.pasv_only) - ftpState->login_att++; + ++ ftpState->login_att; if (code == 220) { if (ftpState->ctrl.message) { @@ -2099,14 +2105,16 @@ p = path = xstrdup(ftpState->request->urlpath.termedBuf()); if (*p == '/') - p++; + ++p; while (*p) { d = p; p += strcspn(p, "/"); - if (*p) - *p++ = '\0'; + if (*p) { + *p = '\0'; + ++p; + } rfc1738_unescape(d); @@ -2395,8 +2403,10 @@ * which means close data + control without self-destructing and re-open from scratch. */ debugs(9, 5, HERE << "scanning: " << ftpState->ctrl.last_reply); buf = ftpState->ctrl.last_reply; - while (buf != NULL && *buf != '\0' && *buf != '\n' && *buf != '(') ++buf; - if (buf != NULL && *buf == '\n') ++buf; + while (buf != NULL && *buf != '\0' && *buf != '\n' && *buf != '(') + ++buf; + if (buf != NULL && *buf == '\n') + ++buf; if (buf == NULL || *buf == '\0') { /* handle broken server (RFC 2428 says MUST specify supported protocols in 522) */ diff -u -r -N squid-3.2.0.18/src/gopher.cc squid-3.2.0.19/src/gopher.cc --- squid-3.2.0.18/src/gopher.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/gopher.cc 2012-08-03 00:14:34.000000000 +1200 @@ -274,7 +274,7 @@ request[0] = '\0'; if (path && (*path == '/')) - path++; + ++path; if (!path || !*path) { *type_id = GOPHER_DIRECTORY; @@ -448,7 +448,7 @@ int left = len - (pos - inbuf); lpos = (char *)memchr(pos, '\n', left); if (lpos) { - lpos++; /* Next line is after \n */ + ++lpos; /* Next line is after \n */ llen = lpos - pos; } else { llen = left; @@ -492,16 +492,19 @@ case gopher_ds::HTML_DIR: { tline = line; - gtype = *tline++; + gtype = *tline; + ++tline; name = tline; selector = strchr(tline, TAB); if (selector) { - *selector++ = '\0'; + *selector = '\0'; + ++selector; host = strchr(selector, TAB); if (host) { - *host++ = '\0'; + *host = '\0'; + ++host; port = strchr(host, TAB); if (port) { @@ -779,12 +782,12 @@ if (flag == COMM_OK && len > 0) { AsyncCall::Pointer nil; commSetConnTimeout(conn, Config.Timeout.read, nil); - IOStats.Gopher.reads++; + ++IOStats.Gopher.reads; - for (clen = len - 1, bin = 0; clen; bin++) + for (clen = len - 1, bin = 0; clen; ++bin) clen >>= 1; - IOStats.Gopher.read_hist[bin]++; + ++IOStats.Gopher.read_hist[bin]; HttpRequest *req = gopherState->fwd->request; if (req->hier.bodyBytesRead < 0) @@ -921,7 +924,7 @@ const char *t = strchr(gopherState->request, '?'); if (t != NULL) - t++; /* skip the ? */ + ++t; /* skip the ? */ else t = ""; @@ -966,9 +969,9 @@ debugs(10, 3, "gopherStart: " << entry->url() ); - statCounter.server.all.requests++; + ++ statCounter.server.all.requests; - statCounter.server.other.requests++; + ++ statCounter.server.other.requests; /* Parse url. */ gopher_request_parse(fwd->request, diff -u -r -N squid-3.2.0.18/src/helper.cc squid-3.2.0.19/src/helper.cc --- squid-3.2.0.18/src/helper.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/helper.cc 2012-08-03 00:14:34.000000000 +1200 @@ -182,16 +182,20 @@ snprintf(procname, strlen(shortname) + 3, "(%s)", shortname); - args[nargs++] = procname; + args[nargs] = procname; + ++nargs; - for (w = hlp->cmdline->next; w && nargs < HELPER_MAX_ARGS; w = w->next) - args[nargs++] = w->key; + for (w = hlp->cmdline->next; w && nargs < HELPER_MAX_ARGS; w = w->next) { + args[nargs] = w->key; + ++nargs; + } - args[nargs++] = NULL; + args[nargs] = NULL; + ++nargs; assert(nargs <= HELPER_MAX_ARGS); - for (k = 0; k < need_new; k++) { + for (k = 0; k < need_new; ++k) { getCurrentTime(); rfd = wfd = -1; pid = ipcCreate(hlp->ipc_type, @@ -208,8 +212,8 @@ continue; } - hlp->childs.n_running++; - hlp->childs.n_active++; + ++ hlp->childs.n_running; + ++ hlp->childs.n_active; CBDATA_INIT_TYPE(helper_server); srv = cbdataAlloc(helper_server); srv->hIpc = hIpc; @@ -296,16 +300,20 @@ snprintf(procname, strlen(shortname) + 3, "(%s)", shortname); - args[nargs++] = procname; + args[nargs] = procname; + ++nargs; - for (wordlist *w = hlp->cmdline->next; w && nargs < HELPER_MAX_ARGS; w = w->next) - args[nargs++] = w->key; + for (wordlist *w = hlp->cmdline->next; w && nargs < HELPER_MAX_ARGS; w = w->next) { + args[nargs] = w->key; + ++nargs; + } - args[nargs++] = NULL; + args[nargs] = NULL; + ++nargs; assert(nargs <= HELPER_MAX_ARGS); - for (int k = 0; k < need_new; k++) { + for (int k = 0; k < need_new; ++k) { getCurrentTime(); int rfd = -1; int wfd = -1; @@ -324,8 +332,8 @@ continue; } - hlp->childs.n_running++; - hlp->childs.n_active++; + ++ hlp->childs.n_running; + ++ hlp->childs.n_active; CBDATA_INIT_TYPE(helper_stateful_server); helper_stateful_server *srv = cbdataAlloc(helper_stateful_server); srv->hIpc = hIpc; @@ -456,7 +464,7 @@ if (!srv->flags.reserved) return; - srv->stats.releases++; + ++ srv->stats.releases; srv->flags.reserved = 0; if (srv->parent->OnEmptyQueue != NULL && srv->data) @@ -599,7 +607,7 @@ } assert(hlp->childs.n_active > 0); - hlp->childs.n_active--; + -- hlp->childs.n_active; srv->flags.shutdown = 1; /* request it to shut itself down */ if (srv->flags.closing) { @@ -636,7 +644,7 @@ } assert(hlp->childs.n_active > 0); - hlp->childs.n_active--; + -- hlp->childs.n_active; srv->flags.shutdown = 1; /* request it to shut itself down */ if (srv->flags.busy) { @@ -709,11 +717,11 @@ dlinkDelete(&srv->link, &hlp->servers); assert(hlp->childs.n_running > 0); - hlp->childs.n_running--; + -- hlp->childs.n_running; if (!srv->flags.shutdown) { assert(hlp->childs.n_active > 0); - hlp->childs.n_active--; + -- hlp->childs.n_active; debugs(84, DBG_CRITICAL, "WARNING: " << hlp->id_name << " #" << srv->index + 1 << " exited"); if (hlp->childs.needNew() > 0) { @@ -727,7 +735,7 @@ } } - for (i = 0; i < concurrency; i++) { + for (i = 0; i < concurrency; ++i) { if ((r = srv->requests[i])) { void *cbdata; @@ -770,11 +778,11 @@ dlinkDelete(&srv->link, &hlp->servers); assert(hlp->childs.n_running > 0); - hlp->childs.n_running--; + -- hlp->childs.n_running; if (!srv->flags.shutdown) { assert( hlp->childs.n_active > 0); - hlp->childs.n_active--; + -- hlp->childs.n_active; debugs(84, 0, "WARNING: " << hlp->id_name << " #" << srv->index + 1 << " exited"); if (hlp->childs.needNew() > 0) { @@ -822,9 +830,9 @@ if (cbdataReferenceValidDone(r->data, &cbdata)) callback(cbdata, msg); - srv->stats.pending--; + -- srv->stats.pending; - hlp->stats.replies++; + ++ hlp->stats.replies; srv->answer_time = current_time; @@ -899,13 +907,14 @@ if (t > srv->rbuf && t[-1] == '\r' && hlp->eom == '\n') t[-1] = '\0'; - *t++ = '\0'; + *t = '\0'; + ++t; if (hlp->childs.concurrency) { i = strtol(msg, &msg, 10); while (*msg && xisspace(*msg)) - msg++; + ++msg; } helperReturnBuffer(i, srv, hlp, msg, t); @@ -999,7 +1008,7 @@ srv->roffset = 0; helperStatefulRequestFree(r); srv->request = NULL; - hlp->stats.replies++; + ++ hlp->stats.replies; srv->answer_time = current_time; hlp->stats.avg_svc_time = Math::intAverage(hlp->stats.avg_svc_time, @@ -1045,7 +1054,7 @@ { dlink_node *link = (dlink_node *)memAllocate(MEM_DLINK_NODE); dlinkAddTail(r, link, &hlp->queue); - hlp->stats.queue_size++; + ++ hlp->stats.queue_size; /* do this first so idle=N has a chance to grow the child pool before it hits critical. */ if (hlp->childs.needNew() > 0) { @@ -1078,7 +1087,7 @@ { dlink_node *link = (dlink_node *)memAllocate(MEM_DLINK_NODE); dlinkAddTail(r, link, &hlp->queue); - hlp->stats.queue_size++; + ++ hlp->stats.queue_size; /* do this first so idle=N has a chance to grow the child pool before it hits critical. */ if (hlp->childs.needNew() > 0) { @@ -1116,7 +1125,7 @@ r = (helper_request *)link->data; dlinkDelete(link, &hlp->queue); memFree(link, MEM_DLINK_NODE); - hlp->stats.queue_size--; + -- hlp->stats.queue_size; } return r; @@ -1132,7 +1141,7 @@ r = (helper_stateful_request *)link->data; dlinkDelete(link, &hlp->queue); memFree(link, MEM_DLINK_NODE); - hlp->stats.queue_size--; + -- hlp->stats.queue_size; } return r; @@ -1258,7 +1267,7 @@ return; } - for (slot = 0; slot < (hlp->childs.concurrency ? hlp->childs.concurrency : 1); slot++) { + for (slot = 0; slot < (hlp->childs.concurrency ? hlp->childs.concurrency : 1); ++slot) { if (!srv->requests[slot]) { ptr = &srv->requests[slot]; break; @@ -1290,8 +1299,8 @@ debugs(84, 5, "helperDispatch: Request sent to " << hlp->id_name << " #" << srv->index + 1 << ", " << strlen(r->buf) << " bytes"); - srv->stats.uses++; - hlp->stats.requests++; + ++ srv->stats.uses; + ++ hlp->stats.requests; } static void @@ -1343,8 +1352,8 @@ hlp->id_name << " #" << srv->index + 1 << ", " << (int) strlen(r->buf) << " bytes"); - srv->stats.uses++; - hlp->stats.requests++; + ++ srv->stats.uses; + ++ hlp->stats.requests; } diff -u -r -N squid-3.2.0.18/src/htcp.cc squid-3.2.0.19/src/htcp.cc --- squid-3.2.0.18/src/htcp.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/htcp.cc 2012-08-03 00:14:34.000000000 +1200 @@ -290,7 +290,7 @@ debugs(31, 3, "htcpHexdump " << tag); memset(hex, '\0', 80); - for (i = 0; i < sz; i++) { + for (i = 0; i < sz; ++i) { k = i % 16; snprintf(&hex[k * 3], 4, " %02x", (int) *(s + i)); @@ -608,7 +608,7 @@ if (comm_udp_sendto(htcpOutgoingConn->fd, to, buf, len) < 0) debugs(31, 3, HERE << htcpOutgoingConn << " sendto: " << xstrerror()); else - statCounter.htcp.pkts_sent++; + ++statCounter.htcp.pkts_sent; } /* @@ -1057,7 +1057,7 @@ while ((e = storeGetPublicByRequest(request)) != NULL) { if (e != NULL) { htcpClrStoreEntry(e); - released++; + ++released; } } @@ -1456,7 +1456,7 @@ debugs(31, 3, "htcpRecv: FD " << fd << ", " << len << " bytes from " << from ); if (len) - statCounter.htcp.pkts_recv++; + ++statCounter.htcp.pkts_recv; htcpHandleMsg(buf, len, from); @@ -1574,7 +1574,7 @@ stuff.S.method = (char *) RequestMethodStr(req->method); stuff.S.uri = (char *) e->url(); stuff.S.version = vbuf; - HttpStateData::httpBuildRequestHeader(req, e, &hdr, flags); + HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags); mb.init(); packerToMemInit(&pa, &mb); hdr.packInto(&pa); @@ -1645,7 +1645,7 @@ } stuff.S.version = vbuf; if (reason != HTCP_CLR_INVALIDATION) { - HttpStateData::httpBuildRequestHeader(req, e, &hdr, flags); + HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags); mb.init(); packerToMemInit(&pa, &mb); hdr.packInto(&pa); @@ -1717,15 +1717,15 @@ static void htcpLogHtcp(Ip::Address &caddr, int opcode, log_type logcode, const char *url) { - AccessLogEntry al; + AccessLogEntry::Pointer al = new AccessLogEntry; if (LOG_TAG_NONE == logcode) return; if (!Config.onoff.log_udp) return; - al.htcp.opcode = htcpOpcodeStr[opcode]; - al.url = url; - al.cache.caddr = caddr; - al.cache.code = logcode; - al.cache.msec = 0; - accessLogLog(&al, NULL); + al->htcp.opcode = htcpOpcodeStr[opcode]; + al->url = url; + al->cache.caddr = caddr; + al->cache.code = logcode; + al->cache.msec = 0; + accessLogLog(al, NULL); } diff -u -r -N squid-3.2.0.18/src/http.cc squid-3.2.0.19/src/http.cc --- squid-3.2.0.18/src/http.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/http.cc 2012-08-03 00:14:34.000000000 +1200 @@ -599,11 +599,11 @@ { if (flags.keepalive) if (_peer) - _peer->stats.n_keepalives_sent++; + ++ _peer->stats.n_keepalives_sent; if (reply->keep_alive) { if (_peer) - _peer->stats.n_keepalives_recv++; + ++ _peer->stats.n_keepalives_recv; if (Config.onoff.detect_broken_server_pconns && reply->bodySize(request->method) == -1 && !flags.chunked) { @@ -1067,7 +1067,7 @@ } if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - // TODO: should we call abortTransaction() here? + abortTransaction("store entry aborted while reading reply"); return; } @@ -1099,12 +1099,12 @@ kb_incr(&(statCounter.server.all.kbytes_in), len); kb_incr(&(statCounter.server.http.kbytes_in), len); - IOStats.Http.reads++; + ++ IOStats.Http.reads; - for (clen = len - 1, bin = 0; clen; bin++) + for (clen = len - 1, bin = 0; clen; ++bin) clen >>= 1; - IOStats.Http.read_hist[bin]++; + ++ IOStats.Http.read_hist[bin]; // update peer response time stats (%hier.peer_http_request_sent; @@ -1346,12 +1346,9 @@ } if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - /* - * The above writeReplyBody() call could ABORT this entry, - * in that case, the server FD should already be closed. - * there's nothing for us to do. - */ - (void) 0; + // The above writeReplyBody() call may have aborted the store entry. + abortTransaction("store entry aborted while storing reply"); + return; } else switch (persistentConnStatus()) { case INCOMPLETE_MSG: { @@ -1609,6 +1606,7 @@ void HttpStateData::httpBuildRequestHeader(HttpRequest * request, StoreEntry * entry, + const AccessLogEntryPointer &al, HttpHeader * hdr_out, const http_state_flags flags) { @@ -2006,7 +2004,7 @@ { HttpHeader hdr(hoRequest); Packer p; - httpBuildRequestHeader(request, entry, &hdr, flags); + httpBuildRequestHeader(request, entry, fwd->al, &hdr, flags); if (request->flags.pinned && request->flags.connection_auth) request->flags.auth_sent = 1; @@ -2170,8 +2168,8 @@ return; } - statCounter.server.all.requests++; - statCounter.server.http.requests++; + ++ statCounter.server.all.requests; + ++ statCounter.server.http.requests; /* * We used to set the read timeout here, but not any more. diff -u -r -N squid-3.2.0.18/src/http.h squid-3.2.0.19/src/http.h --- squid-3.2.0.18/src/http.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/http.h 2012-08-03 00:14:34.000000000 +1200 @@ -50,6 +50,7 @@ static void httpBuildRequestHeader(HttpRequest * request, StoreEntry * entry, + const AccessLogEntryPointer &al, HttpHeader * hdr_out, const http_state_flags flags); diff -u -r -N squid-3.2.0.18/src/HttpHdrCc.cc squid-3.2.0.19/src/HttpHdrCc.cc --- squid-3.2.0.18/src/HttpHdrCc.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpHdrCc.cc 2012-08-03 00:14:34.000000000 +1200 @@ -121,10 +121,12 @@ while (strListGetItem(&str, ',', &item, &ilen, &pos)) { /* isolate directive name */ - if ((p = (const char *)memchr(item, '=', ilen)) && (p - item < ilen)) - nlen = p++ - item; - else + if ((p = (const char *)memchr(item, '=', ilen)) && (p - item < ilen)) { + nlen = p - item; + ++p; + } else { nlen = ilen; + } /* find type */ const CcNameToIdMap_t::const_iterator i=CcNameToIdMap.find(StringArea(item,nlen)); diff -u -r -N squid-3.2.0.18/src/HttpHdrContRange.cc squid-3.2.0.19/src/HttpHdrContRange.cc --- squid-3.2.0.18/src/HttpHdrContRange.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpHdrContRange.cc 2012-08-03 00:14:34.000000000 +1200 @@ -90,7 +90,7 @@ return 0; } - p++; + ++p; /* do we have last-pos ? */ if (p - field >= flen) { @@ -182,7 +182,7 @@ else if (!httpHdrRangeRespSpecParseInit(&range->spec, str, p - str)) return 0; - p++; + ++p; if (*p == '*') range->elength = range_spec_unknown; diff -u -r -N squid-3.2.0.18/src/HttpHdrRange.cc squid-3.2.0.19/src/HttpHdrRange.cc --- squid-3.2.0.18/src/HttpHdrRange.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpHdrRange.cc 2012-08-03 00:14:34.000000000 +1200 @@ -104,7 +104,7 @@ if (!httpHeaderParseOffset(field, &offset)) return false; - p++; + ++p; /* do we have last-pos ? */ if (p - field < flen) { diff -u -r -N squid-3.2.0.18/src/HttpHdrSc.cc squid-3.2.0.19/src/HttpHdrSc.cc --- squid-3.2.0.18/src/HttpHdrSc.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpHdrSc.cc 2012-08-03 00:14:34.000000000 +1200 @@ -136,12 +136,14 @@ if ((p = strchr(item, '=')) && (p - item < ilen)) { vlen = ilen - (p + 1 - item); ilen = p - item; - p++; + ++p; } /* decrease ilen to still match the token for ';' qualified non '=' statments */ - else if ((p = strchr(item, ';')) && (p - item < ilen)) - ilen = p++ - item; + else if ((p = strchr(item, ';')) && (p - item < ilen)) { + ilen = p - item; + ++p; + } /* find type */ /* TODO: use a type-safe map-based lookup */ @@ -175,7 +177,7 @@ if (type != SC_OTHER) debugs(90, 2, "hdr sc: ignoring duplicate control-directive: near '" << item << "' in '" << str << "'"); - ScFieldsInfo[type].stat.repCount++; + ++ ScFieldsInfo[type].stat.repCount; continue; } @@ -280,7 +282,7 @@ if (flag == SC_CONTENT) packerPrintf(p, "=\"" SQUIDSTRINGPH "\"", SQUIDSTRINGPRINT(content_)); - pcount++; + ++pcount; } } diff -u -r -N squid-3.2.0.18/src/HttpHeader.cc squid-3.2.0.19/src/HttpHeader.cc --- squid-3.2.0.18/src/HttpHeader.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpHeader.cc 2012-08-03 00:14:34.000000000 +1200 @@ -340,7 +340,7 @@ /* init header stats */ assert(HttpHeaderStatCount == hoReply + 1); - for (i = 0; i < HttpHeaderStatCount; i++) + for (i = 0; i < HttpHeaderStatCount; ++i) httpHeaderStatInit(HttpHeaderStats + i, HttpHeaderStats[i].label); HttpHeaderStats[hoRequest].owner_mask = &RequestHeadersMask; @@ -448,7 +448,7 @@ if (0 != entries.count) HttpHeaderStats[owner].hdrUCountDistr.count(entries.count); - HttpHeaderStats[owner].destroyedCount++; + ++ HttpHeaderStats[owner].destroyedCount; HttpHeaderStats[owner].busyDestroyedCount += entries.count > 0; @@ -544,7 +544,7 @@ assert(header_start && header_end); debugs(55, 7, "parsing hdr: (" << this << ")" << std::endl << getStringPrefix(header_start, header_end)); - HttpHeaderStats[owner].parsedCount++; + ++ HttpHeaderStats[owner].parsedCount; char *nulpos; if ((nulpos = (char*)memchr(header_start, '\0', header_end - header_start))) { @@ -568,10 +568,10 @@ field_end = field_ptr; - field_ptr++; /* Move to next line */ + ++field_ptr; /* Move to next line */ if (field_end > this_line && field_end[-1] == '\r') { - field_end--; /* Ignore CR LF */ + --field_end; /* Ignore CR LF */ if (owner == hoRequest && field_end > this_line) { bool cr_only = true; @@ -596,8 +596,10 @@ if (Config.onoff.relaxed_header_parser) { char *p = (char *) this_line; /* XXX Warning! This destroys original header content and violates specifications somewhat */ - while ((p = (char *)memchr(p, '\r', field_end - p)) != NULL) - *p++ = ' '; + while ((p = (char *)memchr(p, '\r', field_end - p)) != NULL) { + *p = ' '; + ++p; + } } else goto reset; } @@ -733,7 +735,7 @@ assert(pos); assert(*pos >= HttpHeaderInitPos && *pos < (ssize_t)entries.count); - for ((*pos)++; *pos < (ssize_t)entries.count; (*pos)++) { + for (++(*pos); *pos < (ssize_t)entries.count; ++(*pos)) { if (entries.items[*pos]) return (HttpHeaderEntry*)entries.items[*pos]; } @@ -900,7 +902,7 @@ debugs(55, 7, HERE << this << " adding entry: " << e->id << " at " << entries.count); if (CBIT_TEST(mask, e->id)) - Headers[e->id].stat.repCount++; + ++ Headers[e->id].stat.repCount; else CBIT_SET(mask, e->id); @@ -922,7 +924,7 @@ debugs(55, 7, HERE << this << " adding entry: " << e->id << " at " << entries.count); if (CBIT_TEST(mask, e->id)) - Headers[e->id].stat.repCount++; + ++ Headers[e->id].stat.repCount; else CBIT_SET(mask, e->id); @@ -1344,7 +1346,7 @@ cc = NULL; } - HttpHeaderStats[owner].ccParsedCount++; + ++ HttpHeaderStats[owner].ccParsedCount; if (cc) httpHdrCcUpdateStats(cc, &HttpHeaderStats[owner].ccTypeDistr); @@ -1387,7 +1389,7 @@ HttpHdrSc *sc = httpHdrScParseCreate(s); - ++HttpHeaderStats[owner].ccParsedCount; + ++ HttpHeaderStats[owner].ccParsedCount; if (sc) sc->updateStats(&HttpHeaderStats[owner].scTypeDistr); @@ -1433,7 +1435,7 @@ return NULL; /* skip white space */ - for (; field && xisspace(*field); field++); + for (; field && xisspace(*field); ++field); if (!*field) /* no authorization cookie */ return NULL; @@ -1500,7 +1502,7 @@ value = aValue; - Headers[id].stat.aliveCount++; + ++ Headers[id].stat.aliveCount; debugs(55, 9, "created HttpHeaderEntry " << this << ": '" << name << " : " << value ); } @@ -1518,7 +1520,7 @@ assert(Headers[id].stat.aliveCount); - Headers[id].stat.aliveCount--; + -- Headers[id].stat.aliveCount; id = HDR_BAD_HDR; } @@ -1533,7 +1535,7 @@ const char *value_start = field_start + name_len + 1; /* skip ':' */ /* note: value_end == field_end */ - HeaderEntryParsedCount++; + ++ HeaderEntryParsedCount; /* do we have a valid field name within this field? */ @@ -1551,7 +1553,7 @@ "NOTICE: Whitespace after header name in '" << getStringPrefix(field_start, field_end) << "'"); while (name_len > 0 && xisspace(field_start[name_len - 1])) - name_len--; + --name_len; if (!name_len) return NULL; @@ -1581,10 +1583,10 @@ /* trim field value */ while (value_start < field_end && xisspace(*value_start)) - value_start++; + ++value_start; while (value_start < field_end && xisspace(field_end[-1])) - field_end--; + --field_end; if (field_end - value_start > 65534) { /* String must be LESS THAN 64K and it adds a terminating NULL */ @@ -1599,7 +1601,7 @@ /* set field value */ value.limitInit(value_start, field_end - value_start); - Headers[id].stat.seenCount++; + ++ Headers[id].stat.seenCount; debugs(55, 9, "parsed HttpHeaderEntry: '" << name << ": " << value << "'"); @@ -1653,10 +1655,10 @@ static void httpHeaderNoteParsedEntry(http_hdr_type id, String const &context, int error) { - Headers[id].stat.parsCount++; + ++ Headers[id].stat.parsCount; if (error) { - Headers[id].stat.errCount++; + ++ Headers[id].stat.errCount; debugs(55, 2, "cannot parse hdr field: '" << Headers[id].name << ": " << context << "'"); } } @@ -1738,7 +1740,7 @@ HttpHeaderStats[0].busyDestroyedCount = HttpHeaderStats[hoRequest].busyDestroyedCount + HttpHeaderStats[hoReply].busyDestroyedCount; - for (i = 1; i < HttpHeaderStatCount; i++) { + for (i = 1; i < HttpHeaderStatCount; ++i) { httpHeaderStatDump(HttpHeaderStats + i, e); storeAppendPrintf(e, "%s\n", "
    "); } diff -u -r -N squid-3.2.0.18/src/HttpHeaderTools.cc squid-3.2.0.19/src/HttpHeaderTools.cc --- squid-3.2.0.18/src/HttpHeaderTools.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpHeaderTools.cc 2012-08-03 00:14:34.000000000 +1200 @@ -34,10 +34,14 @@ #include "squid-old.h" #include "acl/FilledChecklist.h" +#include "acl/Gadgets.h" #include "compat/strtoll.h" #include "HttpHdrContRange.h" #include "HttpHeader.h" +#include "HttpHeaderTools.h" +#include "HttpRequest.h" #include "MemBuf.h" +#include "Store.h" static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs); @@ -275,7 +279,7 @@ /* rtrim */ while (len > 0 && xisspace((*item)[len - 1])) - len--; + --len; if (ilen) *ilen = len; @@ -344,7 +348,7 @@ while (*pos != '"' && len > (pos-start)) { if (*pos =='\r') { - pos++; + ++pos; if ((pos-start) > len || *pos != '\n') { debugs(66, 2, HERE << "failed to parse a quoted-string header field with '\\r' octet " << (start-pos) << " bytes into '" << start << "'"); @@ -354,7 +358,7 @@ } if (*pos == '\n') { - pos++; + ++pos; if ( (pos-start) > len || (*pos != ' ' && *pos != '\t')) { debugs(66, 2, HERE << "failed to parse multiline quoted-string header field '" << start << "'"); val->clean(); @@ -362,14 +366,14 @@ } // TODO: replace the entire LWS with a space val->append(" "); - pos++; + ++pos; debugs(66, 2, HERE << "len < pos-start => " << len << " < " << (pos-start)); continue; } bool quoted = (*pos == '\\'); if (quoted) { - pos++; + ++pos; if (!*pos || (pos-start) > len) { debugs(66, 2, HERE << "failed to parse a quoted-string header field near '" << start << "'"); val->clean(); @@ -378,7 +382,7 @@ } end = pos; while (end < (start+len) && *end != '\\' && *end != '\"' && (unsigned char)*end > 0x1F && *end != 0x7F) - end++; + ++end; if (((unsigned char)*end <= 0x1F && *end != '\r' && *end != '\n') || *end == 0x7F) { debugs(66, 2, HERE << "failed to parse a quoted-string header field with CTL octet " << (start-pos) << " bytes into '" << start << "'"); @@ -414,18 +418,24 @@ int retval; /* check with anonymizer tables */ - header_mangler *hm; + HeaderManglers *hms = NULL; assert(e); if (ROR_REQUEST == req_or_rep) { - hm = &Config.request_header_access[e->id]; + hms = Config.request_header_access; } else if (ROR_REPLY == req_or_rep) { - hm = &Config.reply_header_access[e->id]; + hms = Config.reply_header_access; } else { /* error. But let's call it "request". */ - hm = &Config.request_header_access[e->id]; + hms = Config.request_header_access; } + /* manglers are not configured for this message kind */ + if (!hms) + return 1; + + const header_mangler *hm = hms->find(*e); + /* mangler or checklist went away. default allow */ if (!hm || !hm->access_list) { return 1; @@ -467,17 +477,142 @@ l->refreshMask(); } -/** - * return 1 if manglers are configured. Used to set a flag - * for optimization during request forwarding. - */ -int -httpReqHdrManglersConfigured() +static +void header_mangler_clean(header_mangler &m) { - for (int i = 0; i < HDR_ENUM_END; i++) { - if (NULL != Config.request_header_access[i].access_list) - return 1; + aclDestroyAccessList(&m.access_list); + safe_free(m.replacement); +} + +static +void header_mangler_dump_access(StoreEntry * entry, const char *option, + const header_mangler &m, const char *name) +{ + if (m.access_list != NULL) { + storeAppendPrintf(entry, "%s ", option); + dump_acl_access(entry, name, m.access_list); } +} - return 0; +static +void header_mangler_dump_replacement(StoreEntry * entry, const char *option, + const header_mangler &m, const char *name) +{ + if (m.replacement) + storeAppendPrintf(entry, "%s %s %s\n", option, name, m.replacement); +} + +HeaderManglers::HeaderManglers() +{ + memset(known, 0, sizeof(known)); + memset(&all, 0, sizeof(all)); +} + +HeaderManglers::~HeaderManglers() +{ + for (int i = 0; i < HDR_ENUM_END; ++i) + header_mangler_clean(known[i]); + + typedef ManglersByName::iterator MBNI; + for (MBNI i = custom.begin(); i != custom.end(); ++i) + header_mangler_clean(i->second); + + header_mangler_clean(all); } + +void +HeaderManglers::dumpAccess(StoreEntry * entry, const char *name) const +{ + for (int i = 0; i < HDR_ENUM_END; ++i) { + header_mangler_dump_access(entry, name, known[i], + httpHeaderNameById(i)); + } + + typedef ManglersByName::const_iterator MBNCI; + for (MBNCI i = custom.begin(); i != custom.end(); ++i) + header_mangler_dump_access(entry, name, i->second, i->first.c_str()); + + header_mangler_dump_access(entry, name, all, "All"); +} + +void +HeaderManglers::dumpReplacement(StoreEntry * entry, const char *name) const +{ + for (int i = 0; i < HDR_ENUM_END; ++i) { + header_mangler_dump_replacement(entry, name, known[i], + httpHeaderNameById(i)); + } + + typedef ManglersByName::const_iterator MBNCI; + for (MBNCI i = custom.begin(); i != custom.end(); ++i) { + header_mangler_dump_replacement(entry, name, i->second, + i->first.c_str()); + } + + header_mangler_dump_replacement(entry, name, all, "All"); +} + +header_mangler * +HeaderManglers::track(const char *name) +{ + int id = httpHeaderIdByNameDef(name, strlen(name)); + + if (id == HDR_BAD_HDR) { // special keyword or a custom header + if (strcmp(name, "All") == 0) + id = HDR_ENUM_END; + else if (strcmp(name, "Other") == 0) + id = HDR_OTHER; + } + + header_mangler *m = NULL; + if (id == HDR_ENUM_END) { + m = &all; + } else if (id == HDR_BAD_HDR) { + m = &custom[name]; + } else { + m = &known[id]; // including HDR_OTHER + } + + assert(m); + return m; +} + +void +HeaderManglers::setReplacement(const char *name, const char *value) +{ + // for backword compatibility, we allow replacements to be configured + // for headers w/o access rules, but such replacements are ignored + header_mangler *m = track(name); + + safe_free(m->replacement); // overwrite old value if any + m->replacement = xstrdup(value); +} + +const header_mangler * +HeaderManglers::find(const HttpHeaderEntry &e) const +{ + // a known header with a configured ACL list + if (e.id != HDR_OTHER && 0 <= e.id && e.id < HDR_ENUM_END && + known[e.id].access_list) + return &known[e.id]; + + // a custom header + if (e.id == HDR_OTHER) { + // does it have an ACL list configured? + // Optimize: use a name type that we do not need to convert to here + const ManglersByName::const_iterator i = custom.find(e.name.termedBuf()); + if (i != custom.end()) + return &i->second; + } + + // Next-to-last resort: "Other" rules match any custom header + if (e.id == HDR_OTHER && known[HDR_OTHER].access_list) + return &known[HDR_OTHER]; + + // Last resort: "All" rules match any header + if (all.access_list) + return &all; + + return NULL; +} + diff -u -r -N squid-3.2.0.18/src/HttpHeaderTools.h squid-3.2.0.19/src/HttpHeaderTools.h --- squid-3.2.0.18/src/HttpHeaderTools.h 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.2.0.19/src/HttpHeaderTools.h 2012-08-03 00:14:34.000000000 +1200 @@ -0,0 +1,59 @@ +#ifndef SQUID_HTTPHEADERTOOLS_H +#define SQUID_HTTPHEADERTOOLS_H + +#if HAVE_MAP +#include +#endif +#if HAVE_STRING +#include +#endif + +class acl_access; +struct _header_mangler { + acl_access *access_list; + char *replacement; +}; +typedef struct _header_mangler header_mangler; + +class StoreEntry; + +/// A collection of header_mangler objects for a given message kind. +class HeaderManglers +{ +public: + HeaderManglers(); + ~HeaderManglers(); + + /// returns a header mangler for field e or nil if none was specified + const header_mangler *find(const HttpHeaderEntry &e) const; + + /// returns a mangler for the named header (known or custom) + header_mangler *track(const char *name); + + /// updates mangler for the named header with a replacement value + void setReplacement(const char *name, const char *replacementValue); + + /// report the *_header_access part of the configuration + void dumpAccess(StoreEntry *entry, const char *optionName) const; + /// report the *_header_replace part of the configuration + void dumpReplacement(StoreEntry *entry, const char *optionName) const; + +private: + /// a name:mangler map; optimize: use unordered map or some such + typedef std::map ManglersByName; + + /// one mangler for each known header + header_mangler known[HDR_ENUM_END]; + + /// one mangler for each custom header + ManglersByName custom; + + /// configured if some mangling ACL applies to all header names + header_mangler all; + +private: + /* not implemented */ + HeaderManglers(const HeaderManglers &); + HeaderManglers &operator =(const HeaderManglers &); +}; +#endif diff -u -r -N squid-3.2.0.18/src/HttpMsg.cc squid-3.2.0.19/src/HttpMsg.cc --- squid-3.2.0.18/src/HttpMsg.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpMsg.cc 2012-08-03 00:14:34.000000000 +1200 @@ -76,7 +76,7 @@ assert(**blk_end == '\n'); while (*(*blk_end - 1) == '\r') - (*blk_end)--; + --(*blk_end); assert(*(*blk_end - 1) == '\n'); @@ -102,11 +102,11 @@ *blk_end = *blk_start; - for (nnl = 0; nnl == 0; (*parse_start)++) { + for (nnl = 0; nnl == 0; ++(*parse_start)) { if (**parse_start == '\r') (void) 0; else if (**parse_start == '\n') - nnl++; + ++nnl; else break; } @@ -128,10 +128,10 @@ *blk_end = *blk_start + slen; while (**blk_end == '\r') /* CR */ - (*blk_end)++; + ++(*blk_end); if (**blk_end == '\n') /* LF */ - (*blk_end)++; + ++(*blk_end); *parse_start = *blk_end; @@ -360,7 +360,7 @@ HttpMsg * HttpMsg::_lock() { - lock_count++; + ++lock_count; return this; } diff -u -r -N squid-3.2.0.18/src/HttpParser.cc squid-3.2.0.19/src/HttpParser.cc --- squid-3.2.0.18/src/HttpParser.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpParser.cc 2012-08-03 00:14:34.000000000 +1200 @@ -46,10 +46,10 @@ "Whitespace bytes received ahead of method. " << "Ignored due to relaxed_header_parser."); // Be tolerant of prefix spaces (other bytes are valid method values) - for (; req.start < bufsiz && buf[req.start] == ' '; req.start++); + for (; req.start < bufsiz && buf[req.start] == ' '; ++req.start); } req.end = -1; - for (int i = 0; i < bufsiz; i++) { + for (int i = 0; i < bufsiz; ++i) { // track first and last whitespace (SP only) if (buf[i] == ' ') { last_whitespace = i; @@ -79,7 +79,7 @@ if (buf[i + 1] == '\n' || buf[i + 1] == '\r') line_end = i - 1; while (i < bufsiz - 1 && buf[i + 1] == '\r') - i++; + ++i; if (buf[i + 1] == '\n') { req.end = i + 1; @@ -151,7 +151,7 @@ // otherwise last whitespace is somewhere after end of URI. req.u_end = last_whitespace; // crop any trailing whitespace in the area we think of as URI - for (; req.u_end >= req.u_start && xisspace(buf[req.u_end]); req.u_end--); + for (; req.u_end >= req.u_start && xisspace(buf[req.u_end]); --req.u_end); } if (req.u_end < req.u_start) { request_parse_status = HTTP_BAD_REQUEST; // missing URI @@ -191,7 +191,7 @@ return -1; } int maj = 0; - for (; i <= line_end && (isdigit(buf[i])) && maj < 65536; i++) { + for (; i <= line_end && (isdigit(buf[i])) && maj < 65536; ++i) { maj = maj * 10; maj = maj + (buf[i]) - '0'; } @@ -218,7 +218,7 @@ return -1; } int min = 0; - for (; i <= line_end && (isdigit(buf[i])) && min < 65536; i++) { + for (; i <= line_end && (isdigit(buf[i])) && min < 65536; ++i) { min = min * 10; min = min + (buf[i]) - '0'; } diff -u -r -N squid-3.2.0.18/src/HttpRequest.cc squid-3.2.0.19/src/HttpRequest.cc --- squid-3.2.0.18/src/HttpRequest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpRequest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -312,9 +312,9 @@ end = ver - 1; while (xisspace(*end)) // find prev non-space - end--; + --end; - end++; // back to space + ++end; // back to space if (2 != sscanf(ver + 5, "%d.%d", &http_ver.major, &http_ver.minor)) { debugs(73, 1, "parseRequestLine: Invalid HTTP identifier."); diff -u -r -N squid-3.2.0.18/src/HttpRequestMethod.cc squid-3.2.0.19/src/HttpRequestMethod.cc --- squid-3.2.0.18/src/HttpRequestMethod.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/HttpRequestMethod.cc 2012-08-03 00:14:34.000000000 +1200 @@ -160,7 +160,7 @@ while (w) { char *s; - for (s = w->key; *s; s++) + for (s = w->key; *s; ++s) *s = xtoupper(*s); AddExtension(w->key); diff -u -r -N squid-3.2.0.18/src/icmp/Icmp4.cc squid-3.2.0.19/src/icmp/Icmp4.cc --- squid-3.2.0.18/src/icmp/Icmp4.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/icmp/Icmp4.cc 2012-08-03 00:14:34.000000000 +1200 @@ -117,7 +117,8 @@ icmp->icmp_code = 0; icmp->icmp_cksum = 0; icmp->icmp_id = icmp_ident; - icmp->icmp_seq = (unsigned short) icmp_pkts_sent++; + icmp->icmp_seq = (unsigned short) icmp_pkts_sent; + ++icmp_pkts_sent; // Construct ICMP packet data content echo = (icmpEchoData *) (icmp + 1); diff -u -r -N squid-3.2.0.18/src/icmp/Icmp6.cc squid-3.2.0.19/src/icmp/Icmp6.cc --- squid-3.2.0.18/src/icmp/Icmp6.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/icmp/Icmp6.cc 2012-08-03 00:14:34.000000000 +1200 @@ -158,7 +158,8 @@ icmp->icmp6_code = 0; icmp->icmp6_cksum = 0; icmp->icmp6_id = icmp_ident; - icmp->icmp6_seq = (unsigned short) icmp_pkts_sent++; + icmp->icmp6_seq = (unsigned short) icmp_pkts_sent; + ++icmp_pkts_sent; icmp6_pktsize = sizeof(struct icmp6_hdr); diff -u -r -N squid-3.2.0.18/src/icmp/Icmp.cc squid-3.2.0.19/src/icmp/Icmp.cc --- squid-3.2.0.18/src/icmp/Icmp.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/icmp/Icmp.cc 2012-08-03 00:14:34.000000000 +1200 @@ -69,7 +69,8 @@ sum = 0; while (size > 1) { - sum += *ptr++; + sum += *ptr; + ++ptr; size -= 2; } diff -u -r -N squid-3.2.0.18/src/icmp/net_db.cc squid-3.2.0.19/src/icmp/net_db.cc --- squid-3.2.0.18/src/icmp/net_db.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/icmp/net_db.cc 2012-08-03 00:14:34.000000000 +1200 @@ -142,7 +142,7 @@ x->net_db_entry = n; assert(hash_lookup(host_table, hostname) == NULL); hash_join(host_table, &x->hash); - n->link_count++; + ++ n->link_count; } static void @@ -153,7 +153,7 @@ assert(x != NULL); assert(x->net_db_entry != NULL); n = x->net_db_entry; - n->link_count--; + -- n->link_count; for (X = &n->hosts; *X; X = &(*X)->next) { if (*X == x) { @@ -226,7 +226,7 @@ while ((n = (netdbEntry *) hash_next(addr_table))) { assert(list_count < memInUse(MEM_NETDBENTRY)); *(list + list_count) = n; - list_count++; + ++list_count; } qsort((char *) list, @@ -234,13 +234,13 @@ sizeof(netdbEntry *), netdbLRU); - for (k = 0; k < list_count; k++) { + for (k = 0; k < list_count; ++k) { if (memInUse(MEM_NETDBENTRY) < Config.Netdb.low) break; netdbRelease(*(list + k)); - removed++; + ++removed; } xfree(list); @@ -320,20 +320,20 @@ } } - n->link_count--; + -- n->link_count; /* point to 'network na' from host entry */ x->net_db_entry = na; /* link net_db_name to 'network na' */ x->next = na->hosts; na->hosts = x; - na->link_count++; + ++ na->link_count; n = na; } if (n->next_ping_time <= squid_curtime) { debugs(38, 3, "netdbSendPing: pinging " << hostname); icmpEngine.DomainPing(addr, hostname); - n->pings_sent++; + ++ n->pings_sent; n->next_ping_time = squid_curtime + Config.Netdb.period; n->last_use_time = squid_curtime; } @@ -400,7 +400,7 @@ int i; net_db_peer *p = n->peers; - for (i = 0; i < n->n_peers; i++, p++) { + for (i = 0; i < n->n_peers; ++i, ++p) { if (!strcmp(p->peername, peername)) return p; } @@ -429,7 +429,7 @@ n->peers = (net_db_peer *)xcalloc(n->n_peers_alloc, sizeof(net_db_peer)); - for (i = 0; i < osize; i++) + for (i = 0; i < osize; ++i) *(n->peers + i) = *(o + i); if (osize) { @@ -439,7 +439,7 @@ p = n->peers + n->n_peers; p->peername = netdbPeerName(e->host); - n->n_peers++; + ++ n->n_peers; return p; } @@ -506,7 +506,7 @@ logfilePrintf(lf, "\n"); - count++; + ++count; #undef RBUF_SZ @@ -632,7 +632,7 @@ netdbHostInsert(n, q); } - count++; + ++count; } xfree(buf); @@ -777,7 +777,7 @@ switch ((int) *(p + o)) { case NETDB_EX_NETWORK: - o++; + ++o; /* FIXME INET6 : NetDB can still ony send IPv4 */ memcpy(&line_addr, p + o, sizeof(struct in_addr)); addr = line_addr; @@ -785,14 +785,14 @@ break; case NETDB_EX_RTT: - o++; + ++o; memcpy(&j, p + o, sizeof(int)); o += sizeof(int); rtt = (double) ntohl(j) / 1000.0; break; case NETDB_EX_HOPS: - o++; + ++o; memcpy(&j, p + o, sizeof(int)); o += sizeof(int); hops = (double) ntohl(j) / 1000.0; @@ -816,7 +816,7 @@ p += rec_sz; - nused++; + ++nused; } /* @@ -1018,8 +1018,10 @@ i = 0; hash_first(addr_table); - while ((n = (netdbEntry *) hash_next(addr_table))) - *(list + i++) = n; + while ((n = (netdbEntry *) hash_next(addr_table))) { + *(list + i) = n; + ++i; + } if (i != memInUse(MEM_NETDBENTRY)) debugs(38, 0, "WARNING: netdb_addrs count off, found " << i << @@ -1030,7 +1032,7 @@ sizeof(netdbEntry *), sortByRtt); - for (k = 0; k < i; k++) { + for (k = 0; k < i; ++k) { n = *(list + k); storeAppendPrintf(sentry, "%-46.46s %4d/%4d %7.1f %5.1f", /* Max between 16 (IPv4) or 46 (IPv6) */ n->network, @@ -1046,7 +1048,7 @@ p = n->peers; - for (j = 0; j < n->n_peers; j++, p++) { + for (j = 0; j < n->n_peers; ++j, ++p) { storeAppendPrintf(sentry, " %-22.22s %7.1f %5.1f\n", p->peername, p->rtt, @@ -1245,14 +1247,16 @@ if ( !addr.IsIPv4() ) continue; - buf[i++] = (char) NETDB_EX_NETWORK; + buf[i] = (char) NETDB_EX_NETWORK; + ++i; addr.GetInAddr(line_addr); memcpy(&buf[i], &line_addr, sizeof(struct in_addr)); i += sizeof(struct in_addr); - buf[i++] = (char) NETDB_EX_RTT; + buf[i] = (char) NETDB_EX_RTT; + ++i; j = htonl((int) (n->rtt * 1000)); @@ -1260,7 +1264,8 @@ i += sizeof(int); - buf[i++] = (char) NETDB_EX_HOPS; + buf[i] = (char) NETDB_EX_HOPS; + ++i; j = htonl((int) (n->hops * 1000)); @@ -1374,7 +1379,7 @@ * Make sure we don't return a parent who is farther away than * we are. Note, the n->peers list is pre-sorted by RTT. */ - for (i = 0; i < n->n_peers; i++) { + for (i = 0; i < n->n_peers; ++i) { h = &n->peers[i]; if (n->rtt > 0) diff -u -r -N squid-3.2.0.18/src/icp_v2.cc squid-3.2.0.19/src/icp_v2.cc --- squid-3.2.0.18/src/icp_v2.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/icp_v2.cc 2012-08-03 00:14:34.000000000 +1200 @@ -186,7 +186,7 @@ static void icpLogIcp(const Ip::Address &caddr, log_type logcode, int len, const char *url, int delay) { - AccessLogEntry al; + AccessLogEntry::Pointer al = new AccessLogEntry(); if (LOG_TAG_NONE == logcode) return; @@ -199,19 +199,19 @@ if (!Config.onoff.log_udp) return; - al.icp.opcode = ICP_QUERY; + al->icp.opcode = ICP_QUERY; - al.url = url; + al->url = url; - al.cache.caddr = caddr; + al->cache.caddr = caddr; - al.cache.replySize = len; + al->cache.replySize = len; - al.cache.code = logcode; + al->cache.code = logcode; - al.cache.msec = delay; + al->cache.msec = delay; - accessLogLog(&al, NULL); + accessLogLog(al, NULL); } /// \ingroup ServerProtocolICPInternal2 @@ -319,10 +319,10 @@ } Comm::SetSelect(fd, COMM_SELECT_WRITE, icpUdpSendQueue, NULL, 0); - statCounter.icp.replies_queued++; + ++statCounter.icp.replies_queued; } else { /* don't queue it */ - statCounter.icp.replies_dropped++; + ++statCounter.icp.replies_dropped; } return x; @@ -598,7 +598,8 @@ int max = INCOMING_UDP_MAX; Comm::SetSelect(sock, COMM_SELECT_READ, icpHandleUdp, NULL, 0); - while (max--) { + while (max) { + --max; len = comm_udp_recvfrom(sock, buf, SQUID_UDP_SO_RCVBUF - 1, @@ -625,7 +626,7 @@ break; } - (*N)++; + ++(*N); icpCount(buf, RECV, (size_t) len, 0); buf[len] = '\0'; debugs(12, 4, "icpHandleUdp: FD " << sock << ": received " << @@ -784,36 +785,36 @@ return; if (SENT == which) { - statCounter.icp.pkts_sent++; + ++statCounter.icp.pkts_sent; kb_incr(&statCounter.icp.kbytes_sent, len); if (ICP_QUERY == icp->opcode) { - statCounter.icp.queries_sent++; + ++statCounter.icp.queries_sent; kb_incr(&statCounter.icp.q_kbytes_sent, len); } else { - statCounter.icp.replies_sent++; + ++statCounter.icp.replies_sent; kb_incr(&statCounter.icp.r_kbytes_sent, len); /* this is the sent-reply service time */ statCounter.icp.replySvcTime.count(delay); } if (ICP_HIT == icp->opcode) - statCounter.icp.hits_sent++; + ++statCounter.icp.hits_sent; } else if (RECV == which) { - statCounter.icp.pkts_recv++; + ++statCounter.icp.pkts_recv; kb_incr(&statCounter.icp.kbytes_recv, len); if (ICP_QUERY == icp->opcode) { - statCounter.icp.queries_recv++; + ++statCounter.icp.queries_recv; kb_incr(&statCounter.icp.q_kbytes_recv, len); } else { - statCounter.icp.replies_recv++; + ++statCounter.icp.replies_recv; kb_incr(&statCounter.icp.r_kbytes_recv, len); /* statCounter.icp.querySvcTime set in clientUpdateCounters */ } if (ICP_HIT == icp->opcode) - statCounter.icp.hits_recv++; + ++statCounter.icp.hits_recv; } } diff -u -r -N squid-3.2.0.18/src/ident/Ident.cc squid-3.2.0.19/src/ident/Ident.cc --- squid-3.2.0.18/src/ident/Ident.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ident/Ident.cc 2012-08-03 00:14:34.000000000 +1200 @@ -31,11 +31,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ - -#include "squid-old.h" +#include "squid.h" #if USE_IDENT - +#include "squid-old.h" #include "comm.h" #include "comm/Connection.h" #include "comm/ConnOpener.h" @@ -68,6 +67,7 @@ // TODO: make these all a series of Async job calls. They are self-contained callbacks now. static IOCB ReadReply; +static IOCB WriteFeedback; static CLCB Close; static CTCB Timeout; static CNCB ConnectDone; @@ -154,8 +154,9 @@ mb.Printf("%d, %d\r\n", conn->remote.GetPort(), conn->local.GetPort()); - AsyncCall::Pointer nil; - Comm::Write(conn, &mb, nil); + AsyncCall::Pointer writeCall = commCbCall(5,4, "Ident::WriteFeedback", + CommIoCbPtrFun(Ident::WriteFeedback, state)); + Comm::Write(conn, &mb, writeCall); AsyncCall::Pointer readCall = commCbCall(5,4, "Ident::ReadReply", CommIoCbPtrFun(Ident::ReadReply, state)); comm_read(conn, state->buf, IDENT_BUFSIZE, readCall); @@ -165,6 +166,18 @@ } void +Ident::WriteFeedback(const Comm::ConnectionPointer &conn, char *buf, size_t len, comm_err_t flag, int xerrno, void *data) +{ + debugs(30, 5, HERE << conn << ": Wrote IDENT request " << len << " bytes."); + + // TODO handle write errors better. retry or abort? + if (flag != COMM_OK) { + debugs(30, 2, HERE << conn << " err-flags=" << flag << " IDENT write error: " << xstrerr(xerrno)); + conn->close(); + } +} + +void Ident::ReadReply(const Comm::ConnectionPointer &conn, char *buf, size_t len, comm_err_t flag, int xerrno, void *data) { IdentStateData *state = (IdentStateData *)data; @@ -251,6 +264,7 @@ state->conn = conn->copyDetails(); // NP: use random port for secure outbound to IDENT_PORT state->conn->local.SetPort(0); + state->conn->remote.SetPort(IDENT_PORT); ClientAdd(state, callback, data); hash_join(ident_hash, &state->hash); diff -u -r -N squid-3.2.0.18/src/ip/Address.cc squid-3.2.0.19/src/ip/Address.cc --- squid-3.2.0.18/src/ip/Address.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ip/Address.cc 2012-08-03 00:14:34.000000000 +1200 @@ -58,7 +58,7 @@ if(!(b)){ printf("assert \"%s\" at line %d\n", a, __LINE__); \ printf("Ip::Address invalid? with IsIPv4()=%c, IsIPv6()=%c\n",(IsIPv4()?'T':'F'),(IsIPv6()?'T':'F')); \ printf("ADDRESS:"); \ - for(unsigned int i = 0; i < sizeof(m_SocketAddr.sin6_addr); i++) { \ + for(unsigned int i = 0; i < sizeof(m_SocketAddr.sin6_addr); ++i) { \ printf(" %x", m_SocketAddr.sin6_addr.s6_addr[i]); \ } printf("\n"); assert(b); \ } @@ -82,7 +82,7 @@ shift = 12; } - for (; shift0 && p >= (uint8_t*)&m_SocketAddr.sin6_addr ; p-- ) { + for (; clearbits>0 && p >= (uint8_t*)&m_SocketAddr.sin6_addr ; --p ) { if (clearbits < 8) { *p &= ((0xFF << clearbits) & 0xFF); clearbits = 0; @@ -315,7 +315,7 @@ /* Compile Err: 'Too many arguments for format. */ - for (int i = 15; i >= 0; i--, p+=4) { + for (int i = 15; i >= 0; --i, p+=4) { snprintf(p, 5, "%x.%x.", ((r[i])&0xf), (((r[i])>>4)&0xf) ); } @@ -644,7 +644,7 @@ && dst->ai_protocol == 0) dst->ai_protocol = IPPROTO_UDP; - if (force == AF_INET6 || (force == AF_UNSPEC && IsIPv6()) ) { + if (force == AF_INET6 || (force == AF_UNSPEC && Ip::EnableIpv6 && IsIPv6()) ) { dst->ai_addr = (struct sockaddr*)new sockaddr_in6; memset(dst->ai_addr,0,sizeof(struct sockaddr_in6)); @@ -729,7 +729,7 @@ // loop a byte-wise compare // NP: match MUST be R-to-L : L-to-R produces inconsistent gt/lt results at varying CIDR // expected difference on CIDR is gt/eq or lt/eq ONLY. - for (unsigned int i = 0 ; i < sizeof(m_SocketAddr.sin6_addr) ; i++) { + for (unsigned int i = 0 ; i < sizeof(m_SocketAddr.sin6_addr) ; ++i) { if (l[i] < r[i]) return -1; @@ -876,7 +876,7 @@ if (IsIPv6() && blen > 0) { *p = '['; - p++; + ++p; } /* 8 being space for [ ] : and port digits */ @@ -887,11 +887,11 @@ // find the end of the new string while (*p != '\0' && p < buf+blen) - p++; + ++p; if (IsIPv6() && p < (buf+blen-1) ) { *p = ']'; - p++; + ++p; } /* terminate just in case. */ diff -u -r -N squid-3.2.0.18/src/ip/Qos.cci squid-3.2.0.19/src/ip/Qos.cci --- squid-3.2.0.18/src/ip/Qos.cci 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ip/Qos.cci 2012-08-03 00:14:34.000000000 +1200 @@ -49,7 +49,7 @@ { acl_nfmark * nfmarkAcls [] = { nfmarkToServer, nfmarkToClient }; - for (int i=0; i<2; i++) { + for (int i=0; i<2; ++i) { while (nfmarkAcls[i]) { acl_nfmark *l = nfmarkAcls[i]; if (l->nfmark > 0) @@ -66,7 +66,7 @@ { acl_tos * tosAcls [] = { tosToServer, tosToClient }; - for (int i=0; i<2; i++) { + for (int i=0; i<2; ++i) { while (tosAcls[i]) { acl_tos *l = tosAcls[i]; if (l->tos > 0) diff -u -r -N squid-3.2.0.18/src/ipc/Kid.cc squid-3.2.0.19/src/ipc/Kid.cc --- squid-3.2.0.18/src/ipc/Kid.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ipc/Kid.cc 2012-08-03 00:14:34.000000000 +1200 @@ -54,7 +54,7 @@ time_t stop_time; time(&stop_time); if ((stop_time - startTime) < fastFailureTimeLimit) - badFailures++; + ++badFailures; else badFailures = 0; // the failures are not "frequent" [any more] diff -u -r -N squid-3.2.0.18/src/ipcache.cc squid-3.2.0.19/src/ipcache.cc --- squid-3.2.0.18/src/ipcache.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ipcache.cc 2012-08-03 00:14:34.000000000 +1200 @@ -255,7 +255,7 @@ ipcacheRelease(i); - removed++; + ++removed; } debugs(14, 9, "ipcache_purgelru: removed " << removed << " entries"); @@ -423,14 +423,14 @@ int j, k; i->addrs.in_addrs = static_cast(xcalloc(ipcount, sizeof(Ip::Address))); - for (int l = 0; l < ipcount; l++) + for (int l = 0; l < ipcount; ++l) i->addrs.in_addrs[l].SetEmpty(); // perform same init actions as constructor would. i->addrs.bad_mask = (unsigned char *)xcalloc(ipcount, sizeof(unsigned char)); memset(i->addrs.bad_mask, 0, sizeof(unsigned char) * ipcount); - for (j = 0, k = 0; k < ipcount; k++) { + for (j = 0, k = 0; k < ipcount; ++k) { if ( i->addrs.in_addrs[j] = A[k] ) - j++; + ++j; else debugs(14, 1, "ipcacheParse: Invalid IP address '" << A[k] << "' in response to '" << name << "'"); } @@ -492,15 +492,15 @@ debugs(14, 3, "ipcacheParse: " << nr << " answers for '" << name << "'"); assert(answers); - for (k = 0; k < nr; k++) { + for (k = 0; k < nr; ++k) { if (Ip::EnableIpv6 && answers[k].type == RFC1035_TYPE_AAAA) { if (answers[k].rdlength != sizeof(struct in6_addr)) { debugs(14, 1, "ipcacheParse: Invalid IPv6 address in response to '" << name << "'"); continue; } - na++; - IpcacheStats.rr_aaaa++; + ++na; + ++IpcacheStats.rr_aaaa; continue; } @@ -509,15 +509,15 @@ debugs(14, 1, "ipcacheParse: Invalid IPv4 address in response to '" << name << "'"); continue; } - na++; - IpcacheStats.rr_a++; + ++na; + ++IpcacheStats.rr_a; continue; } /* With A and AAAA, the CNAME does not necessarily come with additional records to use. */ if (answers[k].type == RFC1035_TYPE_CNAME) { cname_found=1; - IpcacheStats.rr_cname++; + ++IpcacheStats.rr_cname; continue; } @@ -528,16 +528,16 @@ debugs(14, 1, "ipcacheParse: No Address records in response to '" << name << "'"); i->error_message = xstrdup("No Address records"); if (cname_found) - IpcacheStats.cname_only++; + ++IpcacheStats.cname_only; return 0; } i->addrs.in_addrs = static_cast(xcalloc(na, sizeof(Ip::Address))); - for (int l = 0; l < na; l++) + for (int l = 0; l < na; ++l) i->addrs.in_addrs[l].SetEmpty(); // perform same init actions as constructor would. i->addrs.bad_mask = (unsigned char *)xcalloc(na, sizeof(unsigned char)); - for (j = 0, k = 0; k < nr; k++) { + for (j = 0, k = 0; k < nr; ++k) { if (answers[k].type == RFC1035_TYPE_A) { if (answers[k].rdlength != sizeof(struct in_addr)) @@ -548,7 +548,7 @@ i->addrs.in_addrs[j] = temp; debugs(14, 3, "ipcacheParse: " << name << " #" << j << " " << i->addrs.in_addrs[j]); - j++; + ++j; } else if (Ip::EnableIpv6 && answers[k].type == RFC1035_TYPE_AAAA) { if (answers[k].rdlength != sizeof(struct in6_addr)) @@ -559,7 +559,7 @@ i->addrs.in_addrs[j] = temp; debugs(14, 3, "ipcacheParse: " << name << " #" << j << " " << i->addrs.in_addrs[j] ); - j++; + ++j; } if (ttl == 0 || (int) answers[k].ttl < ttl) ttl = answers[k].ttl; @@ -597,7 +597,7 @@ { ipcache_entry *i; static_cast(data)->unwrap(&i); - IpcacheStats.replies++; + ++IpcacheStats.replies; const int age = i->age(); statCounter.dns.svcTime.count(age); @@ -640,11 +640,11 @@ const ipcache_addrs *addrs = NULL; generic_cbdata *c; debugs(14, 4, "ipcache_nbgethostbyname: Name '" << name << "'."); - IpcacheStats.requests++; + ++IpcacheStats.requests; if (name == NULL || name[0] == '\0') { debugs(14, 4, "ipcache_nbgethostbyname: Invalid name!"); - IpcacheStats.invalid++; + ++IpcacheStats.invalid; const DnsLookupDetails details("Invalid hostname", -1); // error, no lookup if (handler) handler(NULL, details, handlerData); @@ -653,7 +653,7 @@ if ((addrs = ipcacheCheckNumeric(name))) { debugs(14, 4, "ipcache_nbgethostbyname: BYPASS for '" << name << "' (already numeric)"); - IpcacheStats.numeric_hits++; + ++IpcacheStats.numeric_hits; const DnsLookupDetails details(NULL, -1); // no error, no lookup if (handler) handler(addrs, details, handlerData); @@ -674,9 +674,9 @@ debugs(14, 4, "ipcache_nbgethostbyname: HIT for '" << name << "'"); if (i->flags.negcached) - IpcacheStats.negative_hits++; + ++IpcacheStats.negative_hits; else - IpcacheStats.hits++; + ++IpcacheStats.hits; i->handler = handler; @@ -688,7 +688,7 @@ } debugs(14, 5, "ipcache_nbgethostbyname: MISS for '" << name << "'"); - IpcacheStats.misses++; + ++IpcacheStats.misses; i = ipcacheCreateEntry(name); i->handler = handler; i->handlerData = cbdataReference(handlerData); @@ -763,7 +763,7 @@ ipcache_addrs *addrs; assert(name); debugs(14, 3, "ipcache_gethostbyname: '" << name << "', flags=" << std::hex << flags); - IpcacheStats.requests++; + ++IpcacheStats.requests; i = ipcache_get(name); if (NULL == i) { @@ -772,11 +772,11 @@ ipcacheRelease(i); i = NULL; } else if (i->flags.negcached) { - IpcacheStats.negative_hits++; + ++IpcacheStats.negative_hits; // ignore i->error_message: the caller just checks IP cache presence return NULL; } else { - IpcacheStats.hits++; + ++IpcacheStats.hits; i->lastref = squid_curtime; // ignore i->error_message: the caller just checks IP cache presence return &i->addrs; @@ -785,11 +785,11 @@ /* no entry [any more] */ if ((addrs = ipcacheCheckNumeric(name))) { - IpcacheStats.numeric_hits++; + ++IpcacheStats.numeric_hits; return addrs; } - IpcacheStats.misses++; + ++IpcacheStats.misses; if (flags & IP_LOOKUP_IF_MISS) ipcache_nbgethostbyname(name, NULL, NULL); @@ -835,7 +835,7 @@ /** \par * Cached entries have IPs listed with a BNF of: ip-address '-' ('OK'|'BAD') */ - for (k = 0; k < count; k++) { + for (k = 0; k < count; ++k) { /* Display tidy-up: IPv6 are so big make the list vertical */ if (k == 0) storeAppendPrintf(sentry, " %45.45s-%3s\n", @@ -987,7 +987,7 @@ return; } - i->locks--; + -- i->locks; if (ipcacheExpiredEntry(i)) ipcacheRelease(i); @@ -1011,7 +1011,7 @@ ia = &i->addrs; } - for (k = 0; k < ia->count; k++) { + for (k = 0; k < ia->count; ++k) { if (++ia->cur == ia->count) ia->cur = 0; @@ -1023,7 +1023,7 @@ /* All bad, reset to All good */ debugs(14, 3, "ipcacheCycleAddr: Changing ALL " << name << " addrs from BAD to OK"); - for (k = 0; k < ia->count; k++) + for (k = 0; k < ia->count; ++k) ia->bad_mask[k] = 0; ia->badcount = 0; @@ -1054,7 +1054,7 @@ ia = &i->addrs; - for (k = 0; k < (int) ia->count; k++) { + for (k = 0; k < (int) ia->count; ++k) { if (addr == ia->in_addrs[k] ) break; } @@ -1066,7 +1066,7 @@ /** Marks the given address as BAD */ if (!ia->bad_mask[k]) { ia->bad_mask[k] = TRUE; - ia->badcount++; + ++ia->badcount; i->expires = min(squid_curtime + max((time_t)60, Config.negativeDnsTtl), i->expires); debugs(14, 2, "ipcacheMarkBadAddr: " << name << " " << addr ); } @@ -1091,7 +1091,7 @@ /* All bad, reset to All good */ debugs(14, 3, "ipcacheMarkAllGood: Changing ALL " << name << " addrs to OK (" << ia->badcount << "/" << ia->count << " bad)"); - for (k = 0; k < ia->count; k++) + for (k = 0; k < ia->count; ++k) ia->bad_mask[k] = 0; ia->badcount = 0; @@ -1110,7 +1110,7 @@ ia = &i->addrs; - for (k = 0; k < (int) ia->count; k++) { + for (k = 0; k < (int) ia->count; ++k) { if (addr == ia->in_addrs[k]) break; } @@ -1123,7 +1123,7 @@ ia->bad_mask[k] = FALSE; - ia->badcount--; + -- ia->badcount; debugs(14, 2, "ipcacheMarkGoodAddr: " << name << " " << addr ); } diff -u -r -N squid-3.2.0.18/src/ipc.cc squid-3.2.0.19/src/ipc.cc --- squid-3.2.0.18/src/ipc.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ipc.cc 2012-08-03 00:14:34.000000000 +1200 @@ -100,6 +100,13 @@ if (hIpc) *hIpc = NULL; +// NP: no wrapping around d and c usage since we *want* code expansion +#define IPC_CHECK_FAIL(f,d,c) \ + if ((f) < 0) { \ + debugs(54, DBG_CRITICAL, "ERROR: Failed to create helper " d " FD: " << c); \ + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); \ + } else void(0) + if (type == IPC_TCP_SOCKET) { crfd = cwfd = comm_open(SOCK_STREAM, 0, @@ -111,6 +118,8 @@ local_addr, 0, /* blocking */ name); + IPC_CHECK_FAIL(crfd, "child read", "TCP " << local_addr); + IPC_CHECK_FAIL(prfd, "parent read", "TCP " << local_addr); } else if (type == IPC_UDP_SOCKET) { crfd = cwfd = comm_open(SOCK_DGRAM, 0, @@ -122,6 +131,8 @@ local_addr, 0, name); + IPC_CHECK_FAIL(crfd, "child read", "UDP" << local_addr); + IPC_CHECK_FAIL(prfd, "parent read", "UDP" << local_addr); } else if (type == IPC_FIFO) { int p2c[2]; int c2p[2]; @@ -140,6 +151,9 @@ fd_open(crfd = c2p[0], FD_PIPE, "IPC FIFO Child Read"); fd_open(pwfd = c2p[1], FD_PIPE, "IPC FIFO Parent Write"); + IPC_CHECK_FAIL(crfd, "child read", "FIFO pipe"); + IPC_CHECK_FAIL(prfd, "parent read", "FIFO pipe"); + #if HAVE_SOCKETPAIR && defined(AF_UNIX) } else if (type == IPC_UNIX_STREAM) { @@ -157,6 +171,9 @@ setsockopt(fds[1], SOL_SOCKET, SO_RCVBUF, (void *) &buflen, sizeof(buflen)); fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX STREAM Parent"); fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX STREAM Parent"); + IPC_CHECK_FAIL(crfd, "child read", "UDS socket"); + IPC_CHECK_FAIL(prfd, "parent read", "UDS socket"); + } else if (type == IPC_UNIX_DGRAM) { int fds[2]; @@ -167,6 +184,9 @@ fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX DGRAM Parent"); fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX DGRAM Parent"); + + IPC_CHECK_FAIL(crfd, "child read", "UDS datagram"); + IPC_CHECK_FAIL(prfd, "parent read", "UDS datagram"); #endif } else { @@ -178,16 +198,6 @@ debugs(54, 3, "ipcCreate: crfd FD " << crfd); debugs(54, 3, "ipcCreate: cwfd FD " << cwfd); - if (crfd < 0) { - debugs(54, 0, "ipcCreate: Failed to create child FD."); - return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); - } - - if (pwfd < 0) { - debugs(54, 0, "ipcCreate: Failed to create server FD."); - return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); - } - if (type == IPC_TCP_SOCKET || type == IPC_UDP_SOCKET) { PaS.InitAddrInfo(AI); @@ -378,7 +388,7 @@ close(t3); /* Make sure all other filedescriptors are closed */ - for (x = 3; x < SQUID_MAXFD; x++) + for (x = 3; x < SQUID_MAXFD; ++x) close(x); #if HAVE_SETSID diff -u -r -N squid-3.2.0.18/src/ipc_win32.cc squid-3.2.0.19/src/ipc_win32.cc --- squid-3.2.0.18/src/ipc_win32.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ipc_win32.cc 2012-08-03 00:14:34.000000000 +1200 @@ -547,7 +547,7 @@ si.dwFlags = STARTF_USESTDHANDLES; /* Make sure all other valid handles are not inerithable */ - for (x = 3; x < Squid_MaxFD; x++) { + for (x = 3; x < Squid_MaxFD; ++x) { if ((F = _get_osfhandle(x)) == -1) continue; @@ -566,7 +566,8 @@ x = 1; while (args[x]) { - strcat(buf1, args[x++]); + strcat(buf1, args[x]); + ++x; strcat(buf1, " "); } @@ -832,7 +833,7 @@ if ((buf2[x - 1] == '\n') && (buf2[x - 2] == '\r')) { buf2[x - 2] = '\n'; buf2[x - 1] = '\0'; - x--; + --x; } } diff -u -r -N squid-3.2.0.18/src/LeakFinder.cc squid-3.2.0.19/src/LeakFinder.cc --- squid-3.2.0.18/src/LeakFinder.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/LeakFinder.cc 2012-08-03 00:14:34.000000000 +1200 @@ -73,7 +73,7 @@ assert(hash_lookup(table, p) == NULL); LeakFinderPtr *c = new LeakFinderPtr(p, file, line); hash_join(table, c); - count++; + ++count; return p; } @@ -96,7 +96,7 @@ LeakFinderPtr *c = (LeakFinderPtr *) hash_lookup(table, p); assert(c); hash_remove_link(table, c); - count--; + --count; delete c; dump(); return p; diff -u -r -N squid-3.2.0.18/src/log/access_log.cc squid-3.2.0.19/src/log/access_log.cc --- squid-3.2.0.18/src/log/access_log.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/access_log.cc 2012-08-03 00:14:34.000000000 +1200 @@ -91,7 +91,7 @@ int LogfileStatus = LOG_DISABLE; void -accessLogLogTo(customlog* log, AccessLogEntry * al, ACLChecklist * checklist) +accessLogLogTo(customlog* log, AccessLogEntry::Pointer &al, ACLChecklist * checklist) { if (al->url == NULL) @@ -167,7 +167,7 @@ } void -accessLogLog(AccessLogEntry * al, ACLChecklist * checklist) +accessLogLog(AccessLogEntry::Pointer &al, ACLChecklist * checklist) { if (LogfileStatus != LOG_ENABLE) return; @@ -411,7 +411,7 @@ hash_join(hash, &fv->hash); } - fv->n++; + ++ fv->n; } void @@ -505,7 +505,7 @@ z = htonl(ibuf[i + 1]); sum = 0; - for (n = 32; n; n--) { + for (n = 32; n; --n) { sum += delta; y += (z << 4) + (k0 ^ z) + (sum ^ (z >> 5)) + k1; z += (y << 4) + (k2 ^ y) + (sum ^ (y >> 5)) + k3; @@ -575,30 +575,6 @@ #endif -void -accessLogFreeMemory(AccessLogEntry * aLogEntry) -{ - safe_free(aLogEntry->headers.request); - -#if ICAP_CLIENT - safe_free(aLogEntry->adapt.last_meta); -#endif - - safe_free(aLogEntry->headers.reply); - safe_free(aLogEntry->cache.authuser); - - safe_free(aLogEntry->headers.adapted_request); - HTTPMSGUNLOCK(aLogEntry->adapted_request); - - HTTPMSGUNLOCK(aLogEntry->reply); - HTTPMSGUNLOCK(aLogEntry->request); -#if ICAP_CLIENT - HTTPMSGUNLOCK(aLogEntry->icap.reply); - HTTPMSGUNLOCK(aLogEntry->icap.request); -#endif - cbdataReferenceDone(aLogEntry->cache.port); -} - int logTypeIsATcpHit(log_type code) { diff -u -r -N squid-3.2.0.18/src/log/File.cc squid-3.2.0.19/src/log/File.cc --- squid-3.2.0.18/src/log/File.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/File.cc 2012-08-03 00:14:34.000000000 +1200 @@ -151,7 +151,7 @@ logfileLineEnd(Logfile * lf) { lf->f_lineend(lf); - lf->sequence_number++; + ++ lf->sequence_number; } void diff -u -r -N squid-3.2.0.18/src/log/FormatHttpdCombined.cc squid-3.2.0.19/src/log/FormatHttpdCombined.cc --- squid-3.2.0.18/src/log/FormatHttpdCombined.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatHttpdCombined.cc 2012-08-03 00:14:34.000000000 +1200 @@ -42,7 +42,7 @@ #include "SquidTime.h" void -Log::Format::HttpdCombined(AccessLogEntry * al, Logfile * logfile) +Log::Format::HttpdCombined(const AccessLogEntry::Pointer &al, Logfile * logfile) { const char *user_ident = ::Format::QuoteUrlEncodeUsername(al->cache.rfc931); @@ -51,7 +51,7 @@ const char *referer = NULL; const char *agent = NULL; - if (al && al->request) { + if (al->request) { referer = al->request->header.getStr(HDR_REFERER); agent = al->request->header.getStr(HDR_USER_AGENT); } diff -u -r -N squid-3.2.0.18/src/log/FormatHttpdCommon.cc squid-3.2.0.19/src/log/FormatHttpdCommon.cc --- squid-3.2.0.18/src/log/FormatHttpdCommon.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatHttpdCommon.cc 2012-08-03 00:14:34.000000000 +1200 @@ -41,7 +41,7 @@ #include "SquidTime.h" void -Log::Format::HttpdCommon(AccessLogEntry * al, Logfile * logfile) +Log::Format::HttpdCommon(const AccessLogEntry::Pointer &al, Logfile * logfile) { const char *user_auth = ::Format::QuoteUrlEncodeUsername(al->cache.authuser); const char *user_ident = ::Format::QuoteUrlEncodeUsername(al->cache.rfc931); diff -u -r -N squid-3.2.0.18/src/log/Formats.h squid-3.2.0.19/src/log/Formats.h --- squid-3.2.0.18/src/log/Formats.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/Formats.h 2012-08-03 00:14:34.000000000 +1200 @@ -1,6 +1,9 @@ #ifndef _SQUID_LOG_FORMATS_H #define _SQUID_LOG_FORMATS_H +#include "RefCount.h" + +typedef RefCount AccessLogEntryPointer; class AccessLogEntry; class Logfile; @@ -25,25 +28,25 @@ } log_type; /// Native Squid Format Display -void SquidNative(AccessLogEntry * al, Logfile * logfile); +void SquidNative(const AccessLogEntryPointer &al, Logfile * logfile); /// Display log details in Squid ICAP format. -void SquidIcap(AccessLogEntry * al, Logfile * logfile); +void SquidIcap(const AccessLogEntryPointer &al, Logfile * logfile); /// Display log details in useragent format. -void SquidUserAgent(AccessLogEntry * al, Logfile * logfile); +void SquidUserAgent(const AccessLogEntryPointer &al, Logfile * logfile); /// Display log details in Squid old refererlog format. -void SquidReferer(AccessLogEntry * al, Logfile * logfile); +void SquidReferer(const AccessLogEntryPointer &al, Logfile * logfile); /// Log with a local custom format -void SquidCustom(AccessLogEntry * al, customlog * log); +void SquidCustom(const AccessLogEntryPointer &al, customlog * log); /// Log with Apache httpd common format -void HttpdCommon(AccessLogEntry * al, Logfile * logfile); +void HttpdCommon(const AccessLogEntryPointer &al, Logfile * logfile); /// Log with Apache httpd combined format -void HttpdCombined(AccessLogEntry * al, Logfile * logfile); +void HttpdCombined(const AccessLogEntryPointer &al, Logfile * logfile); }; // namespace Format }; // namespace Log diff -u -r -N squid-3.2.0.18/src/log/FormatSquidCustom.cc squid-3.2.0.19/src/log/FormatSquidCustom.cc --- squid-3.2.0.18/src/log/FormatSquidCustom.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatSquidCustom.cc 2012-08-03 00:14:34.000000000 +1200 @@ -39,7 +39,7 @@ #include "MemBuf.h" void -Log::Format::SquidCustom(AccessLogEntry * al, customlog * log) +Log::Format::SquidCustom(const AccessLogEntry::Pointer &al, customlog * log) { static MemBuf mb; mb.reset(); diff -u -r -N squid-3.2.0.18/src/log/FormatSquidIcap.cc squid-3.2.0.19/src/log/FormatSquidIcap.cc --- squid-3.2.0.18/src/log/FormatSquidIcap.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatSquidIcap.cc 2012-08-03 00:14:34.000000000 +1200 @@ -44,7 +44,7 @@ #include "SquidTime.h" void -Log::Format::SquidIcap(AccessLogEntry * al, Logfile * logfile) +Log::Format::SquidIcap(const AccessLogEntry::Pointer &al, Logfile * logfile) { const char *client = NULL; const char *user = NULL; diff -u -r -N squid-3.2.0.18/src/log/FormatSquidNative.cc squid-3.2.0.19/src/log/FormatSquidNative.cc --- squid-3.2.0.18/src/log/FormatSquidNative.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatSquidNative.cc 2012-08-03 00:14:34.000000000 +1200 @@ -41,7 +41,7 @@ #include "SquidTime.h" void -Log::Format::SquidNative(AccessLogEntry * al, Logfile * logfile) +Log::Format::SquidNative(const AccessLogEntry::Pointer &al, Logfile * logfile) { char hierHost[MAX_IPSTRLEN]; diff -u -r -N squid-3.2.0.18/src/log/FormatSquidReferer.cc squid-3.2.0.19/src/log/FormatSquidReferer.cc --- squid-3.2.0.18/src/log/FormatSquidReferer.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatSquidReferer.cc 2012-08-03 00:14:34.000000000 +1200 @@ -41,10 +41,10 @@ #include "SquidTime.h" void -Log::Format::SquidReferer(AccessLogEntry *al, Logfile *logfile) +Log::Format::SquidReferer(const AccessLogEntry::Pointer &al, Logfile *logfile) { const char *referer = NULL; - if (al && al->request) + if (al->request) referer = al->request->header.getStr(HDR_REFERER); if (!referer || *referer == '\0') diff -u -r -N squid-3.2.0.18/src/log/FormatSquidUseragent.cc squid-3.2.0.19/src/log/FormatSquidUseragent.cc --- squid-3.2.0.18/src/log/FormatSquidUseragent.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/FormatSquidUseragent.cc 2012-08-03 00:14:34.000000000 +1200 @@ -41,11 +41,11 @@ #include "SquidTime.h" void -Log::Format::SquidUserAgent(AccessLogEntry * al, Logfile * logfile) +Log::Format::SquidUserAgent(const AccessLogEntry::Pointer &al, Logfile * logfile) { const char *agent = NULL; - if (al && al->request) + if (al->request) agent = al->request->header.getStr(HDR_USER_AGENT); if (!agent || *agent == '\0') diff -u -r -N squid-3.2.0.18/src/log/ModDaemon.cc squid-3.2.0.19/src/log/ModDaemon.cc --- squid-3.2.0.18/src/log/ModDaemon.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/ModDaemon.cc 2012-08-03 00:14:34.000000000 +1200 @@ -89,7 +89,7 @@ b->written_len = 0; b->len = 0; dlinkAddTail(b, &b->node, &ll->bufs); - ll->nbufs++; + ++ ll->nbufs; } static void @@ -98,7 +98,7 @@ l_daemon_t *ll = (l_daemon_t *) lf->data; assert(b != NULL); dlinkDelete(&b->node, &ll->bufs); - ll->nbufs--; + -- ll->nbufs; xfree(b->buf); xfree(b); } diff -u -r -N squid-3.2.0.18/src/log/ModStdio.cc squid-3.2.0.19/src/log/ModStdio.cc --- squid-3.2.0.18/src/log/ModStdio.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/ModStdio.cc 2012-08-03 00:14:34.000000000 +1200 @@ -140,7 +140,7 @@ /* Rotate numbers 0 through N up one */ for (i = Config.Log.rotateNumber; i > 1;) { - i--; + --i; snprintf(from, MAXPATHLEN, "%s.%d", realpath, i - 1); snprintf(to, MAXPATHLEN, "%s.%d", realpath, i); xrename(from, to); diff -u -r -N squid-3.2.0.18/src/log/ModSyslog.cc squid-3.2.0.19/src/log/ModSyslog.cc --- squid-3.2.0.18/src/log/ModSyslog.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/log/ModSyslog.cc 2012-08-03 00:14:34.000000000 +1200 @@ -178,7 +178,8 @@ if (!facility) facility = (char *) strchr(priority, '|'); if (facility) { - *facility++ = '\0'; + *facility = '\0'; + ++facility; ll->syslog_priority |= syslog_ntoa(facility); } ll->syslog_priority |= syslog_ntoa(priority); diff -u -r -N squid-3.2.0.18/src/Makefile.am squid-3.2.0.19/src/Makefile.am --- squid-3.2.0.18/src/Makefile.am 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/Makefile.am 2012-08-03 00:14:34.000000000 +1200 @@ -363,6 +363,7 @@ HttpHeader.h \ HttpHeaderMask.h \ HttpHeaderRange.h \ + HttpHeaderTools.h \ HttpHeaderTools.cc \ HttpBody.h \ HttpBody.cc \ @@ -1091,9 +1092,11 @@ SquidString.h \ SquidTime.h \ String.cc \ + tests/stub_access_log.cc \ tests/stub_cache_cf.cc \ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ + tests/stub_errorpage.cc \ tests/stub_HelperChildConfig.cc \ StatCounters.h \ StatCounters.cc \ @@ -1101,25 +1104,32 @@ tests/stub_StatHist.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ + tests/stub_HttpRequest.cc \ tests/testHttpReply.cc \ tests/testHttpReply.h \ tests/testMain.cc \ time.cc \ + url.cc \ + URLScheme.cc \ wordlist.cc nodist_tests_testHttpReply_SOURCES=\ $(TESTSOURCES) tests_testHttpReply_LDFLAGS = $(LIBADD_DL) tests_testHttpReply_LDADD=\ + acl/libacls.la \ acl/libapi.la \ acl/libstate.la \ $(AUTH_LIBS) \ + anyp/libanyp.la \ ip/libip.la \ base/libbase.la \ + $(SSL_LIBS) \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ $(SQUID_CPPUNIT_LIBS) \ $(SQUID_CPPUNIT_LA) \ + $(SSLLIB) \ $(COMPAT_LIB) \ $(XTRA_LIBS) tests_testHttpReply_DEPENDENCIES= $(SQUID_CPPUNIT_LA) @@ -1138,6 +1148,7 @@ filemap.cc \ HelperChildConfig.h \ HelperChildConfig.cc \ + HttpBody.cc \ HttpHeader.cc \ HttpHeaderTools.cc \ HttpHdrContRange.cc \ @@ -1155,6 +1166,7 @@ Packer.cc \ Parsing.cc \ SquidMath.cc \ + StatCounters.cc \ StatCounters.h \ StatHist.h \ tests/stub_StatHist.cc \ @@ -1177,21 +1189,28 @@ SwapDir.h \ tests/stub_access_log.cc \ tests/stub_cache_cf.cc \ - tests/stub_comm.cc \ tests/stub_debug.cc \ tests/stub_DelayId.cc \ tests/stub_DiskIOModule.cc \ + tests/stub_errorpage.cc \ tests/stub_fd.cc \ tests/stub_HttpRequest.cc \ + tests/stub_HttpReply.cc \ + tests/stub_ipc_TypedMsgHdr.cc \ + tests/stub_libcomm.cc \ + tests/stub_libsslsquid.cc \ tests/stub_MemObject.cc \ tests/stub_MemStore.cc \ tests/stub_mime.cc \ + tests/stub_pconn.cc \ + tests/stub_Port.cc \ tests/stub_store.cc \ tests/stub_store_rebuild.cc \ tests/stub_store_stats.cc \ tests/stub_store_swapout.cc \ tests/stub_tools.cc \ tests/stub_cache_manager.cc \ + tests/stub_UdsOp.cc \ tests/testACLMaxUserIP.cc \ tests/testACLMaxUserIP.h \ tests/testMain.cc \ @@ -1217,6 +1236,8 @@ base/libbase.la \ libsquid.la \ ip/libip.la \ + ipc/libipc.la \ + mgr/libmgr.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -1227,8 +1248,8 @@ $(COMPAT_LIB) \ $(XTRA_LIBS) tests_testACLMaxUserIP_LDFLAGS = $(LIBADD_DL) -tests_testACLMaxUserIP_DEPENDENCIES = \ - $(SQUID_CPPUNIT_LA) +##tests_testACLMaxUserIP_DEPENDENCIES = \ +## $(SQUID_CPPUNIT_LA) ## a demonstration test that does nothing but shows the salient points ## involved in writing tests. @@ -2497,6 +2518,7 @@ mgr/libmgr.la \ ipc/libipc.la \ anyp/libanyp.la \ + $(SSL_LIBS) \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ diff -u -r -N squid-3.2.0.18/src/Makefile.in squid-3.2.0.19/src/Makefile.in --- squid-3.2.0.18/src/Makefile.in 2012-06-29 13:39:15.000000000 +1200 +++ squid-3.2.0.19/src/Makefile.in 2012-08-03 00:15:37.000000000 +1200 @@ -237,21 +237,22 @@ HttpHdrSc.cc HttpHdrSc.h HttpHdrScTarget.cc HttpHdrScTarget.h \ HttpHdrContRange.cc HttpHdrContRange.h HttpHeaderStat.h \ HttpHeader.cc HttpHeader.h HttpHeaderMask.h HttpHeaderRange.h \ - HttpHeaderTools.cc HttpBody.h HttpBody.cc HttpControlMsg.h \ - HttpMsg.cc HttpMsg.h HttpParser.cc HttpParser.h HttpReply.cc \ - HttpReply.h HttpRequest.cc HttpRequest.h HttpRequestMethod.cc \ - HttpRequestMethod.h HttpVersion.h ICP.h icp_opcode.h icp_v2.cc \ - icp_v3.cc int.cc internal.cc ipc.cc ipc_win32.cc ipcache.cc \ - ipcache.h LeakFinder.cc list.cc lookup_t.h main.cc mem.cc \ - mem_node.cc mem_node.h Mem.h MemBuf.cc MemObject.cc \ - MemObject.h mime.cc mime_header.cc multicast.cc neighbors.cc \ - Packer.cc Packer.h Parsing.cc Parsing.h ProfStats.cc pconn.cc \ - pconn.h PeerDigest.h peer_digest.cc \ - peer_proxy_negotiate_auth.cc peer_select.cc peer_sourcehash.cc \ - peer_userhash.cc PeerSelectState.h PingData.h protos.h \ - redirect.cc refresh.cc RemovalPolicy.cc RemovalPolicy.h \ - send-announce.cc base/InstanceId.h MemBlob.h MemBlob.cc \ - snmp_core.h snmp_core.cc snmp_agent.cc squid-old.h SquidMath.h \ + HttpHeaderTools.h HttpHeaderTools.cc HttpBody.h HttpBody.cc \ + HttpControlMsg.h HttpMsg.cc HttpMsg.h HttpParser.cc \ + HttpParser.h HttpReply.cc HttpReply.h HttpRequest.cc \ + HttpRequest.h HttpRequestMethod.cc HttpRequestMethod.h \ + HttpVersion.h ICP.h icp_opcode.h icp_v2.cc icp_v3.cc int.cc \ + internal.cc ipc.cc ipc_win32.cc ipcache.cc ipcache.h \ + LeakFinder.cc list.cc lookup_t.h main.cc mem.cc mem_node.cc \ + mem_node.h Mem.h MemBuf.cc MemObject.cc MemObject.h mime.cc \ + mime_header.cc multicast.cc neighbors.cc Packer.cc Packer.h \ + Parsing.cc Parsing.h ProfStats.cc pconn.cc pconn.h \ + PeerDigest.h peer_digest.cc peer_proxy_negotiate_auth.cc \ + peer_select.cc peer_sourcehash.cc peer_userhash.cc \ + PeerSelectState.h PingData.h protos.h redirect.cc refresh.cc \ + RemovalPolicy.cc RemovalPolicy.h send-announce.cc \ + base/InstanceId.h MemBlob.h MemBlob.cc snmp_core.h \ + snmp_core.cc snmp_agent.cc squid-old.h SquidMath.h \ SquidMath.cc SquidNew.cc stat.cc StatCounters.h \ StatCounters.cc StatHist.h StatHist.cc String.cc stmem.cc \ stmem.h store.cc Store.h StoreFileSystem.cc StoreFileSystem.h \ @@ -384,30 +385,36 @@ ConfigOption.$(OBJEXT) ConfigParser.$(OBJEXT) \ DiskIO/ReadRequest.$(OBJEXT) DiskIO/WriteRequest.$(OBJEXT) \ ETag.$(OBJEXT) event.$(OBJEXT) filemap.$(OBJEXT) \ - HelperChildConfig.$(OBJEXT) HttpHeader.$(OBJEXT) \ - HttpHeaderTools.$(OBJEXT) HttpHdrContRange.$(OBJEXT) \ - HttpHdrRange.$(OBJEXT) HttpHdrCc.$(OBJEXT) HttpHdrSc.$(OBJEXT) \ + HelperChildConfig.$(OBJEXT) HttpBody.$(OBJEXT) \ + HttpHeader.$(OBJEXT) HttpHeaderTools.$(OBJEXT) \ + HttpHdrContRange.$(OBJEXT) HttpHdrRange.$(OBJEXT) \ + HttpHdrCc.$(OBJEXT) HttpHdrSc.$(OBJEXT) \ HttpHdrScTarget.$(OBJEXT) HttpMsg.$(OBJEXT) \ HttpRequestMethod.$(OBJEXT) int.$(OBJEXT) list.$(OBJEXT) \ mem_node.$(OBJEXT) Packer.$(OBJEXT) Parsing.$(OBJEXT) \ - SquidMath.$(OBJEXT) tests/stub_StatHist.$(OBJEXT) \ - stmem.$(OBJEXT) String.$(OBJEXT) store_dir.$(OBJEXT) \ - StoreIOState.$(OBJEXT) StoreMeta.$(OBJEXT) \ + SquidMath.$(OBJEXT) StatCounters.$(OBJEXT) \ + tests/stub_StatHist.$(OBJEXT) stmem.$(OBJEXT) String.$(OBJEXT) \ + store_dir.$(OBJEXT) StoreIOState.$(OBJEXT) StoreMeta.$(OBJEXT) \ StoreMetaMD5.$(OBJEXT) StoreMetaSTD.$(OBJEXT) \ StoreMetaSTDLFS.$(OBJEXT) StoreMetaUnpacker.$(OBJEXT) \ StoreMetaURL.$(OBJEXT) StoreMetaVary.$(OBJEXT) \ StoreSwapLogData.$(OBJEXT) store_key_md5.$(OBJEXT) \ swap_log_op.$(OBJEXT) SwapDir.$(OBJEXT) \ tests/stub_access_log.$(OBJEXT) tests/stub_cache_cf.$(OBJEXT) \ - tests/stub_comm.$(OBJEXT) tests/stub_debug.$(OBJEXT) \ - tests/stub_DelayId.$(OBJEXT) tests/stub_DiskIOModule.$(OBJEXT) \ - tests/stub_fd.$(OBJEXT) tests/stub_HttpRequest.$(OBJEXT) \ + tests/stub_debug.$(OBJEXT) tests/stub_DelayId.$(OBJEXT) \ + tests/stub_DiskIOModule.$(OBJEXT) \ + tests/stub_errorpage.$(OBJEXT) tests/stub_fd.$(OBJEXT) \ + tests/stub_HttpRequest.$(OBJEXT) \ + tests/stub_HttpReply.$(OBJEXT) \ + tests/stub_ipc_TypedMsgHdr.$(OBJEXT) \ + tests/stub_libcomm.$(OBJEXT) tests/stub_libsslsquid.$(OBJEXT) \ tests/stub_MemObject.$(OBJEXT) tests/stub_MemStore.$(OBJEXT) \ - tests/stub_mime.$(OBJEXT) tests/stub_store.$(OBJEXT) \ + tests/stub_mime.$(OBJEXT) tests/stub_pconn.$(OBJEXT) \ + tests/stub_Port.$(OBJEXT) tests/stub_store.$(OBJEXT) \ tests/stub_store_rebuild.$(OBJEXT) \ tests/stub_store_stats.$(OBJEXT) \ tests/stub_store_swapout.$(OBJEXT) tests/stub_tools.$(OBJEXT) \ - tests/stub_cache_manager.$(OBJEXT) \ + tests/stub_cache_manager.$(OBJEXT) tests/stub_UdsOp.$(OBJEXT) \ tests/testACLMaxUserIP.$(OBJEXT) tests/testMain.$(OBJEXT) \ time.$(OBJEXT) url.$(OBJEXT) URLScheme.$(OBJEXT) mem.$(OBJEXT) \ MemBuf.$(OBJEXT) wordlist.$(OBJEXT) @@ -415,6 +422,16 @@ nodist_tests_testACLMaxUserIP_OBJECTS = $(am__objects_23) tests_testACLMaxUserIP_OBJECTS = $(am_tests_testACLMaxUserIP_OBJECTS) \ $(nodist_tests_testACLMaxUserIP_OBJECTS) +tests_testACLMaxUserIP_DEPENDENCIES = $(AUTH_ACL_LIBS) \ + ident/libident.la acl/libacls.la eui/libeui.la acl/libstate.la \ + $(AUTH_LIBS) acl/libapi.la anyp/libanyp.la base/libbase.la \ + libsquid.la ip/libip.la ipc/libipc.la mgr/libmgr.la \ + $(top_builddir)/lib/libmisccontainers.la \ + $(top_builddir)/lib/libmiscencoding.la \ + $(top_builddir)/lib/libmiscutil.la $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) tests_testACLMaxUserIP_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(tests_testACLMaxUserIP_LDFLAGS) $(LDFLAGS) -o $@ @@ -964,12 +981,15 @@ HttpMsg.$(OBJEXT) HttpReply.$(OBJEXT) HttpStatusLine.$(OBJEXT) \ mem.$(OBJEXT) MemBuf.$(OBJEXT) mime_header.$(OBJEXT) \ Packer.$(OBJEXT) String.$(OBJEXT) \ - tests/stub_cache_cf.$(OBJEXT) \ + tests/stub_access_log.$(OBJEXT) tests/stub_cache_cf.$(OBJEXT) \ tests/stub_cache_manager.$(OBJEXT) tests/stub_debug.$(OBJEXT) \ + tests/stub_errorpage.$(OBJEXT) \ tests/stub_HelperChildConfig.$(OBJEXT) StatCounters.$(OBJEXT) \ tests/stub_StatHist.$(OBJEXT) tests/stub_store.$(OBJEXT) \ - tests/stub_store_stats.$(OBJEXT) tests/testHttpReply.$(OBJEXT) \ - tests/testMain.$(OBJEXT) time.$(OBJEXT) wordlist.$(OBJEXT) + tests/stub_store_stats.$(OBJEXT) \ + tests/stub_HttpRequest.$(OBJEXT) tests/testHttpReply.$(OBJEXT) \ + tests/testMain.$(OBJEXT) time.$(OBJEXT) url.$(OBJEXT) \ + URLScheme.$(OBJEXT) wordlist.$(OBJEXT) nodist_tests_testHttpReply_OBJECTS = $(am__objects_23) tests_testHttpReply_OBJECTS = $(am_tests_testHttpReply_OBJECTS) \ $(nodist_tests_testHttpReply_OBJECTS) @@ -2245,13 +2265,14 @@ HttpHdrSc.cc HttpHdrSc.h HttpHdrScTarget.cc HttpHdrScTarget.h \ HttpHdrContRange.cc HttpHdrContRange.h HttpHeaderStat.h \ HttpHeader.cc HttpHeader.h HttpHeaderMask.h HttpHeaderRange.h \ - HttpHeaderTools.cc HttpBody.h HttpBody.cc HttpControlMsg.h \ - HttpMsg.cc HttpMsg.h HttpParser.cc HttpParser.h HttpReply.cc \ - HttpReply.h HttpRequest.cc HttpRequest.h HttpRequestMethod.cc \ - HttpRequestMethod.h HttpVersion.h ICP.h icp_opcode.h icp_v2.cc \ - icp_v3.cc int.cc internal.cc $(IPC_SOURCE) ipcache.cc \ - ipcache.h $(LEAKFINDERSOURCE) list.cc lookup_t.h main.cc \ - mem.cc mem_node.cc mem_node.h Mem.h MemBuf.cc MemObject.cc \ + HttpHeaderTools.h HttpHeaderTools.cc HttpBody.h HttpBody.cc \ + HttpControlMsg.h HttpMsg.cc HttpMsg.h HttpParser.cc \ + HttpParser.h HttpReply.cc HttpReply.h HttpRequest.cc \ + HttpRequest.h HttpRequestMethod.cc HttpRequestMethod.h \ + HttpVersion.h ICP.h icp_opcode.h icp_v2.cc icp_v3.cc int.cc \ + internal.cc $(IPC_SOURCE) ipcache.cc ipcache.h \ + $(LEAKFINDERSOURCE) list.cc lookup_t.h main.cc mem.cc \ + mem_node.cc mem_node.h Mem.h MemBuf.cc MemObject.cc \ MemObject.h mime.cc mime_header.cc multicast.cc neighbors.cc \ Packer.cc Packer.h Parsing.cc Parsing.h $(XPROF_STATS_SOURCE) \ pconn.cc pconn.h PeerDigest.h peer_digest.cc \ @@ -2511,6 +2532,8 @@ tests/stub_ipcache.cc \ tests/stub_libcomm.cc \ tests/stub_libicmp.cc \ + tests/stub_libmgr.cc \ + tests/stub_libsslsquid.cc \ tests/stub_main_cc.cc \ tests/stub_mem.cc \ tests/stub_mem_node.cc \ @@ -2693,9 +2716,11 @@ SquidString.h \ SquidTime.h \ String.cc \ + tests/stub_access_log.cc \ tests/stub_cache_cf.cc \ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ + tests/stub_errorpage.cc \ tests/stub_HelperChildConfig.cc \ StatCounters.h \ StatCounters.cc \ @@ -2703,10 +2728,13 @@ tests/stub_StatHist.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ + tests/stub_HttpRequest.cc \ tests/testHttpReply.cc \ tests/testHttpReply.h \ tests/testMain.cc \ time.cc \ + url.cc \ + URLScheme.cc \ wordlist.cc nodist_tests_testHttpReply_SOURCES = \ @@ -2714,16 +2742,20 @@ tests_testHttpReply_LDFLAGS = $(LIBADD_DL) tests_testHttpReply_LDADD = \ + acl/libacls.la \ acl/libapi.la \ acl/libstate.la \ $(AUTH_LIBS) \ + anyp/libanyp.la \ ip/libip.la \ base/libbase.la \ + $(SSL_LIBS) \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ $(SQUID_CPPUNIT_LIBS) \ $(SQUID_CPPUNIT_LA) \ + $(SSLLIB) \ $(COMPAT_LIB) \ $(XTRA_LIBS) @@ -2741,6 +2773,7 @@ filemap.cc \ HelperChildConfig.h \ HelperChildConfig.cc \ + HttpBody.cc \ HttpHeader.cc \ HttpHeaderTools.cc \ HttpHdrContRange.cc \ @@ -2758,6 +2791,7 @@ Packer.cc \ Parsing.cc \ SquidMath.cc \ + StatCounters.cc \ StatCounters.h \ StatHist.h \ tests/stub_StatHist.cc \ @@ -2780,21 +2814,28 @@ SwapDir.h \ tests/stub_access_log.cc \ tests/stub_cache_cf.cc \ - tests/stub_comm.cc \ tests/stub_debug.cc \ tests/stub_DelayId.cc \ tests/stub_DiskIOModule.cc \ + tests/stub_errorpage.cc \ tests/stub_fd.cc \ tests/stub_HttpRequest.cc \ + tests/stub_HttpReply.cc \ + tests/stub_ipc_TypedMsgHdr.cc \ + tests/stub_libcomm.cc \ + tests/stub_libsslsquid.cc \ tests/stub_MemObject.cc \ tests/stub_MemStore.cc \ tests/stub_mime.cc \ + tests/stub_pconn.cc \ + tests/stub_Port.cc \ tests/stub_store.cc \ tests/stub_store_rebuild.cc \ tests/stub_store_stats.cc \ tests/stub_store_swapout.cc \ tests/stub_tools.cc \ tests/stub_cache_manager.cc \ + tests/stub_UdsOp.cc \ tests/testACLMaxUserIP.cc \ tests/testACLMaxUserIP.h \ tests/testMain.cc \ @@ -2822,6 +2863,8 @@ base/libbase.la \ libsquid.la \ ip/libip.la \ + ipc/libipc.la \ + mgr/libmgr.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -2833,9 +2876,6 @@ $(XTRA_LIBS) tests_testACLMaxUserIP_LDFLAGS = $(LIBADD_DL) -tests_testACLMaxUserIP_DEPENDENCIES = \ - $(SQUID_CPPUNIT_LA) - tests_testBoilerplate_SOURCES = \ tests/testBoilerplate.cc \ tests/testMain.cc \ @@ -4117,6 +4157,7 @@ mgr/libmgr.la \ ipc/libipc.la \ anyp/libanyp.la \ + $(SSL_LIBS) \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -5350,24 +5391,36 @@ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_cache_cf.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) -tests/stub_comm.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) tests/stub_debug.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_DelayId.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_DiskIOModule.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_errorpage.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/stub_fd.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_HttpRequest.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_HttpReply.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_ipc_TypedMsgHdr.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_libcomm.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_libsslsquid.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/stub_MemObject.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_MemStore.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_mime.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_pconn.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_Port.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/stub_store.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_store_rebuild.$(OBJEXT): tests/$(am__dirstamp) \ @@ -5380,6 +5433,8 @@ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_cache_manager.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_UdsOp.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/testACLMaxUserIP.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/testMain.$(OBJEXT): tests/$(am__dirstamp) \ @@ -5416,8 +5471,6 @@ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_ipc.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) -tests/stub_pconn.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) tests/stub_acl.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_helper.$(OBJEXT): tests/$(am__dirstamp) \ @@ -5426,14 +5479,8 @@ tests/$(DEPDIR)/$(am__dirstamp) tests/stub_http.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) -tests/stub_errorpage.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) -tests/stub_Port.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) tests/stub_store_client.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) -tests/stub_UdsOp.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) tests/testStoreSupport.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/testCoss$(EXEEXT): $(tests_testCoss_OBJECTS) $(tests_testCoss_DEPENDENCIES) tests/$(am__dirstamp) @@ -5481,6 +5528,8 @@ $(tests_testHttpRequest_LINK) $(tests_testHttpRequest_OBJECTS) $(tests_testHttpRequest_LDADD) $(LIBS) tests/testNull.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) +tests/stub_comm.$(OBJEXT): tests/$(am__dirstamp) \ + tests/$(DEPDIR)/$(am__dirstamp) tests/testNull$(EXEEXT): $(tests_testNull_OBJECTS) $(tests_testNull_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/testNull$(EXEEXT) $(tests_testNull_LINK) $(tests_testNull_OBJECTS) $(tests_testNull_LDADD) $(LIBS) @@ -5498,10 +5547,6 @@ tests/testStatHist$(EXEEXT): $(tests_testStatHist_OBJECTS) $(tests_testStatHist_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/testStatHist$(EXEEXT) $(tests_testStatHist_LINK) $(tests_testStatHist_OBJECTS) $(tests_testStatHist_LDADD) $(LIBS) -tests/stub_HttpReply.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) -tests/stub_libcomm.$(OBJEXT): tests/$(am__dirstamp) \ - tests/$(DEPDIR)/$(am__dirstamp) tests/testStore.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/testStoreEntryStream.$(OBJEXT): tests/$(am__dirstamp) \ @@ -5603,9 +5648,11 @@ -rm -f tests/stub_internal.$(OBJEXT) -rm -f tests/stub_ipc.$(OBJEXT) -rm -f tests/stub_ipc_Forwarder.$(OBJEXT) + -rm -f tests/stub_ipc_TypedMsgHdr.$(OBJEXT) -rm -f tests/stub_ipcache.$(OBJEXT) -rm -f tests/stub_libcomm.$(OBJEXT) -rm -f tests/stub_libicmp.$(OBJEXT) + -rm -f tests/stub_libsslsquid.$(OBJEXT) -rm -f tests/stub_main_cc.$(OBJEXT) -rm -f tests/stub_mem.$(OBJEXT) -rm -f tests/stub_mime.$(OBJEXT) @@ -5874,9 +5921,11 @@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_internal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_ipc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_ipc_Forwarder.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_ipc_TypedMsgHdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_ipcache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_libcomm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_libicmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_libsslsquid.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_main_cc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_mem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/stub_mime.Po@am__quote@ diff -u -r -N squid-3.2.0.18/src/MemBuf.cc squid-3.2.0.19/src/MemBuf.cc --- squid-3.2.0.18/src/MemBuf.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/MemBuf.cc 2012-08-03 00:14:34.000000000 +1200 @@ -340,7 +340,7 @@ if (!size || buf[size - 1]) { assert(!buf[size]); } else { - size--; + --size; } } diff -u -r -N squid-3.2.0.18/src/mem.cc squid-3.2.0.19/src/mem.cc --- squid-3.2.0.18/src/mem.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/mem.cc 2012-08-03 00:14:34.000000000 +1200 @@ -764,10 +764,13 @@ if (!mp_stats.pool) /* pool destroyed */ continue; - if (mp_stats.pool->getMeter().gb_allocated.count > 0) /* this pool has been used */ - sortme[npools++] = mp_stats; - else + if (mp_stats.pool->getMeter().gb_allocated.count > 0) { + /* this pool has been used */ + sortme[npools] = mp_stats; + ++npools; + } else { ++not_used; + } } memPoolIterateDone(&iter); diff -u -r -N squid-3.2.0.18/src/MemObject.cc squid-3.2.0.19/src/MemObject.cc --- squid-3.2.0.18/src/MemObject.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/MemObject.cc 2012-08-03 00:14:34.000000000 +1200 @@ -211,7 +211,8 @@ StoreClientStats(MemBuf *anEntry):where(anEntry),index(0) {} void operator()(store_client const &x) { - x.dumpStats(where, index++); + x.dumpStats(where, index); + ++index; } MemBuf *where; diff -u -r -N squid-3.2.0.18/src/MemStore.cc squid-3.2.0.19/src/MemStore.cc --- squid-3.2.0.18/src/MemStore.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/MemStore.cc 2012-08-03 00:14:34.000000000 +1200 @@ -251,14 +251,40 @@ return true; } -void -MemStore::considerKeeping(StoreEntry &e) +bool +MemStore::keepInLocalMemory(const StoreEntry &e) const { if (!e.memoryCachable()) { debugs(20, 7, HERE << "Not memory cachable: " << e); - return; // cannot keep due to entry state or properties + return false; // will not cache due to entry state or properties + } + + assert(e.mem_obj); + const int64_t loadedSize = e.mem_obj->endOffset(); + const int64_t expectedSize = e.mem_obj->expectedReplySize(); // may be < 0 + const int64_t ramSize = max(loadedSize, expectedSize); + + if (ramSize > static_cast(Config.Store.maxInMemObjSize)) { + debugs(20, 5, HERE << "Too big max(" << + loadedSize << ", " << expectedSize << "): " << e); + return false; // will not cache due to cachable entry size limits + } + + if (!willFit(ramSize)) { + debugs(20, 5, HERE << "Wont fit max(" << + loadedSize << ", " << expectedSize << "): " << e); + return false; // will not cache due to memory cache slot limit } + return true; +} + +void +MemStore::considerKeeping(StoreEntry &e) +{ + if (!keepInLocalMemory(e)) + return; + // since we copy everything at once, we can only keep complete entries if (e.store_status != STORE_OK) { debugs(20, 7, HERE << "Incomplete: " << e); @@ -270,6 +296,12 @@ const int64_t loadedSize = e.mem_obj->endOffset(); const int64_t expectedSize = e.mem_obj->expectedReplySize(); + // objects of unknown size are not allowed into memory cache, for now + if (expectedSize < 0) { + debugs(20, 5, HERE << "Unknown expected size: " << e); + return; + } + // since we copy everything at once, we can only keep fully loaded entries if (loadedSize != expectedSize) { debugs(20, 7, HERE << "partially loaded: " << loadedSize << " != " << @@ -277,18 +309,12 @@ return; } - if (!willFit(expectedSize)) { - debugs(20, 5, HERE << "No mem-cache space for " << e); - return; // failed to free enough space - } - keep(e); // may still fail } bool -MemStore::willFit(int64_t need) +MemStore::willFit(int64_t need) const { - // TODO: obey configured maximum entry size (with page-based rounding) return need <= static_cast(Ipc::Mem::PageSize()); } diff -u -r -N squid-3.2.0.18/src/MemStore.h squid-3.2.0.19/src/MemStore.h --- squid-3.2.0.18/src/MemStore.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/MemStore.h 2012-08-03 00:14:34.000000000 +1200 @@ -27,6 +27,9 @@ /// cache the entry or forget about it until the next considerKeeping call void considerKeeping(StoreEntry &e); + /// whether e should be kept in local RAM for possible future caching + bool keepInLocalMemory(const StoreEntry &e) const; + /* Store API */ virtual int callback(); virtual StoreEntry * get(const cache_key *); @@ -47,7 +50,7 @@ static int64_t EntryLimit(); protected: - bool willFit(int64_t needed); + bool willFit(int64_t needed) const; void keep(StoreEntry &e); bool copyToShm(StoreEntry &e, MemStoreMap::Extras &extras); diff -u -r -N squid-3.2.0.18/src/mgr/Makefile.am squid-3.2.0.19/src/mgr/Makefile.am --- squid-3.2.0.18/src/mgr/Makefile.am 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/mgr/Makefile.am 2012-08-03 00:14:34.000000000 +1200 @@ -52,5 +52,3 @@ IntParam.h \ StringParam.cc \ StringParam.h - -EXTRA_DIST = stub_libmgr.cc diff -u -r -N squid-3.2.0.18/src/mgr/Makefile.in squid-3.2.0.19/src/mgr/Makefile.in --- squid-3.2.0.18/src/mgr/Makefile.in 2012-06-29 13:39:20.000000000 +1200 +++ squid-3.2.0.19/src/mgr/Makefile.in 2012-08-03 00:15:44.000000000 +1200 @@ -364,7 +364,6 @@ StringParam.cc \ StringParam.h -EXTRA_DIST = stub_libmgr.cc all: all-am .SUFFIXES: diff -u -r -N squid-3.2.0.18/src/mgr/stub_libmgr.cc squid-3.2.0.19/src/mgr/stub_libmgr.cc --- squid-3.2.0.18/src/mgr/stub_libmgr.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/mgr/stub_libmgr.cc 1970-01-01 12:00:00.000000000 +1200 @@ -1,240 +0,0 @@ -#include "squid.h" - -#define STUB_API "lmgr/libmgr.la" -#include "tests/STUB.h" - -// NP: used by Command.h instantiations -#include "mgr/ActionProfile.h" - -// NP: used by Action.h instantiations -#include "mgr/Command.h" -std::ostream &operator <<(std::ostream &os, const Mgr::Command &cmd) STUB_RETVAL(os) - -#include "mgr/Action.h" -Mgr::Action::Action(const CommandPointer &aCmd) STUB -Mgr::Action::~Action() STUB -void Mgr::Action::run(StoreEntry *entry, bool writeHttpHeader) STUB -void Mgr::Action::fillEntry(StoreEntry *entry, bool writeHttpHeader) STUB -void Mgr::Action::add(const Action &action) STUB -void Mgr::Action::respond(const Request &request) STUB -void Mgr::Action::sendResponse(unsigned int requestId) STUB -bool Mgr::Action::atomic() const STUB_RETVAL(false) -const char * Mgr::Action::name() const STUB_RETVAL(NULL) -static Mgr::Command static_Command; -const Mgr::Command & Mgr::Action::command() const STUB_RETVAL(static_Command) -StoreEntry * Mgr::Action::createStoreEntry() const STUB_RETVAL(NULL) -static Mgr::Action::Pointer dummyAction; - -#include "mgr/ActionParams.h" -Mgr::ActionParams::ActionParams() STUB -Mgr::ActionParams::ActionParams(const Ipc::TypedMsgHdr &msg) STUB -void Mgr::ActionParams::pack(Ipc::TypedMsgHdr &msg) const STUB -std::ostream &operator <<(std::ostream &os, const Mgr::ActionParams ¶ms) STUB_RETVAL(os) - -#include "mgr/ActionWriter.h" -//Mgr::ActionWriter::ActionWriter(const Action::Pointer &anAction, int aFd) STUB -//protected: -void Mgr::ActionWriter::start() STUB - -#include "mgr/BasicActions.h" -Mgr::Action::Pointer Mgr::MenuAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::MenuAction::dump(StoreEntry *entry) STUB -//protected: -//Mgr::MenuAction::MenuAction(const CommandPointer &cmd) STUB - -Mgr::Action::Pointer Mgr::ShutdownAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::ShutdownAction::dump(StoreEntry *entry) STUB -// protected: -//Mgr::ShutdownAction::ShutdownAction(const CommandPointer &cmd) STUB - -Mgr::Action::Pointer Mgr::ReconfigureAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::ReconfigureAction::dump(StoreEntry *entry) STUB -//protected: -//Mgr::ReconfigureAction::ReconfigureAction(const CommandPointer &cmd) STUB - -Mgr::Action::Pointer Mgr::RotateAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::RotateAction::dump(StoreEntry *entry) STUB -//protected: -//Mgr::RotateAction::RotateAction(const CommandPointer &cmd) STUB - -Mgr::Action::Pointer Mgr::OfflineToggleAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::OfflineToggleAction::dump(StoreEntry *entry) STUB -//protected: -//Mgr::OfflineToggleAction::OfflineToggleAction(const CommandPointer &cmd) STUB - -void Mgr::RegisterBasics() STUB - -#include "CountersAction.h" -//Mgr::CountersActionData::CountersActionData() STUB -Mgr::CountersActionData& Mgr::CountersActionData::operator +=(const Mgr::CountersActionData& stats) STUB_RETVAL(*this) - -Mgr::Action::Pointer Mgr::CountersAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::CountersAction::add(const Action& action) STUB -void Mgr::CountersAction::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::CountersAction::unpack(const Ipc::TypedMsgHdr& msg) STUB -//protected: -//Mgr::CountersAction::CountersAction(const CommandPointer &cmd) STUB -void Mgr::CountersAction::collect() STUB -void Mgr::CountersAction::dump(StoreEntry* entry) STUB - -#include "mgr/Filler.h" -//Mgr::Filler::Filler(const Action::Pointer &anAction, int aFd, unsigned int aRequestId) STUB -//protected: -//void Mgr::Filler::start() STUB -//void Mgr::Filler::swanSong() STUB - -#include "mgr/Forwarder.h" -//Mgr::Forwarder::Forwarder(int aFd, const ActionParams &aParams, HttpRequest* aRequest, StoreEntry* anEntry) STUB -//Mgr::Forwarder::~Forwarder() STUB -//protected: -void Mgr::Forwarder::cleanup() STUB -void Mgr::Forwarder::handleError() STUB -void Mgr::Forwarder::handleTimeout() STUB -void Mgr::Forwarder::handleException(const std::exception& e) STUB -void Mgr::Forwarder::handleRemoteAck() STUB - -#include "mgr/FunAction.h" -Mgr::Action::Pointer Mgr::FunAction::Create(const CommandPointer &cmd, OBJH *aHandler) STUB_RETVAL(dummyAction) -void Mgr::FunAction::respond(const Request& request) STUB -//protected: -//Mgr::FunAction::FunAction(const CommandPointer &cmd, OBJH *aHandler) STUB -void Mgr::FunAction::dump(StoreEntry *entry) STUB - -#include "mgr/InfoAction.h" -//Mgr::InfoActionData::InfoActionData() STUB -Mgr::InfoActionData& Mgr::InfoActionData::operator += (const Mgr::InfoActionData& stats) STUB_RETVAL(*this) - -Mgr::Action::Pointer Mgr::InfoAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::InfoAction::add(const Action& action) STUB -void Mgr::InfoAction::respond(const Request& request) STUB -void Mgr::InfoAction::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::InfoAction::unpack(const Ipc::TypedMsgHdr& msg) STUB -//protected: -//Mgr::InfoAction::InfoAction(const Mgr::CommandPointer &cmd) STUB -void Mgr::InfoAction::collect() STUB -void Mgr::InfoAction::dump(StoreEntry* entry) STUB - -#include "mgr/Inquirer.h" -//Mgr::Inquirer::Inquirer(Action::Pointer anAction, const Request &aCause, const Ipc::StrandCoords &coords) STUB -//protected: -void Mgr::Inquirer::start() STUB -bool Mgr::Inquirer::doneAll() const STUB_RETVAL(false) -void Mgr::Inquirer::cleanup() STUB -void Mgr::Inquirer::sendResponse() STUB -bool Mgr::Inquirer::aggregate(Ipc::Response::Pointer aResponse) STUB_RETVAL(false) - -#include "mgr/IntervalAction.h" -//Mgr::IntervalActionData::IntervalActionData() STUB -Mgr::IntervalActionData& Mgr::IntervalActionData::operator +=(const Mgr::IntervalActionData& stats) STUB_RETVAL(*this) - -//Mgr::Action::Pointer Mgr::IntervalAction::Create5min(const CommandPointer &cmd) STUB_RETVAL(new Mgr::IntervalAction(*cmd)) -//Mgr::Action::Pointer Mgr::IntervalAction::Create60min(const CommandPointer &cmd) STUB_RETVAL(new Mgr::IntervalAction(*cmd)) -void Mgr::IntervalAction::add(const Action& action) STUB -void Mgr::IntervalAction::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::IntervalAction::unpack(const Ipc::TypedMsgHdr& msg) STUB -//protected: -//Mgr::IntervalAction::IntervalAction(const CommandPointer &cmd, int aMinutes, int aHours) STUB -void Mgr::IntervalAction::collect() STUB -void Mgr::IntervalAction::dump(StoreEntry* entry) STUB - -#include "mgr/IntParam.h" -//Mgr::IntParam::IntParam() STUB -//Mgr::IntParam::IntParam(const std::vector& anArray) STUB -void Mgr::IntParam::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::IntParam::unpackValue(const Ipc::TypedMsgHdr& msg) STUB -static std::vector static_vector; -const std::vector& Mgr::IntParam::value() const STUB_RETVAL(static_vector) - -#include "mgr/IoAction.h" -//Mgr::IoActionData::IoActionData() STUB -Mgr::IoActionData& Mgr::IoActionData::operator += (const IoActionData& stats) STUB_RETVAL(*this) - -Mgr::Action::Pointer Mgr::IoAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) -void Mgr::IoAction::add(const Action& action) STUB -void Mgr::IoAction::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::IoAction::unpack(const Ipc::TypedMsgHdr& msg) STUB -//protected: -//Mgr::IoAction::IoAction(const CommandPointer &cmd) STUB -void Mgr::IoAction::collect() STUB -void Mgr::IoAction::dump(StoreEntry* entry) STUB - -//#include "mgr/QueryParam.h" -//void Mgr::QueryParam::pack(Ipc::TypedMsgHdr& msg) const = 0; -//void Mgr::QueryParam::unpackValue(const Ipc::TypedMsgHdr& msg) = 0; - -#include "mgr/QueryParams.h" -Mgr::QueryParam::Pointer Mgr::QueryParams::get(const String& name) const STUB_RETVAL(Mgr::QueryParam::Pointer(NULL)) -void Mgr::QueryParams::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::QueryParams::unpack(const Ipc::TypedMsgHdr& msg) STUB -bool Mgr::QueryParams::Parse(const String& aParamsStr, QueryParams& aParams) STUB_RETVAL(false) -//private: -//Params::const_iterator Mgr::QueryParams::find(const String& name) const STUB_RETVAL(new Mgr::Params::const_iterator(*this)) -Mgr::QueryParam::Pointer Mgr::QueryParams::CreateParam(QueryParam::Type aType) STUB_RETVAL(Mgr::QueryParam::Pointer(NULL)) -bool Mgr::QueryParams::ParseParam(const String& paramStr, Param& param) STUB_RETVAL(false) - -#include "mgr/Registration.h" -void Mgr::RegisterAction(char const * action, char const * desc, OBJH * handler, int pw_req_flag, int atomic); -void Mgr::RegisterAction(char const * action, char const * desc, ClassActionCreationHandler *handler, int pw_req_flag, int atomic); - -#include "mgr/Request.h" -//Mgr::Request::Request(int aRequestorId, unsigned int aRequestId, int aFd, const Mgr::ActionParams &aParams) STUB -//Mgr::Request::Request(const Ipc::TypedMsgHdr& msg) STUB -void Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const STUB -Ipc::Request::Pointer Mgr::Request::clone() const STUB_RETVAL(const_cast(this)) - -#include "mgr/Response.h" -//Mgr::Response::Response(unsigned int aRequestId, Action::Pointer anAction = NULL) STUB -//Mgr::Response::Response(const Ipc::TypedMsgHdr& msg) STUB -void Mgr::Response::pack(Ipc::TypedMsgHdr& msg) const STUB -static Ipc::Response::Pointer ipr_static; -Ipc::Response::Pointer Mgr::Response::clone() const STUB_RETVAL(Ipc::Response::Pointer(NULL)) -bool Mgr::Response::hasAction() const STUB_RETVAL(false) -//static Mgr::Action mgraction_static; -//const Mgr::Action& Mgr::Response::getAction() const STUB_RETVAL(mgraction_static) - -#include "mgr/ServiceTimesAction.h" -//Mgr::ServiceTimesActionData::ServiceTimesActionData() STUB -Mgr::ServiceTimesActionData& Mgr::ServiceTimesActionData::operator +=(const Mgr::ServiceTimesActionData& stats) STUB_RETVAL(*this) - -Mgr::Action::Pointer Mgr::ServiceTimesAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(Mgr::Action::Pointer(NULL)) -void Mgr::ServiceTimesAction::add(const Action& action) STUB -void Mgr::ServiceTimesAction::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::ServiceTimesAction::unpack(const Ipc::TypedMsgHdr& msg) STUB -//protected: -//Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &cmd) STUB -void Mgr::ServiceTimesAction::collect() STUB -void Mgr::ServiceTimesAction::dump(StoreEntry* entry) STUB - -#include "mgr/StoreIoAction.h" -//Mgr::StoreIoActionData::StoreIoActionData() STUB -Mgr::StoreIoActionData & Mgr::StoreIoActionData::operator +=(const StoreIoActionData& stats) STUB_RETVAL(*this) -//Mgr::StoreIoAction::StoreIoAction(const CommandPointer &cmd) STUB -Mgr::Action::Pointer Mgr::StoreIoAction::Create(const CommandPointer &cmd) STUB_RETVAL(Mgr::Action::Pointer(NULL)) -void Mgr::StoreIoAction::add(const Action& action) STUB -void Mgr::StoreIoAction::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::StoreIoAction::unpack(const Ipc::TypedMsgHdr& msg) STUB -void Mgr::StoreIoAction::collect() STUB -void Mgr::StoreIoAction::dump(StoreEntry* entry) STUB - -#include "mgr/StoreToCommWriter.h" -//Mgr::StoreToCommWriter::StoreToCommWriter(int aFd, StoreEntry *anEntry) STUB -Mgr::StoreToCommWriter::~StoreToCommWriter() STUB -void Mgr::StoreToCommWriter::start() STUB -void Mgr::StoreToCommWriter::swanSong() STUB -bool Mgr::StoreToCommWriter::doneAll() const STUB_RETVAL(false) -void Mgr::StoreToCommWriter::scheduleStoreCopy() STUB -void Mgr::StoreToCommWriter::noteStoreCopied(StoreIOBuffer ioBuf) STUB -void Mgr::StoreToCommWriter::NoteStoreCopied(void* data, StoreIOBuffer ioBuf) STUB -void Mgr::StoreToCommWriter::Abort(void* param) STUB -void Mgr::StoreToCommWriter::scheduleCommWrite(const StoreIOBuffer& ioBuf) STUB -void Mgr::StoreToCommWriter::noteCommWrote(const CommIoCbParams& params) STUB -void Mgr::StoreToCommWriter::noteCommClosed(const CommCloseCbParams& params) STUB -void Mgr::StoreToCommWriter::close() STUB - -#include "mgr/StringParam.h" -//Mgr::StringParam::StringParam() STUB -//Mgr::StringParam::StringParam(const String& aString) STUB -void Mgr::StringParam::pack(Ipc::TypedMsgHdr& msg) const STUB -void Mgr::StringParam::unpackValue(const Ipc::TypedMsgHdr& msg) STUB -static String t; -const String& Mgr::StringParam::value() const STUB_RETVAL(t) diff -u -r -N squid-3.2.0.18/src/mime_header.cc squid-3.2.0.19/src/mime_header.cc --- squid-3.2.0.18/src/mime_header.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/mime_header.cc 2012-08-03 00:14:34.000000000 +1200 @@ -71,7 +71,7 @@ return NULL; while (xisspace(*p)) - p++; + ++p; if (strncasecmp(p, name, namelen)) continue; @@ -92,11 +92,15 @@ q += namelen; - if (*q == ':') - q++, got = 1; + if (*q == ':') { + ++q; + got = 1; + } - while (xisspace(*q)) - q++, got = 1; + while (xisspace(*q)) { + ++q; + got = 1; + } if (got && prefix) { /* we could process list entries here if we had strcasestr(). */ @@ -153,7 +157,7 @@ break; } - e++; + ++e; } PROF_stop(headersEnd); diff -u -r -N squid-3.2.0.18/src/multicast.cc squid-3.2.0.19/src/multicast.cc --- squid-3.2.0.18/src/multicast.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/multicast.cc 2012-08-03 00:14:34.000000000 +1200 @@ -65,7 +65,7 @@ return; } - for (i = 0; i < (int) ia->count; i++) { + for (i = 0; i < (int) ia->count; ++i) { debugs(7, 9, "Listening for ICP requests on " << ia->in_addrs[i] ); if ( ! ia->in_addrs[i].IsIPv4() ) { diff -u -r -N squid-3.2.0.18/src/neighbors.cc squid-3.2.0.19/src/neighbors.cc --- squid-3.2.0.18/src/neighbors.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/neighbors.cc 2012-08-03 00:14:34.000000000 +1200 @@ -107,7 +107,7 @@ debugs(15, 3, "whichPeer: from " << from); for (p = Config.peers; p; p = p->next) { - for (j = 0; j < p->n_addresses; j++) { + for (j = 0; j < p->n_addresses; ++j) { if (from == p->addresses[j] && from.GetPort() == p->icp.port) { return p; } @@ -271,7 +271,7 @@ for (p = Config.peers; p; p = p->next) if (peerWouldBePinged(p, request)) - count++; + ++count; debugs(15, 3, "neighborsCount: " << count); @@ -332,7 +332,7 @@ } if (q) - q->rr_count++; + ++ q->rr_count; debugs(15, 3, HERE << "returning " << (q ? q->host : "NULL")); @@ -507,7 +507,7 @@ if (p) { *P = p->next; cbdataFree(p); - Config.npeers--; + --Config.npeers; } first_ping = Config.peers; @@ -612,7 +612,7 @@ if (!peerWouldBePinged(p, request)) continue; /* next peer */ - peers_pinged++; + ++peers_pinged; debugs(15, 4, "neighborsUdpPing: pinging peer " << p->host << " for '" << url << "'"); @@ -659,9 +659,9 @@ } } - queries_sent++; + ++queries_sent; - p->stats.pings_sent++; + ++ p->stats.pings_sent; if (p->type == PEER_MULTICAST) { mcast_exprep += p->mcast.n_replies_expected; @@ -670,10 +670,10 @@ /* its alive, expect a reply from it */ if (neighborType(p, request) == PEER_PARENT) { - parent_exprep++; + ++parent_exprep; parent_timeout += p->stats.rtt; } else { - sibling_exprep++; + ++sibling_exprep; sibling_timeout += p->stats.rtt; } } else { @@ -807,7 +807,7 @@ if (lookup == LOOKUP_NONE) continue; - choice_count++; + ++choice_count; if (lookup == LOOKUP_MISS) continue; @@ -822,7 +822,7 @@ best_rtt = p_rtt; if (p_rtt) /* informative choice (aka educated guess) */ - ichoice_count++; + ++ichoice_count; debugs(15, 4, "neighborsDigestSelect: peer " << p->host << " leads with rtt " << best_rtt); } @@ -856,10 +856,10 @@ neighborAlive(peer * p, const MemObject * mem, const icp_common_t * header) { peerAlive(p); - p->stats.pings_acked++; + ++ p->stats.pings_acked; if ((icp_opcode) header->opcode <= ICP_END) - p->icp.counts[header->opcode]++; + ++ p->icp.counts[header->opcode]; p->icp.version = (int) header->version; } @@ -893,8 +893,8 @@ neighborAliveHtcp(peer * p, const MemObject * mem, const htcpReplyData * htcp) { peerAlive(p); - p->stats.pings_acked++; - p->htcp.counts[htcp->hit ? 1 : 0]++; + ++ p->stats.pings_acked; + ++ p->htcp.counts[htcp->hit ? 1 : 0]; p->htcp.version = htcp->version; } @@ -906,9 +906,9 @@ if (p == NULL) return; - p->stats.ignored_replies++; + ++ p->stats.ignored_replies; - NLateReplies++; + ++NLateReplies; } static peer *non_peers = NULL; @@ -939,7 +939,7 @@ non_peers = np; } - np->icp.counts[opcode]++; + ++ np->icp.counts[opcode]; if (isPowTen(++np->stats.ignored_replies)) debugs(15, 1, "WARNING: Ignored " << np->stats.ignored_replies << " replies from non-peer " << np->host); @@ -1214,10 +1214,10 @@ p->tcp_up = p->connect_fail_limit; - for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; j++) { + for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; ++j) { p->addresses[j] = ia->in_addrs[j]; debugs(15, 2, "--> IP address #" << j << ": " << p->addresses[j]); - p->n_addresses++; + ++ p->n_addresses; } p->in_addr.SetEmpty(); @@ -1267,7 +1267,7 @@ return; } - p->tcp_up--; + -- p->tcp_up; if (!p->tcp_up) { debugs(15, 1, "Detected DEAD " << neighborTypeStr(p) << ": " << p->name); @@ -1311,13 +1311,13 @@ return ret;/* don't probe to often */ /* for each IP address of this peer. find one that we can connect to and probe it. */ - for (int i = 0; i < p->n_addresses; i++) { + for (int i = 0; i < p->n_addresses; ++i) { Comm::ConnectionPointer conn = new Comm::Connection; conn->remote = p->addresses[i]; conn->remote.SetPort(p->http_port); getOutgoingAddress(NULL, conn); - p->testing_now++; + ++ p->testing_now; AsyncCall::Pointer call = commCbCall(15,3, "peerProbeConnectDone", CommConnectCbPtrFun(peerProbeConnectDone, p)); Comm::ConnOpener *cs = new Comm::ConnOpener(conn, call, ctimeout); @@ -1341,7 +1341,7 @@ peerConnectFailedSilent(p); } - p->testing_now--; + -- p->testing_now; conn->close(); // TODO: log this traffic. } @@ -1439,7 +1439,7 @@ assert(proto == AnyP::PROTO_ICP); assert(fake); assert(mem); - psstate->ping.n_recv++; + ++ psstate->ping.n_recv; rtt_av_factor = RTT_AV_FACTOR; if (p->options.weighted_roundrobin) @@ -1602,7 +1602,7 @@ storeAppendPrintf(sentry, "Flags :"); dump_peer_options(sentry, e); - for (i = 0; i < e->n_addresses; i++) { + for (i = 0; i < e->n_addresses; ++i) { storeAppendPrintf(sentry, "Address[%d] : %s\n", i, e->addresses[i].NtoA(ntoabuf,MAX_IPSTRLEN) ); } diff -u -r -N squid-3.2.0.18/src/Parsing.cc squid-3.2.0.19/src/Parsing.cc --- squid-3.2.0.18/src/Parsing.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/Parsing.cc 2012-08-03 00:14:34.000000000 +1200 @@ -179,7 +179,8 @@ t = strchr(host, ']'); if (!t) return false; - *t++ = '\0'; + *t = '\0'; + ++t; if (*t != ':') return false; port = xatos(t + 1); diff -u -r -N squid-3.2.0.18/src/pconn.cc squid-3.2.0.19/src/pconn.cc --- squid-3.2.0.18/src/pconn.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/pconn.cc 2012-08-03 00:14:34.000000000 +1200 @@ -99,7 +99,7 @@ return false; // shuffle the remaining entries to fill the new gap. - for (; index < size_ - 1; index++) + for (; index < size_ - 1; ++index) theList_[index] = theList_[index + 1]; theList_[--size_] = NULL; @@ -136,7 +136,7 @@ size_t index; // ensure the first N entries are closed - for (index = 0; index < n; index++) { + for (index = 0; index < n; ++index) { const Comm::ConnectionPointer conn = theList_[index]; theList_[index] = NULL; clearHandlers(conn); @@ -145,12 +145,13 @@ parent_->noteConnectionRemoved(); } // shuffle the list N down. - for (index = 0; index < (size_t)size_ - n; index++) { + for (index = 0; index < (size_t)size_ - n; ++index) { theList_[index] = theList_[index + n]; } // ensure the last N entries are unset while (index < ((size_t)size_)) { - theList_[index++] = NULL; + theList_[index] = NULL; + ++index; } size_ -= n; } @@ -177,7 +178,7 @@ capacity_ <<= 1; const Comm::ConnectionPointer *oldList = theList_; theList_ = new Comm::ConnectionPointer[capacity_]; - for (int index = 0; index < size_; index++) + for (int index = 0; index < size_; ++index) theList_[index] = oldList[index]; delete[] oldList; @@ -186,7 +187,8 @@ if (parent_) parent_->noteConnectionAdded(); - theList_[size_++] = conn; + theList_[size_] = conn; + ++size_; AsyncCall::Pointer readCall = commCbCall(5,4, "IdleConnList::Read", CommIoCbPtrFun(IdleConnList::Read, this)); comm_read(conn, fakeReadBuf_, sizeof(fakeReadBuf_), readCall); @@ -216,7 +218,7 @@ Comm::ConnectionPointer IdleConnList::pop() { - for (int i=size_-1; i>=0; i--) { + for (int i=size_-1; i>=0; --i) { if (!isAvailable(i)) continue; @@ -254,7 +256,7 @@ const bool keyCheckAddr = !key->local.IsAnyAddr(); const bool keyCheckPort = key->local.GetPort() > 0; - for (int i=size_-1; i>=0; i--) { + for (int i=size_-1; i>=0; --i) { if (!isAvailable(i)) continue; @@ -349,7 +351,7 @@ "\t---- ---------\n", descr); - for (int i = 0; i < PCONN_HIST_SZ; i++) { + for (int i = 0; i < PCONN_HIST_SZ; ++i) { if (hist[i] == 0) continue; @@ -365,7 +367,8 @@ int i = 0; for (hash_link *walker = hid->next; walker; walker = hash_next(hid)) { - storeAppendPrintf(e, "\t item %5d: %s\n", i++, (char *)(walker->key)); + storeAppendPrintf(e, "\t item %5d: %s\n", i, (char *)(walker->key)); + ++i; } } @@ -377,7 +380,7 @@ int i; table = hash_create((HASHCMP *) strcmp, 229, hash_string); - for (i = 0; i < PCONN_HIST_SZ; i++) + for (i = 0; i < PCONN_HIST_SZ; ++i) hist[i] = 0; PconnModule::GetInstance()->add(this); @@ -465,7 +468,7 @@ if (uses >= PCONN_HIST_SZ) uses = PCONN_HIST_SZ - 1; - hist[uses]++; + ++hist[uses]; } /* ========== PconnModule ============================================ */ @@ -504,7 +507,7 @@ { assert(poolCount < MAX_NUM_PCONN_POOLS); *(pools+poolCount) = aPool; - poolCount++; + ++poolCount; } void @@ -512,7 +515,7 @@ { int i; - for (i = 0; i < poolCount; i++) { + for (i = 0; i < poolCount; ++i) { storeAppendPrintf(e, "\n Pool %d Stats\n", i); (*(pools+i))->dumpHist(e); storeAppendPrintf(e, "\n Pool %d Hash Table\n",i); diff -u -r -N squid-3.2.0.18/src/peer_proxy_negotiate_auth.cc squid-3.2.0.19/src/peer_proxy_negotiate_auth.cc --- squid-3.2.0.18/src/peer_proxy_negotiate_auth.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/peer_proxy_negotiate_auth.cc 2012-08-03 00:14:34.000000000 +1200 @@ -327,7 +327,7 @@ krb5_kt_default_name(kparam.context, buf, KT_PATH_MAX); p = strchr(buf, ':'); if (p) - p++; + ++p; if (keytab_filename) xfree(keytab_filename); keytab_filename = xstrdup(p ? p : buf); diff -u -r -N squid-3.2.0.18/src/peer_select.cc squid-3.2.0.19/src/peer_select.cc --- squid-3.2.0.18/src/peer_select.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/peer_select.cc 2012-08-03 00:14:34.000000000 +1200 @@ -232,6 +232,34 @@ { FwdServer *fs = psstate->servers; + // Bug 3243: CVE 2009-0801 + // Bypass of browser same-origin access control in intercepted communication + // To resolve this we must use only the original client destination when going DIRECT + // on intercepted traffic which failed Host verification + const HttpRequest *req = psstate->request; + const bool isIntercepted = !req->flags.redirected && + (req->flags.intercepted || req->flags.spoof_client_ip); + const bool useOriginalDst = Config.onoff.client_dst_passthru || !req->flags.hostVerified; + const bool choseDirect = fs && fs->code == HIER_DIRECT; + if (isIntercepted && useOriginalDst && choseDirect) { + // construct a "result" adding the ORIGINAL_DST to the set instead of DIRECT + Comm::ConnectionPointer p = new Comm::Connection(); + p->remote = req->clientConnectionManager->clientConnection->local; + p->peerType = fs->code; + p->setPeer(fs->_peer); + + // check for a configured outgoing address for this destination... + getOutgoingAddress(psstate->request, p); + psstate->paths->push_back(p); + + // clear the used fs and continue + psstate->servers = fs->next; + cbdataReferenceDone(fs->_peer); + memFree(fs, MEM_FWD_SERVER); + peerSelectDnsPaths(psstate); + return; + } + // convert the list of FwdServer destinations into destinations IP addresses if (fs && psstate->paths->size() < (unsigned int)Config.forward_max_tries) { // send the next one off for DNS lookup. @@ -254,9 +282,13 @@ debugs(44, 2, "Found sources for '" << psstate->entry->url() << "'"); debugs(44, 2, " always_direct = " << psstate->always_direct); debugs(44, 2, " never_direct = " << psstate->never_direct); - for (size_t i = 0; i < psstate->paths->size(); i++) { + for (size_t i = 0; i < psstate->paths->size(); ++i) { if ((*psstate->paths)[i]->peerType == HIER_DIRECT) debugs(44, 2, " DIRECT = " << (*psstate->paths)[i]); + else if ((*psstate->paths)[i]->peerType == ORIGINAL_DST) + debugs(44, 2, " ORIGINAL_DST = " << (*psstate->paths)[i]); + else if ((*psstate->paths)[i]->peerType == PINNED) + debugs(44, 2, " PINNED = " << (*psstate->paths)[i]); else debugs(44, 2, " cache_peer = " << (*psstate->paths)[i]); } @@ -289,7 +321,7 @@ // loop over each result address, adding to the possible destinations. int ip = ia->cur; - for (int n = 0; n < ia->count; n++, ip++) { + for (int n = 0; n < ia->count; ++n, ++ip) { Comm::ConnectionPointer p; if (ip >= ia->count) ip = 0; // looped back to zero. @@ -710,7 +742,7 @@ return; } - PeerStats.timeouts++; + ++PeerStats.timeouts; psstate->ping.timedout = 1; peerSelectFoo(psstate); } @@ -778,7 +810,7 @@ #endif - psstate->ping.n_recv++; + ++ psstate->ping.n_recv; if (op == ICP_MISS || op == ICP_DECHO) { if (type == PEER_PARENT) @@ -804,7 +836,7 @@ debugs(44, 3, "peerHandleHtcpReply: " << (htcp->hit ? "HIT" : "MISS") << " " << psstate->entry->url() ); - psstate->ping.n_recv++; + ++ psstate->ping.n_recv; if (htcp->hit) { psstate->hit = p; diff -u -r -N squid-3.2.0.18/src/peer_sourcehash.cc squid-3.2.0.19/src/peer_sourcehash.cc --- squid-3.2.0.18/src/peer_sourcehash.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/peer_sourcehash.cc 2012-08-03 00:14:34.000000000 +1200 @@ -66,7 +66,7 @@ char *t; /* Clean up */ - for (k = 0; k < n_sourcehash_peers; k++) { + for (k = 0; k < n_sourcehash_peers; ++k) { cbdataReferenceDone(sourcehash_peers[k]); } @@ -83,7 +83,7 @@ if (p->weight == 0) continue; - n_sourcehash_peers++; + ++n_sourcehash_peers; W += p->weight; } @@ -106,7 +106,7 @@ /* calculate this peers hash */ p->sourcehash.hash = 0; - for (t = p->name; *t != 0; t++) + for (t = p->name; *t != 0; ++t) p->sourcehash.hash += ROTATE_LEFT(p->sourcehash.hash, 19) + (unsigned int) *t; p->sourcehash.hash += p->sourcehash.hash * 0x62531965; @@ -142,7 +142,7 @@ X_last = 0.0; /* Empty X_0, nullifies the first pow statement */ - for (k = 1; k <= K; k++) { + for (k = 1; k <= K; ++k) { double Kk1 = (double) (K - k + 1); p = sourcehash_peers[k - 1]; p->sourcehash.load_multiplier = (Kk1 * (p->sourcehash.load_factor - P_last)) / Xn; @@ -183,11 +183,11 @@ /* calculate hash key */ debugs(39, 2, "peerSourceHashSelectParent: Calculating hash for " << key); - for (c = key; *c != 0; c++) + for (c = key; *c != 0; ++c) user_hash += ROTATE_LEFT(user_hash, 19) + *c; /* select peer */ - for (k = 0; k < n_sourcehash_peers; k++) { + for (k = 0; k < n_sourcehash_peers; ++k) { tp = sourcehash_peers[k]; combined_hash = (user_hash ^ tp->sourcehash.hash); combined_hash += combined_hash * 0x62531965; diff -u -r -N squid-3.2.0.18/src/peer_userhash.cc squid-3.2.0.19/src/peer_userhash.cc --- squid-3.2.0.18/src/peer_userhash.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/peer_userhash.cc 2012-08-03 00:14:34.000000000 +1200 @@ -70,7 +70,7 @@ char *t; /* Clean up */ - for (k = 0; k < n_userhash_peers; k++) { + for (k = 0; k < n_userhash_peers; ++k) { cbdataReferenceDone(userhash_peers[k]); } @@ -90,7 +90,7 @@ if (p->weight == 0) continue; - n_userhash_peers++; + ++n_userhash_peers; W += p->weight; } @@ -111,7 +111,7 @@ /* calculate this peers hash */ p->userhash.hash = 0; - for (t = p->name; *t != 0; t++) + for (t = p->name; *t != 0; ++t) p->userhash.hash += ROTATE_LEFT(p->userhash.hash, 19) + (unsigned int) *t; p->userhash.hash += p->userhash.hash * 0x62531965; @@ -147,7 +147,7 @@ X_last = 0.0; /* Empty X_0, nullifies the first pow statement */ - for (k = 1; k <= K; k++) { + for (k = 1; k <= K; ++k) { double Kk1 = (double) (K - k + 1); p = userhash_peers[k - 1]; p->userhash.load_multiplier = (Kk1 * (p->userhash.load_factor - P_last)) / Xn; @@ -191,11 +191,11 @@ /* calculate hash key */ debugs(39, 2, "peerUserHashSelectParent: Calculating hash for " << key); - for (c = key; *c != 0; c++) + for (c = key; *c != 0; ++c) user_hash += ROTATE_LEFT(user_hash, 19) + *c; /* select peer */ - for (k = 0; k < n_userhash_peers; k++) { + for (k = 0; k < n_userhash_peers; ++k) { tp = userhash_peers[k]; combined_hash = (user_hash ^ tp->userhash.hash); combined_hash += combined_hash * 0x62531965; diff -u -r -N squid-3.2.0.18/src/ProfStats.cc squid-3.2.0.19/src/ProfStats.cc --- squid-3.2.0.18/src/ProfStats.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ProfStats.cc 2012-08-03 00:14:34.000000000 +1200 @@ -100,7 +100,7 @@ static void xprof_sorthist(TimersArray * xprof_list) { - for (int i = 0; i < XPROF_LAST; i++) { + for (int i = 0; i < XPROF_LAST; ++i) { sortlist[i] = xprof_list[i]; } @@ -151,7 +151,7 @@ storeAppendPrintf(sentry, "Probe Name\t Events\t cumulated time \t best case \t average \t worst case\t Rate / sec \t %% in int\n"); - for (i = 0; i < XPROF_LAST; i++) { + for (i = 0; i < XPROF_LAST; ++i) { if (!hist[i]->name) continue; @@ -193,7 +193,7 @@ now = get_tick(); - for (i = 0; i < XPROF_LAST; i++) { + for (i = 0; i < XPROF_LAST; ++i) { hist[i]->name = head[i]->name; hist[i]->accu.summ += head[i]->accu.summ; hist[i]->accu.count += head[i]->accu.count; /* accumulate multisec */ @@ -295,7 +295,7 @@ xprof_Init(); xprof_delta = now - xprof_start_t; xprof_start_t = now; - xprof_events++; + ++xprof_events; if (!xprof_average_delta) xprof_average_delta = xprof_delta; diff -u -r -N squid-3.2.0.18/src/protos.h squid-3.2.0.19/src/protos.h --- squid-3.2.0.18/src/protos.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/protos.h 2012-08-03 00:14:34.000000000 +1200 @@ -234,7 +234,6 @@ /* store report about current header usage and other stats */ void httpHeaderStoreReport(StoreEntry * e); SQUIDCEXTERN void httpHdrMangleList(HttpHeader *, HttpRequest *, int req_or_rep); -SQUIDCEXTERN int httpReqHdrManglersConfigured(); #if SQUID_SNMP SQUIDCEXTERN PF snmpHandleUdp; diff -u -r -N squid-3.2.0.18/src/recv-announce.cc squid-3.2.0.19/src/recv-announce.cc --- squid-3.2.0.18/src/recv-announce.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/recv-announce.cc 2012-08-03 00:14:34.000000000 +1200 @@ -89,7 +89,7 @@ const char *logfile; char ip[4]; - for (len = 0; len < 32; len++) { + for (len = 0; len < 32; ++len) { signal(len, sig_handle); } diff -u -r -N squid-3.2.0.18/src/redirect.cc squid-3.2.0.19/src/redirect.cc --- squid-3.2.0.18/src/redirect.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/redirect.cc 2012-08-03 00:14:34.000000000 +1200 @@ -135,7 +135,7 @@ if (Config.onoff.redirector_bypass && redirectors->stats.queue_size) { /* Skip redirector if there is one request queued */ - n_bypassed++; + ++n_bypassed; handler(data, NULL); return; } diff -u -r -N squid-3.2.0.18/src/refresh.cc squid-3.2.0.19/src/refresh.cc --- squid-3.2.0.18/src/refresh.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/refresh.cc 2012-08-03 00:14:34.000000000 +1200 @@ -443,8 +443,8 @@ * be refreshed. */ int reason = refreshCheck(entry, NULL, Config.minimum_expiry_time); - refreshCounts[rcStore].total++; - refreshCounts[rcStore].status[reason]++; + ++ refreshCounts[rcStore].total; + ++ refreshCounts[rcStore].status[reason]; if (reason < STALE_MUST_REVALIDATE) /* Does not need refresh. This is certainly cachable */ @@ -491,8 +491,8 @@ refreshCheckHTTP(const StoreEntry * entry, HttpRequest * request) { int reason = refreshCheck(entry, request, 0); - refreshCounts[rcHTTP].total++; - refreshCounts[rcHTTP].status[reason]++; + ++ refreshCounts[rcHTTP].total; + ++ refreshCounts[rcHTTP].status[reason]; request->flags.stale_if_hit = refreshIsStaleIfHit(reason); return (Config.onoff.offline || reason < 200) ? 0 : 1; } @@ -501,8 +501,8 @@ refreshCheckICP(const StoreEntry * entry, HttpRequest * request) { int reason = refreshCheck(entry, request, 30); - refreshCounts[rcICP].total++; - refreshCounts[rcICP].status[reason]++; + ++ refreshCounts[rcICP].total; + ++ refreshCounts[rcICP].status[reason]; return (reason < 200) ? 0 : 1; } @@ -511,8 +511,8 @@ refreshCheckHTCP(const StoreEntry * entry, HttpRequest * request) { int reason = refreshCheck(entry, request, 10); - refreshCounts[rcHTCP].total++; - refreshCounts[rcHTCP].status[reason]++; + ++ refreshCounts[rcHTCP].total; + ++ refreshCounts[rcHTCP].status[reason]; return (reason < 200) ? 0 : 1; } @@ -525,8 +525,8 @@ int reason = refreshCheck(entry, entry->mem_obj ? entry->mem_obj->request : NULL, delta); - refreshCounts[rcCDigest].total++; - refreshCounts[rcCDigest].status[reason]++; + ++ refreshCounts[rcCDigest].total; + ++ refreshCounts[rcCDigest].status[reason]; return (reason < 200) ? 0 : 1; } diff -u -r -N squid-3.2.0.18/src/repl/lru/store_repl_lru.cc squid-3.2.0.19/src/repl/lru/store_repl_lru.cc --- squid-3.2.0.18/src/repl/lru/store_repl_lru.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/repl/lru/store_repl_lru.cc 2012-08-03 00:14:34.000000000 +1200 @@ -244,7 +244,7 @@ if (entry->locked()) { /* Shit, it is locked. we can't return this one */ - walker->locked++; + ++ walker->locked; dlinkAddTail(entry, &lru_node->node, &lru->list); goto try_again; } diff -u -r -N squid-3.2.0.18/src/snmp/Pdu.cc squid-3.2.0.19/src/snmp/Pdu.cc --- squid-3.2.0.18/src/snmp/Pdu.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/snmp/Pdu.cc 2012-08-03 00:14:34.000000000 +1200 @@ -53,7 +53,7 @@ Snmp::Pdu::aggregate(const Pdu& pdu) { Must(varCount() == pdu.varCount()); - aggrCount++; + ++aggrCount; for (variable_list* p_aggr = variables, *p_var = pdu.variables; p_var != NULL; p_aggr = p_aggr->next_variable, p_var = p_var->next_variable) { Must(p_aggr != NULL); diff -u -r -N squid-3.2.0.18/src/snmp_agent.cc squid-3.2.0.19/src/snmp_agent.cc --- squid-3.2.0.18/src/snmp_agent.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/snmp_agent.cc 2012-08-03 00:14:34.000000000 +1200 @@ -210,7 +210,7 @@ *ErrP = SNMP_ERR_NOERROR; u_int index = Var->name[LEN_SQ_MESH + 3] ; - for (p = Config.peers; p != NULL; p = p->next, cnt++) { + for (p = Config.peers; p != NULL; p = p->next, ++cnt) { if (p->index == index) { laddr = p->in_addr ; break; diff -u -r -N squid-3.2.0.18/src/snmp_core.cc squid-3.2.0.19/src/snmp_core.cc --- squid-3.2.0.18/src/snmp_core.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/snmp_core.cc 2012-08-03 00:14:34.000000000 +1200 @@ -497,7 +497,7 @@ oid *NextOidName = NULL; snint NextOidNameLen = 0; - index++; + ++index; if (get_next) ParseFn = snmpTreeNext(VarPtr->name, VarPtr->name_length, &NextOidName, &NextOidNameLen); @@ -568,11 +568,11 @@ mibTreeEntry = mib_tree_head; if (Current[count] == mibTreeEntry->name[count]) { - count++; + ++count; while ((mibTreeEntry) && (count < CurrentLen) && (!mibTreeEntry->parsefunction)) { mibTreeEntry = snmpTreeEntry(Current[count], count, mibTreeEntry); - count++; + ++count; } } @@ -594,13 +594,13 @@ int count = 0; if (Current[count] == mibTreeEntry->name[count]) { - count++; + ++count; while (mibTreeEntry != NULL && count < CurrentLen) { mibTreeEntry = snmpTreeEntry(Current[count], count, mibTreeEntry); if (mibTreeEntry != NULL) type = mibTreeEntry->aggrType; - count++; + ++count; } } @@ -622,7 +622,7 @@ mibTreeEntry = mib_tree_head; if (Current[count] == mibTreeEntry->name[count]) { - count++; + ++count; while ((mibTreeEntry) && (count < CurrentLen) && (!mibTreeEntry->parsefunction)) { mib_tree_entry *nextmibTreeEntry = snmpTreeEntry(Current[count], count, mibTreeEntry); @@ -632,7 +632,7 @@ else mibTreeEntry = nextmibTreeEntry; - count++; + ++count; } debugs(49, 5, "snmpTreeNext: Recursed down to requested object"); } else { @@ -654,17 +654,17 @@ } if ((mibTreeEntry) && (mibTreeEntry->parsefunction)) { - count--; + --count; nextoid = snmpTreeSiblingEntry(Current[count], count, mibTreeEntry->parent); if (nextoid) { debugs(49, 5, "snmpTreeNext: Next OID found for sibling" << nextoid ); mibTreeEntry = nextoid; - count++; + ++count; } else { debugs(49, 5, "snmpTreeNext: Attempting to recurse up for next object"); while (!nextoid) { - count--; + --count; if (mibTreeEntry->parent->parent) { nextoid = mibTreeEntry->parent; @@ -728,7 +728,7 @@ identifier = name[*len - 1]; while ((loop < TIME_INDEX_LEN) && (identifier != index[loop])) - loop++; + ++loop; if (loop < (TIME_INDEX_LEN - 1)) { instance = (oid *)xmalloc(sizeof(name) * (*len)); @@ -862,7 +862,7 @@ next = current->leaves[count]; } - count++; + ++count; } /* Exactly the sibling on right */ @@ -889,7 +889,7 @@ next = current->leaves[count]; } - count++; + ++count; } return (next); @@ -902,7 +902,7 @@ entry->leaves = (mib_tree_entry **)xrealloc(entry->leaves, sizeof(mib_tree_entry *) * (entry->children + 1)); entry->leaves[entry->children] = child; entry->leaves[entry->children]->parent = entry; - entry->children++; + ++ entry->children; } mib_tree_entry * @@ -931,7 +931,7 @@ while (r < namelen) { /* Find the child node which matches this */ - for (i = 0; i < e->children && e->leaves[i]->name[r] != name[r]; i++) ; // seek-loop + for (i = 0; i < e->children && e->leaves[i]->name[r] != name[r]; ++i) ; // seek-loop /* Are we pointing to that node? */ if (i >= e->children) @@ -940,7 +940,7 @@ /* Skip to that node! */ e = e->leaves[i]; - r++; + ++r; } xfree(name); @@ -962,7 +962,7 @@ while ( (p = strsep(&s_, delim)) != NULL) { *name = (oid*)xrealloc(*name, sizeof(oid) * ((*nl) + 1)); (*name)[*nl] = atoi(p); - (*nl)++; + ++(*nl); } xfree(s); @@ -1030,7 +1030,7 @@ if (children > 0) { entry->leaves = (mib_tree_entry **)xmalloc(sizeof(mib_tree_entry *) * children); - for (loop = 0; loop < children; loop++) { + for (loop = 0; loop < children; ++loop) { entry->leaves[loop] = va_arg(args, mib_tree_entry *); entry->leaves[loop]->parent = entry; } @@ -1054,7 +1054,7 @@ new_oid = (oid *)xmalloc(sizeof(oid) * length); if (length > 0) { - for (loop = 0; loop < length; loop++) { + for (loop = 0; loop < length; ++loop) { new_oid[loop] = va_arg(args, int); } } @@ -1073,7 +1073,7 @@ if (outbuf.isNull()) outbuf.init(16, MAX_IPSTRLEN); - for (x = 0; x < Len; x++) { + for (x = 0; x < Len; ++x) { size_t bytes = snprintf(mbuf, sizeof(mbuf), ".%u", (unsigned int) Name[x]); outbuf.append(mbuf, bytes); } @@ -1111,9 +1111,10 @@ addr.GetInAddr(i6addr); cp = (u_char *) &i6addr; } - for ( i=0 ; i < size ; i++) { + for ( i=0 ; i < size ; ++i) { // OID's are in network order - Dest[i] = *cp++; + Dest[i] = *cp; + ++cp; } MemBuf tmp; debugs(49, 7, "addr2oid: Dest : " << snmpDebugOid(Dest, size, tmp)); @@ -1138,7 +1139,7 @@ cp = (u_char *) &(i6addr); MemBuf tmp; debugs(49, 7, "oid2addr: id : " << snmpDebugOid(id, size, tmp) ); - for (i=0 ; i * &, ACLFilledChecklist *); static ACLSNMPCommunityStrategy *Instance(); /* Not implemented to prevent copies of the instance. */ - /* Not private to prevent brain dead g+++ warnings about + /* Not private to prevent brain dead g++ warnings about * private constructors with no friends */ ACLSNMPCommunityStrategy(ACLSNMPCommunityStrategy const &); diff -u -r -N squid-3.2.0.18/src/ssl/certificate_db.cc squid-3.2.0.19/src/ssl/certificate_db.cc --- squid-3.2.0.18/src/ssl/certificate_db.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/certificate_db.cc 2012-08-03 00:14:34.000000000 +1200 @@ -109,14 +109,14 @@ : width(cnlNumber) { row = new char *[width + 1]; - for (size_t i = 0; i < width + 1; i++) + for (size_t i = 0; i < width + 1; ++i) row[i] = NULL; } Ssl::CertificateDb::Row::~Row() { if (row) { - for (size_t i = 0; i < width + 1; i++) { + for (size_t i = 0; i < width + 1; ++i) { delete[](row[i]); } delete[](row); @@ -149,15 +149,16 @@ unsigned long Ssl::CertificateDb::index_serial_hash(const char **a) { const char *n = a[Ssl::CertificateDb::cnlSerial]; - while (*n == '0') n++; + while (*n == '0') + ++n; return lh_strhash(n); } int Ssl::CertificateDb::index_serial_cmp(const char **a, const char **b) { const char *aa, *bb; - for (aa = a[Ssl::CertificateDb::cnlSerial]; *aa == '0'; aa++); - for (bb = b[Ssl::CertificateDb::cnlSerial]; *bb == '0'; bb++); + for (aa = a[Ssl::CertificateDb::cnlSerial]; *aa == '0'; ++aa); + for (bb = b[Ssl::CertificateDb::cnlSerial]; *bb == '0'; ++bb); return strcmp(aa, bb); } @@ -495,7 +496,7 @@ #endif const Columns db_indexes[]={cnlSerial, cnlName}; - for (unsigned int i = 0; i < countof(db_indexes); i++) { + for (unsigned int i = 0; i < countof(db_indexes); ++i) { #if OPENSSL_VERSION_NUMBER >= 0x1000004fL if (LHASH_OF(OPENSSL_STRING) *fieldIndex = db.get()->index[db_indexes[i]]) lh_OPENSSL_STRING_delete(fieldIndex, (char **)row); @@ -518,10 +519,10 @@ bool removed_one = false; #if OPENSSL_VERSION_NUMBER >= 0x1000004fL - for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); i++) { + for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); ++i) { const char ** current_row = ((const char **)sk_OPENSSL_PSTRING_value(db.get()->data, i)); #else - for (int i = 0; i < sk_num(db.get()->data); i++) { + for (int i = 0; i < sk_num(db.get()->data); ++i) { const char ** current_row = ((const char **)sk_value(db.get()->data, i)); #endif @@ -566,10 +567,10 @@ return false; #if OPENSSL_VERSION_NUMBER >= 0x1000004fL - for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); i++) { + for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); ++i) { const char ** current_row = ((const char **)sk_OPENSSL_PSTRING_value(db.get()->data, i)); #else - for (int i = 0; i < sk_num(db.get()->data); i++) { + for (int i = 0; i < sk_num(db.get()->data); ++i) { const char ** current_row = ((const char **)sk_value(db.get()->data, i)); #endif if (host == current_row[cnlName]) { diff -u -r -N squid-3.2.0.18/src/ssl/context_storage.cc squid-3.2.0.19/src/ssl/context_storage.cc --- squid-3.2.0.18/src/ssl/context_storage.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/context_storage.cc 2012-08-03 00:14:34.000000000 +1200 @@ -31,7 +31,7 @@ stream << "Port" << delimiter << "Max mem(KB)" << delimiter << "Cert number" << delimiter << "KB/cert" << delimiter << "Mem used(KB)" << delimiter << "Mem free(KB)" << endString; // Add info for each port. - for (std::map::iterator i = TheGlobalContextStorage.storage.begin(); i != TheGlobalContextStorage.storage.end(); i++) { + for (std::map::iterator i = TheGlobalContextStorage.storage.begin(); i != TheGlobalContextStorage.storage.end(); ++i) { stream << i->first << delimiter; LocalContextStorage & ssl_store_policy(*(i->second)); stream << ssl_store_policy.max_memory / 1024 << delimiter; @@ -50,7 +50,7 @@ Ssl::LocalContextStorage::~LocalContextStorage() { - for (QueueIterator i = lru_queue.begin(); i != lru_queue.end(); i++) { + for (QueueIterator i = lru_queue.begin(); i != lru_queue.end(); ++i) { delete *i; } } @@ -90,7 +90,7 @@ void Ssl::LocalContextStorage::purgeOne() { QueueIterator i = lru_queue.end(); - i--; + --i; if (i != lru_queue.end()) { remove((*i)->host_name.c_str()); } @@ -131,7 +131,7 @@ Ssl::GlobalContextStorage::~GlobalContextStorage() { - for (std::map::iterator i = storage.begin(); i != storage.end(); i++) { + for (std::map::iterator i = storage.begin(); i != storage.end(); ++i) { delete i->second; } } @@ -161,7 +161,7 @@ reconfiguring = false; // remove or change old local storages. - for (std::map::iterator i = storage.begin(); i != storage.end(); i++) { + for (std::map::iterator i = storage.begin(); i != storage.end(); ++i) { std::map::iterator conf_i = configureStorage.find(i->first); if (conf_i == configureStorage.end()) { storage.erase(i); @@ -171,7 +171,7 @@ } // add new local storages. - for (std::map::iterator conf_i = configureStorage.begin(); conf_i != configureStorage.end(); conf_i++ ) { + for (std::map::iterator conf_i = configureStorage.begin(); conf_i != configureStorage.end(); ++conf_i ) { if (storage.find(conf_i->first) == storage.end()) { storage.insert(std::pair(conf_i->first, new LocalContextStorage(conf_i->second))); } diff -u -r -N squid-3.2.0.18/src/ssl/crtd_message.cc squid-3.2.0.19/src/ssl/crtd_message.cc --- squid-3.2.0.18/src/ssl/crtd_message.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/crtd_message.cc 2012-08-03 00:14:34.000000000 +1200 @@ -22,7 +22,7 @@ switch (state) { case BEFORE_CODE: { if (xisspace(*current_pos)) { - current_pos++; + ++current_pos; break; } if (xisalpha(*current_pos)) { @@ -35,7 +35,7 @@ case CODE: { if (xisalnum(*current_pos) || *current_pos == '_') { current_block += *current_pos; - current_pos++; + ++current_pos; break; } if (xisspace(*current_pos)) { @@ -49,7 +49,7 @@ } case BEFORE_LENGTH: { if (xisspace(*current_pos)) { - current_pos++; + ++current_pos; break; } if (xisdigit(*current_pos)) { @@ -62,7 +62,7 @@ case LENGTH: { if (xisdigit(*current_pos)) { current_block += *current_pos; - current_pos++; + ++current_pos; break; } if (xisspace(*current_pos)) { @@ -80,7 +80,7 @@ break; } if (xisspace(*current_pos)) { - current_pos++; + ++current_pos; break; } else { state = BODY; @@ -164,7 +164,7 @@ void Ssl::CrtdMessage::composeBody(CrtdMessage::BodyParams const & map, std::string const & other_part) { body.clear(); - for (BodyParams::const_iterator i = map.begin(); i != map.end(); i++) { + for (BodyParams::const_iterator i = map.begin(); i != map.end(); ++i) { if (i != map.begin()) body += "\n"; body += i->first + "=" + i->second; diff -u -r -N squid-3.2.0.18/src/ssl/ErrorDetail.cc squid-3.2.0.19/src/ssl/ErrorDetail.cc --- squid-3.2.0.18/src/ssl/ErrorDetail.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/ErrorDetail.cc 2012-08-03 00:14:34.000000000 +1200 @@ -98,7 +98,8 @@ Ssl::ssl_error_t Ssl::GetErrorCode(const char *name) { - for (int i = 0; TheSslErrorArray[i].name != NULL; i++) { + //TODO: use a std::map? + for (int i = 0; TheSslErrorArray[i].name != NULL; ++i) { if (strcmp(name, TheSslErrorArray[i].name) == 0) return TheSslErrorArray[i].value; } @@ -294,7 +295,7 @@ int Ssl::ErrorDetail::convert(const char *code, const char **value) const { *value = "-"; - for (int i=0; ErrorFormatingCodes[i].code!=NULL; i++) { + for (int i=0; ErrorFormatingCodes[i].code!=NULL; ++i) { const int len = strlen(ErrorFormatingCodes[i].code); if (strncmp(code,ErrorFormatingCodes[i].code, len)==0) { ErrorDetail::fmt_action_t action = ErrorFormatingCodes[i].fmt_action; diff -u -r -N squid-3.2.0.18/src/ssl/ErrorDetailManager.cc squid-3.2.0.19/src/ssl/ErrorDetailManager.cc --- squid-3.2.0.18/src/ssl/ErrorDetailManager.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/ErrorDetailManager.cc 2012-08-03 00:14:34.000000000 +1200 @@ -196,9 +196,10 @@ //ignore spaces, new lines and comment lines (starting with #) at the beggining const char *s; - for (s = buf.content(); (*s == '\n' || *s == ' ' || *s == '\t' || *s == '#') && s < e; s++) { + for (s = buf.content(); (*s == '\n' || *s == ' ' || *s == '\t' || *s == '#') && s < e; ++s) { if (*s == '#') - while (s$@ || ($(RM) -f $@ ; exit 1) noinst_LTLIBRARIES = libsslsquid.la libsslutil.la EXTRA_DIST = \ - stub_libsslsquid.cc \ - stub_libsslutil.cc \ ssl_crtd.8 @USE_SSL_CRTD_FALSE@SSL_CRTD = diff -u -r -N squid-3.2.0.18/src/ssl/ssl_crtd.cc squid-3.2.0.19/src/ssl/ssl_crtd.cc --- squid-3.2.0.18/src/ssl/ssl_crtd.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/ssl_crtd.cc 2012-08-03 00:14:34.000000000 +1200 @@ -139,7 +139,7 @@ char const * number_end = value; while ((*number_end >= '0' && *number_end <= '9')) { - number_end++; + ++number_end; } std::string number(number_begin, number_end - number_begin); diff -u -r -N squid-3.2.0.18/src/ssl/stub_libsslsquid.cc squid-3.2.0.19/src/ssl/stub_libsslsquid.cc --- squid-3.2.0.18/src/ssl/stub_libsslsquid.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/stub_libsslsquid.cc 1970-01-01 12:00:00.000000000 +1200 @@ -1,60 +0,0 @@ -#include "squid.h" -#include "fatal.h" - -/* Stub File for the ssl/libsslsquid.la convenience library */ - -#define STUB_BASE "ssl/libsslsquid.la" - -#define STUB { fatal(STUB_BASE " required."); } -#define STUB_RETVAL(x) { fatal(STUB_BASE " required."); return (x); } -#define STUB_RETREF(x) { fatal(STUB_BASE " required."); static x v; return v; } -#define STUB_RETREF2(x,y) { fatal(STUB_BASE " required."); static x v((y)); return v; } - -#include "ssl/Config.h" -Ssl::Config::Config() STUB -Ssl::Config::~Config() STUB -Ssl::Config Ssl::TheConfig; - -#include "ssl/context_storage.h" -//Ssl::CertificateStorageAction::CertificateStorageAction(const Mgr::Command::Pointer &cmd) STUB -Ssl::CertificateStorageAction::Pointer Ssl::CertificateStorageAction::Create(const Mgr::Command::Pointer &cmd) STUB_RETREF(Ssl::CertificateStorageAction::Pointer) -void Ssl::CertificateStorageAction::dump(StoreEntry *sentry) STUB -Ssl::LocalContextStorage::Item::Item(SSL_CTX * aSsl_ctx, std::string const & aName) STUB -Ssl::LocalContextStorage::Item::~Item() STUB -Ssl::LocalContextStorage::LocalContextStorage(size_t aMax_memory) STUB -Ssl::LocalContextStorage::~LocalContextStorage() STUB -void Ssl::LocalContextStorage::SetSize(size_t aMax_memory) STUB -SSL_CTX * Ssl::LocalContextStorage::add(char const * host_name, SSL_CTX * ssl_ctx) STUB_RETVAL(NULL) -SSL_CTX * Ssl::LocalContextStorage::find(char const * host_name) STUB_RETVAL(NULL) -void Ssl::LocalContextStorage::remove(char const * host_name) STUB -Ssl::GlobalContextStorage::GlobalContextStorage() STUB -Ssl::GlobalContextStorage::~GlobalContextStorage() STUB -void Ssl::GlobalContextStorage::addLocalStorage(Ip::Address const & address, size_t size_of_store) STUB -Ssl::LocalContextStorage & Ssl::GlobalContextStorage::getLocalStorage(Ip::Address const & address) STUB_RETREF2(Ssl::LocalContextStorage, 0) -void Ssl::GlobalContextStorage::reconfigureStart() STUB -//Ssl::GlobalContextStorage Ssl::TheGlobalContextStorage; - -#include "ssl/ErrorDetail.h" -Ssl::ssl_error_t parseErrorString(const char *name) STUB_RETVAL(0) -const char *Ssl::getErrorName(ssl_error_t value) STUB_RETVAL(NULL) -Ssl::ErrorDetail::ErrorDetail(ssl_error_t err_no, X509 *cert) STUB -Ssl::ErrorDetail::ErrorDetail(ErrorDetail const &) STUB -const String & Ssl::ErrorDetail::toString() const STUB_RETREF(String) - -#include "ssl/support.h" -SSL_CTX *sslCreateServerContext(const char *certfile, const char *keyfile, int version, const char *cipher, const char *options, const char *flags, const char *clientCA, const char *CAfile, const char *CApath, const char *CRLfile, const char *dhpath, const char *context) STUB_RETVAL(NULL) -SSL_CTX *sslCreateClientContext(const char *certfile, const char *keyfile, int version, const char *cipher, const char *options, const char *flags, const char *CAfile, const char *CApath, const char *CRLfile) STUB_RETVAL(NULL) -int ssl_read_method(int, char *, int) STUB_RETVAL(0) -int ssl_write_method(int, const char *, int) STUB_RETVAL(0) -void ssl_shutdown_method(int) STUB -const char *sslGetUserEmail(SSL *ssl) STUB_RETVAL(NULL) -// typedef char const *SSLGETATTRIBUTE(SSL *, const char *); -// SSLGETATTRIBUTE sslGetUserAttribute; -// SSLGETATTRIBUTE sslGetCAAttribute; -const char *sslGetUserCertificatePEM(SSL *ssl) STUB_RETVAL(NULL) -const char *sslGetUserCertificateChainPEM(SSL *ssl) STUB_RETVAL(NULL) -SSL_CTX *Ssl::generateSslContext(char const *host, Ssl::X509_Pointer const & signedX509, Ssl::EVP_PKEY_Pointer const & signedPkey) STUB_RETVAL(NULL) -bool Ssl::verifySslCertificateDate(SSL_CTX * sslContext) STUB_RETVAL(false) -SSL_CTX * Ssl::generateSslContextUsingPkeyAndCertFromMemory(const char * data) STUB_RETVAL(NULL) -int Ssl::matchX509CommonNames(X509 *peer_cert, void *check_data, int (*check_func)(void *check_data, ASN1_STRING *cn_data)) STUB_RETVAL(0) -int Ssl::asn1timeToString(ASN1_TIME *tm, char *buf, int len) STUB_RETVAL(0) diff -u -r -N squid-3.2.0.18/src/ssl/stub_libsslutil.cc squid-3.2.0.19/src/ssl/stub_libsslutil.cc --- squid-3.2.0.18/src/ssl/stub_libsslutil.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/stub_libsslutil.cc 1970-01-01 12:00:00.000000000 +1200 @@ -1,39 +0,0 @@ -#include "squid.h" -#include "fatal.h" - -/* Stub File for the ssl/libsslutil.la convenience library */ - -#define STUB_BASE "ssl/libsslutil.la" - -#define STUB { fatal(STUB_BASE " required."); } -#define STUB_RETVAL(x) { fatal(STUB_BASE " required."); return (x); } -#define STUB_RETREF(x) { fatal(STUB_BASE " required."); static x v; return v; } -#define STUB_RETREF2(x,y) { fatal(STUB_BASE " required."); static x v((y)); return v; } - -#include "ssl/crtd_message.h" -Ssl::CrtdMessage::CrtdMessage() STUB -Ssl::CrtdMessage::ParseResult Ssl::CrtdMessage::parse(const char * buffer, size_t len) STUB_RETVAL(ERROR) -std::string const & Ssl::CrtdMessage::getBody() const STUB_RETREF(std::string) -std::string const & Ssl::CrtdMessage::getCode() const STUB_RETREF(std::string) -void Ssl::CrtdMessage::setBody(std::string const & aBody) STUB -void Ssl::CrtdMessage::setCode(std::string const & aCode) STUB -std::string Ssl::CrtdMessage::compose() const STUB_RETREF(std::string) -void Ssl::CrtdMessage::clear() STUB -void Ssl::CrtdMessage::parseBody(BodyParams & map, std::string & other_part) const STUB -void Ssl::CrtdMessage::composeBody(BodyParams const & map, std::string const & other_part) STUB - -#include "ssl/gadgets.h" -X509_REQ * Ssl::createNewX509Request(EVP_PKEY_Pointer const & pkey, const char * hostname) STUB_RETVAL(NULL) -bool Ssl::writeCertAndPrivateKeyToMemory(X509_Pointer const & cert, EVP_PKEY_Pointer const & pkey, std::string & bufferToWrite) STUB_RETVAL(false) -bool Ssl::writeCertAndPrivateKeyToFile(X509_Pointer const & cert, EVP_PKEY_Pointer const & pkey, char const * filename) STUB_RETVAL(false) -bool Ssl::readCertAndPrivateKeyFromMemory(X509_Pointer & cert, EVP_PKEY_Pointer & pkey, char const * bufferToRead) STUB_RETVAL(false) -X509 * Ssl::signRequest(X509_REQ_Pointer const & request, X509_Pointer const & x509, EVP_PKEY_Pointer const & pkey, ASN1_TIME * timeNotAfter, BIGNUM const * serial) STUB_RETVAL(NULL) -bool Ssl::generateSslCertificateAndPrivateKey(char const *host, X509_Pointer const & signedX509, EVP_PKEY_Pointer const & signedPkey, X509_Pointer & cert, EVP_PKEY_Pointer & pkey, BIGNUM const* serial) STUB_RETVAL(false) -void Ssl::readCertAndPrivateKeyFromFiles(X509_Pointer & cert, EVP_PKEY_Pointer & pkey, char const * certFilename, char const * keyFilename) STUB -bool Ssl::sslDateIsInTheFuture(char const * date) STUB_RETVAL(false) - -#include "ssl/helper.h" -Ssl::Helper * Ssl::Helper::GetInstance() STUB_RETVAL(NULL) -void Ssl::Helper::Init() STUB -void Ssl::Helper::Shutdown() STUB -void Ssl::Helper::sslSubmit(Ssl::CrtdMessage const & message, HLPCB * callback, void *data) STUB diff -u -r -N squid-3.2.0.18/src/ssl/support.cc squid-3.2.0.19/src/ssl/support.cc --- squid-3.2.0.18/src/ssl/support.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/ssl/support.cc 2012-08-03 00:14:34.000000000 +1200 @@ -67,8 +67,7 @@ len = strlen(buf); while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r')) - - len--; + --len; buf[len] = '\0'; @@ -171,7 +170,7 @@ if (altnames) { int numalts = sk_GENERAL_NAME_num(altnames); - for (int i = 0; i < numalts; i++) { + for (int i = 0; i < numalts; ++i) { const GENERAL_NAME *check = sk_GENERAL_NAME_value(altnames, i); if (check->type != GEN_DNS) { continue; @@ -438,12 +437,12 @@ case '-': mode = MODE_REMOVE; - option++; + ++option; break; case '+': mode = MODE_ADD; - option++; + ++option; break; default: @@ -451,7 +450,7 @@ break; } - for (opttmp = ssl_options; opttmp->name; opttmp++) { + for (opttmp = ssl_options; opttmp->name; ++opttmp) { if (strcmp(opttmp->name, option) == 0) { opt = opttmp; break; @@ -636,7 +635,7 @@ if (!X509_STORE_add_crl(st, crl)) debugs(83, 2, "WARNING: Failed to add CRL from file '" << CRLfile << "'"); else - count++; + ++count; X509_CRL_free(crl); } @@ -1218,7 +1217,7 @@ mem = BIO_new(BIO_s_mem()); - for (i = 0; i < sk_X509_num(chain); i++) { + for (i = 0; i < sk_X509_num(chain); ++i) { X509 *cert = sk_X509_value(chain, i); PEM_write_bio_X509(mem, cert); } @@ -1312,7 +1311,7 @@ if (!chain) return; - for (int i = 0; i < sk_X509_num(chain); i++) { + for (int i = 0; i < sk_X509_num(chain); ++i) { X509 *cert = sk_X509_value(chain, i); if (SSL_CTX_add_extra_chain_cert(sslContext, cert)) { // increase the certificate lock diff -u -r -N squid-3.2.0.18/src/stat.cc squid-3.2.0.19/src/stat.cc --- squid-3.2.0.18/src/stat.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/stat.cc 2012-08-03 00:14:34.000000000 +1200 @@ -215,19 +215,19 @@ stats.http_reads = IOStats.Http.reads; - for (i = 0; i < _iostats::histSize; i++) { + for (i = 0; i < _iostats::histSize; ++i) { stats.http_read_hist[i] = IOStats.Http.read_hist[i]; } stats.ftp_reads = IOStats.Ftp.reads; - for (i = 0; i < _iostats::histSize; i++) { + for (i = 0; i < _iostats::histSize; ++i) { stats.ftp_read_hist[i] = IOStats.Ftp.read_hist[i]; } stats.gopher_reads = IOStats.Gopher.reads; - for (i = 0; i < _iostats::histSize; i++) { + for (i = 0; i < _iostats::histSize; ++i) { stats.gopher_read_hist[i] = IOStats.Gopher.read_hist[i]; } } @@ -241,7 +241,7 @@ storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.http_reads); storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < _iostats::histSize; i++) { + for (i = 0; i < _iostats::histSize; ++i) { storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n", i ? (1 << (i - 1)) + 1 : 1, 1 << i, @@ -254,7 +254,7 @@ storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.ftp_reads); storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < _iostats::histSize; i++) { + for (i = 0; i < _iostats::histSize; ++i) { storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n", i ? (1 << (i - 1)) + 1 : 1, 1 << i, @@ -267,7 +267,7 @@ storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.gopher_reads); storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < _iostats::histSize; i++) { + for (i = 0; i < _iostats::histSize; ++i) { storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n", i ? (1 << (i - 1)) + 1 : 1, 1 << i, @@ -1385,10 +1385,10 @@ int i; debugs(18, 5, "statInit: Initializing..."); - for (i = 0; i < N_COUNT_HIST; i++) + for (i = 0; i < N_COUNT_HIST; ++i) statCountersInit(&CountHist[i]); - for (i = 0; i < N_COUNT_HOUR_HIST; i++) + for (i = 0; i < N_COUNT_HOUR_HIST; ++i) statCountersInit(&CountHourHist[i]); statCountersInit(&statCounter); @@ -1419,7 +1419,7 @@ statCountersClean(CountHist + N_COUNT_HIST - 1); memmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters)); statCountersCopy(t, c); - NCountHist++; + ++NCountHist; if ((NCountHist % COUNT_INTERVAL) == 0) { /* we have an hours worth of readings. store previous hour */ @@ -1429,7 +1429,7 @@ statCountersClean(CountHourHist + N_COUNT_HOUR_HIST - 1); memmove(p2, t2, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters)); statCountersCopy(t2, c2); - NCountHourHist++; + ++NCountHourHist; } if (Config.warnings.high_rptm > 0) { @@ -1795,10 +1795,10 @@ { int i; - for (i = 0; i < N_COUNT_HIST; i++) + for (i = 0; i < N_COUNT_HIST; ++i) statCountersClean(&CountHist[i]); - for (i = 0; i < N_COUNT_HOUR_HIST; i++) + for (i = 0; i < N_COUNT_HOUR_HIST; ++i) statCountersClean(&CountHourHist[i]); } @@ -2081,7 +2081,7 @@ */ #define GRAPH_PER_MIN(Y) \ - for (i=0;i<(N_COUNT_HIST-2);i++) { \ + for (i=0;i<(N_COUNT_HIST-2);++i) { \ dt = tvSubDsec(CountHist[i+1].timestamp, CountHist[i].timestamp); \ if (dt <= 0.0) \ break; \ @@ -2091,7 +2091,7 @@ } #define GRAPH_PER_HOUR(Y) \ - for (i=0;i<(N_COUNT_HOUR_HIST-2);i++) { \ + for (i=0;i<(N_COUNT_HOUR_HIST-2);++i) { \ dt = tvSubDsec(CountHourHist[i+1].timestamp, CountHourHist[i].timestamp); \ if (dt <= 0.0) \ break; \ diff -u -r -N squid-3.2.0.18/src/store.cc squid-3.2.0.19/src/store.cc --- squid-3.2.0.18/src/store.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store.cc 2012-08-03 00:14:34.000000000 +1200 @@ -514,7 +514,7 @@ StoreEntry::lock() { - lock_count++; + ++lock_count; debugs(20, 3, "StoreEntry::lock: key '" << getMD5Text() <<"' count=" << lock_count ); lastref = squid_curtime; @@ -555,7 +555,7 @@ int StoreEntry::unlock() { - lock_count--; + --lock_count; debugs(20, 3, "StoreEntry::unlock: key '" << getMD5Text() << "' count=" << lock_count); if (lock_count) @@ -974,34 +974,34 @@ if (mem_obj->method != METHOD_GET) { debugs(20, 2, "StoreEntry::checkCachable: NO: non-GET method"); - store_check_cachable_hist.no.non_get++; + ++store_check_cachable_hist.no.non_get; } else #endif if (store_status == STORE_OK && EBIT_TEST(flags, ENTRY_BAD_LENGTH)) { debugs(20, 2, "StoreEntry::checkCachable: NO: wrong content-length"); - store_check_cachable_hist.no.wrong_content_length++; + ++store_check_cachable_hist.no.wrong_content_length; } else if (!EBIT_TEST(flags, ENTRY_CACHABLE)) { debugs(20, 2, "StoreEntry::checkCachable: NO: not cachable"); - store_check_cachable_hist.no.not_entry_cachable++; + ++store_check_cachable_hist.no.not_entry_cachable; } else if (EBIT_TEST(flags, ENTRY_NEGCACHED)) { debugs(20, 3, "StoreEntry::checkCachable: NO: negative cached"); - store_check_cachable_hist.no.negative_cached++; + ++store_check_cachable_hist.no.negative_cached; return 0; /* avoid release call below */ } else if ((getReply()->content_length > 0 && getReply()->content_length > Config.Store.maxObjectSize) || mem_obj->endOffset() > Config.Store.maxObjectSize) { debugs(20, 2, "StoreEntry::checkCachable: NO: too big"); - store_check_cachable_hist.no.too_big++; + ++store_check_cachable_hist.no.too_big; } else if (getReply()->content_length > Config.Store.maxObjectSize) { debugs(20, 2, "StoreEntry::checkCachable: NO: too big"); - store_check_cachable_hist.no.too_big++; + ++store_check_cachable_hist.no.too_big; } else if (checkTooSmall()) { debugs(20, 2, "StoreEntry::checkCachable: NO: too small"); - store_check_cachable_hist.no.too_small++; + ++store_check_cachable_hist.no.too_small; } else if (EBIT_TEST(flags, KEY_PRIVATE)) { debugs(20, 3, "StoreEntry::checkCachable: NO: private key"); - store_check_cachable_hist.no.private_key++; + ++store_check_cachable_hist.no.private_key; } else if (swap_status != SWAPOUT_NONE) { /* * here we checked the swap_status because the remaining @@ -1011,12 +1011,12 @@ return 1; } else if (storeTooManyDiskFilesOpen()) { debugs(20, 2, "StoreEntry::checkCachable: NO: too many disk files open"); - store_check_cachable_hist.no.too_many_open_files++; + ++store_check_cachable_hist.no.too_many_open_files; } else if (fdNFree() < RESERVED_FD) { debugs(20, 2, "StoreEntry::checkCachable: NO: too many FD's open"); - store_check_cachable_hist.no.too_many_open_fds++; + ++store_check_cachable_hist.no.too_many_open_fds; } else { - store_check_cachable_hist.yes.Default++; + ++store_check_cachable_hist.yes.Default; return 1; } @@ -1107,7 +1107,7 @@ void StoreEntry::abort() { - statCounter.aborted_requests++; + ++statCounter.aborted_requests; assert(store_status == STORE_PENDING); assert(mem_obj != NULL); debugs(20, 6, "storeAbort: " << getMD5Text()); @@ -1187,7 +1187,7 @@ while ((e = walker->Next(walker))) { e->purgeMem(); - released++; + ++released; if (mem_node::InUseCount() + pages_needed < store_pages_max) break; @@ -1276,7 +1276,7 @@ * Fake a call to StoreEntry->lock() When rebuilding is done, * we'll just call StoreEntry->unlock() on these. */ - lock_count++; + ++lock_count; setReleaseFlag(); LateReleaseStack.push_back(this); } else { @@ -1315,7 +1315,7 @@ return; } - for (i = 0; i < 10; i++) { + for (i = 0; i < 10; ++i) { e = LateReleaseStack.count ? LateReleaseStack.pop() : NULL; if (e == NULL) { @@ -1325,7 +1325,7 @@ } e->unlock(); - n++; + ++n; } eventAdd("storeLateRelease", storeLateRelease, NULL, 0.0, 1); @@ -1446,14 +1446,6 @@ if (!Config.onoff.memory_cache_first && swap_status == SWAPOUT_DONE && refcount == 1) return 0; - if (Config.memShared && IamWorkerProcess()) { - const int64_t expectedSize = mem_obj->expectedReplySize(); - // objects of unknown size are not allowed into memory cache, for now - if (expectedSize < 0 || - expectedSize > static_cast(Config.Store.maxInMemObjSize)) - return 0; - } - return 1; } @@ -1652,7 +1644,7 @@ debugs(20, 4, "StoreEntry::setMemStatus: inserted mem node " << mem_obj->url << " key: " << getMD5Text()); } - hot_obj_count++; // TODO: maintain for the shared hot cache as well + ++hot_obj_count; // TODO: maintain for the shared hot cache as well } else { if (EBIT_TEST(flags, ENTRY_SPECIAL)) { debugs(20, 4, "StoreEntry::setMemStatus: special entry " << mem_obj->url); @@ -1661,7 +1653,7 @@ debugs(20, 4, "StoreEntry::setMemStatus: removed mem node " << mem_obj->url); } - hot_obj_count--; + --hot_obj_count; } mem_status = new_status; @@ -1769,7 +1761,7 @@ int i; /* find the number of currently known repl types */ - for (i = 0; storerepl_list && storerepl_list[i].typestr; i++) { + for (i = 0; storerepl_list && storerepl_list[i].typestr; ++i) { if (strcmp(storerepl_list[i].typestr, type) == 0) { debugs(20, 1, "WARNING: Trying to load store replacement policy " << type << " twice."); return; @@ -1794,7 +1786,7 @@ { storerepl_entry_t *r; - for (r = storerepl_list; r && r->typestr; r++) { + for (r = storerepl_list; r && r->typestr; ++r) { if (strcmp(r->typestr, settings->type) == 0) return r->create(settings->args); } diff -u -r -N squid-3.2.0.18/src/store_client.cc squid-3.2.0.19/src/store_client.cc --- squid-3.2.0.18/src/store_client.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_client.cc 2012-08-03 00:14:34.000000000 +1200 @@ -190,7 +190,7 @@ { cmp_offset = 0; flags.disk_io_pending = 0; - entry->refcount++; + ++ entry->refcount; if (getType() == STORE_DISK_CLIENT) /* assert we'll be able to get the data we want */ @@ -701,7 +701,7 @@ } dlinkDelete(&sc->node, &mem->clients); - mem->nclients--; + -- mem->nclients; if (e->store_status == STORE_OK && e->swap_status != SWAPOUT_DONE) e->swapOut(); @@ -709,7 +709,7 @@ if (sc->swapin_sio != NULL) { storeClose(sc->swapin_sio, StoreIOState::readerDone); sc->swapin_sio = NULL; - statCounter.swap.ins++; + ++statCounter.swap.ins; } if (sc->_callback.pending()) { @@ -758,7 +758,8 @@ for (node = mem_obj->clients.head; node; node = nx) { sc = (store_client *)node->data; nx = node->next; - debugs(90, 3, "StoreEntry::InvokeHandlers: checking client #" << i++ ); + debugs(90, 3, "StoreEntry::InvokeHandlers: checking client #" << i ); + ++i; if (!sc->_callback.pending()) continue; diff -u -r -N squid-3.2.0.18/src/store_digest.cc squid-3.2.0.19/src/store_digest.cc --- squid-3.2.0.18/src/store_digest.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_digest.cc 2012-08-03 00:14:34.000000000 +1200 @@ -165,10 +165,10 @@ if (!EBIT_TEST(entry->flags, KEY_PRIVATE)) { if (!cacheDigestTest(store_digest, (const cache_key *)entry->key)) { - sd_stats.del_lost_count++; + ++sd_stats.del_lost_count; debugs(71, 6, "storeDigestDel: lost entry, key: " << entry->getMD5Text() << " url: " << entry->url() ); } else { - sd_stats.del_count++; + ++sd_stats.del_count; cacheDigestDel(store_digest, (const cache_key *)entry->key); debugs(71, 6, "storeDigestDel: deled entry, key: " << entry->getMD5Text()); } @@ -275,19 +275,19 @@ assert(entry && store_digest); if (storeDigestAddable(entry)) { - sd_stats.add_count++; + ++sd_stats.add_count; if (cacheDigestTest(store_digest, (const cache_key *)entry->key)) - sd_stats.add_coll_count++; + ++sd_stats.add_coll_count; cacheDigestAdd(store_digest, (const cache_key *)entry->key); debugs(71, 6, "storeDigestAdd: added entry, key: " << entry->getMD5Text()); } else { - sd_stats.rej_count++; + ++sd_stats.rej_count; if (cacheDigestTest(store_digest, (const cache_key *)entry->key)) - sd_stats.rej_coll_count++; + ++sd_stats.rej_coll_count; } } @@ -337,7 +337,7 @@ { assert(sd_state.rebuild_lock); sd_state.rebuild_lock = 0; - sd_state.rebuild_count++; + ++sd_state.rebuild_count; debugs(71, 2, "storeDigestRebuildFinish: done."); eventAdd("storeDigestRebuildStart", storeDigestRebuildStart, NULL, (double) Config.digest.rebuild_period, 1); @@ -444,7 +444,7 @@ e->mem_obj->unlinkRequest(); e->unlock(); sd_state.rewrite_lock = NULL; - sd_state.rewrite_count++; + ++sd_state.rewrite_count; eventAdd("storeDigestRewriteStart", storeDigestRewriteStart, NULL, (double) Config.digest.rewrite_period, 1); /* resume pending Rebuild if any */ diff -u -r -N squid-3.2.0.18/src/store_dir.cc squid-3.2.0.19/src/store_dir.cc --- squid-3.2.0.18/src/store_dir.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_dir.cc 2012-08-03 00:14:34.000000000 +1200 @@ -204,7 +204,7 @@ if (objsize != -1) objsize += e->mem_obj->swap_hdr_sz; - for (i = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0; i < Config.cacheSwap.n_configured; ++i) { if (++dirn >= Config.cacheSwap.n_configured) dirn = 0; @@ -253,7 +253,7 @@ if (objsize != -1) objsize += e->mem_obj->swap_hdr_sz; - for (i = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0; i < Config.cacheSwap.n_configured; ++i) { SD = dynamic_cast(INDEXSD(i)); SD->flags.selected = 0; @@ -456,7 +456,7 @@ getCurrentTime(); start = current_time; - for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { + for (dirn = 0; dirn < Config.cacheSwap.n_configured; ++dirn) { sd = dynamic_cast(INDEXSD(dirn)); if (sd->writeCleanStart() < 0) { @@ -473,7 +473,7 @@ while (notdone) { notdone = 0; - for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { + for (dirn = 0; dirn < Config.cacheSwap.n_configured; ++dirn) { sd = dynamic_cast(INDEXSD(dirn)); if (NULL == sd->cleanLog) @@ -500,7 +500,7 @@ } /* Flush */ - for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) + for (dirn = 0; dirn < Config.cacheSwap.n_configured; ++dirn) dynamic_cast(INDEXSD(dirn))->writeCleanDone(); if (reopen) @@ -663,7 +663,7 @@ if (reconfiguring) return; - for (i = 0; i < swap->n_configured; i++) { + for (i = 0; i < swap->n_configured; ++i) { /* TODO XXX this lets the swapdir free resources asynchronously * swap->swapDirs[i]->deactivate(); * but there may be such a means already. @@ -781,6 +781,40 @@ fatal("not implemented"); } +// move this into [non-shared] memory cache class when we have one +/// whether e should be kept in local RAM for possible future caching +bool +StoreController::keepForLocalMemoryCache(const StoreEntry &e) const +{ + if (!e.memoryCachable()) + return false; + + // does the current and expected size obey memory caching limits? + assert(e.mem_obj); + const int64_t loadedSize = e.mem_obj->endOffset(); + const int64_t expectedSize = e.mem_obj->expectedReplySize(); // may be < 0 + const int64_t ramSize = max(loadedSize, expectedSize); + const int64_t ramLimit = min( + static_cast(Config.memMaxSize), + static_cast(Config.Store.maxInMemObjSize)); + return ramSize <= ramLimit; +} + +void +StoreController::maybeTrimMemory(StoreEntry &e, const bool preserveSwappable) +{ + bool keepInLocalMemory = false; + if (memStore) + keepInLocalMemory = memStore->keepInLocalMemory(e); + else + keepInLocalMemory = keepForLocalMemoryCache(e); + + debugs(20, 7, HERE << "keepInLocalMemory: " << keepInLocalMemory); + + if (!keepInLocalMemory) + e.trimMemory(preserveSwappable); +} + void StoreController::handleIdleEntry(StoreEntry &e) { @@ -795,7 +829,7 @@ memStore->considerKeeping(e); // leave keepInLocalMemory false; memStore maintains its own cache } else { - keepInLocalMemory = e.memoryCachable() && // entry is in good shape and + keepInLocalMemory = keepForLocalMemoryCache(e) && // in good shape and // the local memory cache is not overflowing (mem_node::InUseCount() <= store_pages_max); } @@ -845,7 +879,7 @@ do { j = 0; - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (ndir >= Config.cacheSwap.n_configured) ndir = ndir % Config.cacheSwap.n_configured; @@ -862,7 +896,7 @@ } } while (j > 0); - ndir++; + ++ndir; return result; } @@ -870,7 +904,7 @@ void StoreHashIndex::create() { - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (dir(i).active()) store(i)->create(); } @@ -916,7 +950,7 @@ store_table = hash_create(storeKeyHashCmp, store_hash_buckets, storeKeyHashHash); - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { /* this starts a search of the store dirs, loading their * index. under the new Store api this should be * driven by the StoreHashIndex, not by each store. @@ -941,7 +975,7 @@ { uint64_t result = 0; - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (dir(i).doReportStat()) result += store(i)->maxSize(); } @@ -954,7 +988,7 @@ { uint64_t result = 0; - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (dir(i).doReportStat()) result += store(i)->minSize(); } @@ -967,7 +1001,7 @@ { uint64_t result = 0; - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (dir(i).doReportStat()) result += store(i)->currentSize(); } @@ -980,7 +1014,7 @@ { uint64_t result = 0; - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (dir(i).doReportStat()) result += store(i)->currentCount(); } @@ -993,7 +1027,7 @@ { int64_t result = -1; - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { if (dir(i).active() && store(i)->maxObjectSize() > result) result = store(i)->maxObjectSize(); } @@ -1005,7 +1039,7 @@ StoreHashIndex::getStats(StoreInfoStats &stats) const { // accumulate per-disk cache stats - for (int i = 0; i < Config.cacheSwap.n_configured; i++) { + for (int i = 0; i < Config.cacheSwap.n_configured; ++i) { StoreInfoStats dirStats; store(i)->getStats(dirStats); stats += dirStats; @@ -1024,7 +1058,7 @@ /* Now go through each store, calling its stat routine */ - for (i = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0; i < Config.cacheSwap.n_configured; ++i) { storeAppendPrintf(&output, "\n"); store(i)->stat(output); } @@ -1048,7 +1082,7 @@ int i; /* walk each fs */ - for (i = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0; i < Config.cacheSwap.n_configured; ++i) { /* XXX FixMe: This should be done "in parallell" on the different * cache_dirs, not one at a time. */ @@ -1143,6 +1177,6 @@ entries.push_back(e); } - bucket++; + ++bucket; debugs(47,3, "got entries: " << entries.size()); } diff -u -r -N squid-3.2.0.18/src/Store.h squid-3.2.0.19/src/Store.h --- squid-3.2.0.18/src/Store.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/Store.h 2012-08-03 00:14:34.000000000 +1200 @@ -351,6 +351,11 @@ /// called when the entry is no longer needed by any transaction virtual void handleIdleEntry(StoreEntry &e) {} + // XXX: This method belongs to Store::Root/StoreController, but it is here + // because test cases use non-StoreController derivatives as Root + /// called to get rid of no longer needed entry data in RAM, if any + virtual void maybeTrimMemory(StoreEntry &e, const bool preserveSwappable) {} + private: static RefCount CurrentRoot; }; diff -u -r -N squid-3.2.0.18/src/store_io.cc squid-3.2.0.19/src/store_io.cc --- squid-3.2.0.18/src/store_io.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_io.cc 2012-08-03 00:14:34.000000000 +1200 @@ -16,7 +16,7 @@ { assert (e); - store_io_stats.create.calls++; + ++store_io_stats.create.calls; /* * Pick the swapdir @@ -26,7 +26,7 @@ if (dirn == -1) { debugs(20, 2, "storeCreate: no swapdirs for " << *e); - store_io_stats.create.select_fail++; + ++store_io_stats.create.select_fail; return NULL; } @@ -37,9 +37,9 @@ StoreIOState::Pointer sio = SD->createStoreIO(*e, file_callback, close_callback, callback_data); if (sio == NULL) - store_io_stats.create.create_fail++; + ++store_io_stats.create.create_fail; else - store_io_stats.create.success++; + ++store_io_stats.create.success; return sio; } diff -u -r -N squid-3.2.0.18/src/store_key_md5.cc squid-3.2.0.19/src/store_key_md5.cc --- squid-3.2.0.18/src/store_key_md5.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_key_md5.cc 2012-08-03 00:14:34.000000000 +1200 @@ -44,7 +44,7 @@ static char buf[SQUID_MD5_DIGEST_LENGTH * 2+1]; int i; - for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; i++) + for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) snprintf(&buf[i*2],sizeof(buf) - i*2, "%02X", *(key + i)); return buf; @@ -58,7 +58,7 @@ int j = 0; char t[3]; - for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; i++) { + for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) { t[0] = *(buf + (j++)); t[1] = *(buf + (j++)); t[2] = '\0'; @@ -75,7 +75,7 @@ const unsigned char *B = (const unsigned char *)b; int i; - for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; i++) { + for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) { if (A[i] < B[i]) return -1; diff -u -r -N squid-3.2.0.18/src/store_log.cc squid-3.2.0.19/src/store_log.cc --- squid-3.2.0.18/src/store_log.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_log.cc 2012-08-03 00:14:34.000000000 +1200 @@ -68,7 +68,7 @@ if (NULL == storelog) return; - storeLogTagsCounts[tag]++; + ++storeLogTagsCounts[tag]; if (mem != NULL) { if (mem->log_url == NULL) { debugs(20, 1, "storeLog: NULL log_url for " << mem->url); @@ -161,7 +161,7 @@ storeLogTagsHist(StoreEntry *e) { int tag; - for (tag = 0; tag <= STORE_LOG_SWAPOUTFAIL; tag++) { + for (tag = 0; tag <= STORE_LOG_SWAPOUTFAIL; ++tag) { storeAppendPrintf(e, "%s %d\n", storeLogTags[tag], storeLogTagsCounts[tag]); diff -u -r -N squid-3.2.0.18/src/StoreMetaUnpacker.cc squid-3.2.0.19/src/StoreMetaUnpacker.cc --- squid-3.2.0.18/src/StoreMetaUnpacker.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/StoreMetaUnpacker.cc 2012-08-03 00:14:34.000000000 +1200 @@ -92,7 +92,8 @@ void StoreMetaUnpacker::getType() { - type = buf[position++]; + type = buf[position]; + ++position; } void diff -u -r -N squid-3.2.0.18/src/store_rebuild.cc squid-3.2.0.19/src/store_rebuild.cc --- squid-3.2.0.18/src/store_rebuild.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_rebuild.cc 2012-08-03 00:14:34.000000000 +1200 @@ -74,6 +74,7 @@ size_t statCount = 500; + // TODO: Avoid the loop (and ENTRY_VALIDATED) unless opt_store_doublecheck. while (statCount-- && !currentSearch->isDone() && currentSearch->next()) { StoreEntry *e; @@ -91,7 +92,7 @@ if (opt_store_doublecheck) if (storeCleanupDoubleCheck(e)) - store_errors++; + ++store_errors; EBIT_SET(e->flags, ENTRY_VALIDATED); @@ -109,11 +110,15 @@ debugs(20, 1, " Completed Validation Procedure"); debugs(20, 1, " Validated " << validated << " Entries"); debugs(20, 1, " store_swap_size = " << Store::Root().currentSize() / 1024.0 << " KB"); - StoreController::store_dirs_rebuilding--; + --StoreController::store_dirs_rebuilding; assert(0 == StoreController::store_dirs_rebuilding); - if (opt_store_doublecheck) - assert(store_errors == 0); + if (opt_store_doublecheck && store_errors) { + fatalf("Quitting after finding %d cache index inconsistencies. " \ + "Removing cache index will force its slow rebuild. " \ + "Removing -S will let Squid start with an inconsistent " \ + "cache index (at your own risk).\n", store_errors); + } if (store_digest) storeDigestNoteStoreReady(); @@ -222,7 +227,7 @@ if (squid_curtime - last_report < 15) return; - for (sd_index = 0; sd_index < Config.cacheSwap.n_configured; sd_index++) { + for (sd_index = 0; sd_index < Config.cacheSwap.n_configured; ++sd_index) { n += (double) RebuildProgress[sd_index].scanned; d += (double) RebuildProgress[sd_index].total; } @@ -292,7 +297,7 @@ assert(buf.hasSpace()); // caller must allocate const int len = FD_READ_METHOD(fd, buf.space(), buf.spaceSize()); - statCounter.syscalls.disk.reads++; + ++ statCounter.syscalls.disk.reads; if (len < 0) { const int xerrno = errno; debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << diskIndex << "]: " << @@ -363,7 +368,7 @@ } if (EBIT_TEST(tmpe.flags, KEY_PRIVATE)) { - counts.badflags++; + ++ counts.badflags; return false; } @@ -397,7 +402,7 @@ if (e->lastref >= tmpe.lastref) { /* key already exists, old entry is newer */ /* keep old, ignore new */ - counts.dupcount++; + ++counts.dupcount; // For some stores, get() creates/unpacks a store entry. Signal // such stores that we will no longer use the get() result: @@ -409,7 +414,7 @@ /* URL already exists, this swapfile not being used */ /* junk old, load new */ e->release(); /* release old entry */ - counts.dupcount++; + ++counts.dupcount; } } diff -u -r -N squid-3.2.0.18/src/store_swapmeta.cc squid-3.2.0.19/src/store_swapmeta.cc --- squid-3.2.0.18/src/store_swapmeta.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_swapmeta.cc 2012-08-03 00:14:34.000000000 +1200 @@ -125,7 +125,7 @@ int j = 0; char *buf; assert(length != NULL); - buflen++; /* STORE_META_OK */ + ++buflen; /* STORE_META_OK */ buflen += sizeof(int); /* size of header to follow */ for (t = tlv_list; t; t = t->next) @@ -133,14 +133,16 @@ buf = (char *)xmalloc(buflen); - buf[j++] = (char) STORE_META_OK; + buf[j] = (char) STORE_META_OK; + ++j; memcpy(&buf[j], &buflen, sizeof(int)); j += sizeof(int); for (t = tlv_list; t; t = t->next) { - buf[j++] = t->getType(); + buf[j] = t->getType(); + ++j; memcpy(&buf[j], &t->length, sizeof(int)); j += sizeof(int); memcpy(&buf[j], t->value, t->length); diff -u -r -N squid-3.2.0.18/src/store_swapout.cc squid-3.2.0.19/src/store_swapout.cc --- squid-3.2.0.18/src/store_swapout.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/store_swapout.cc 2012-08-03 00:14:34.000000000 +1200 @@ -198,7 +198,7 @@ const bool weAreOrMayBeSwappingOut = swappingOut() || mayStartSwapOut(); - trimMemory(weAreOrMayBeSwappingOut); + Store::Root().maybeTrimMemory(*this, weAreOrMayBeSwappingOut); if (!weAreOrMayBeSwappingOut) return; // nothing else to do diff -u -r -N squid-3.2.0.18/src/String.cc squid-3.2.0.19/src/String.cc --- squid-3.2.0.18/src/String.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/String.cc 2012-08-03 00:14:34.000000000 +1200 @@ -363,7 +363,7 @@ goto error; while (*p && xisspace(*p)) - p++; + ++p; if (!*p) goto error; @@ -374,7 +374,7 @@ switch (ch) { case '\\': - p++; + ++p; switch (*p) { @@ -395,33 +395,36 @@ } - *d++ = ch; + *d = ch; + ++d; if (ch) - p++; + ++p; break; case '"': quoted = !quoted; - p++; + ++p; break; default: if (!quoted && xisspace(*p)) { - p++; + ++p; goto done; } - *d++ = *p++; + *d = *p; + ++d; + ++p; break; } } done: - *d++ = '\0'; + *d = '\0'; error: *t = (char *) p; diff -u -r -N squid-3.2.0.18/src/structs.h squid-3.2.0.19/src/structs.h --- squid-3.2.0.18/src/structs.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/structs.h 2012-08-03 00:14:34.000000000 +1200 @@ -36,6 +36,7 @@ /* needed for the global config */ #include "HttpHeader.h" +#include "HttpHeaderTools.h" /* for ICP_END */ #include "icp_opcode.h" @@ -58,14 +59,6 @@ acl_deny_info_list *next; }; - -class acl_access; - -struct _header_mangler { - acl_access *access_list; - char *replacement; -}; - class ACLChecklist; #if SQUID_SNMP @@ -577,10 +570,10 @@ } mcast_miss; #endif - /* one access list per header type we know of */ - header_mangler request_header_access[HDR_ENUM_END]; - /* one access list per header type we know of */ - header_mangler reply_header_access[HDR_ENUM_END]; + /// request_header_access and request_header_replace + HeaderManglers *request_header_access; + /// reply_header_access and reply_header_replace + HeaderManglers *reply_header_access; char *coredump_dir; char *chroot_dir; #if USE_CACHE_DIGESTS diff -u -r -N squid-3.2.0.18/src/SwapDir.cc squid-3.2.0.19/src/SwapDir.cc --- squid-3.2.0.18/src/SwapDir.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/SwapDir.cc 2012-08-03 00:14:34.000000000 +1200 @@ -244,8 +244,10 @@ while ((name = strtok(NULL, w_space)) != NULL) { value = strchr(name, '='); - if (value) - *value++ = '\0'; /* cut on = */ + if (value) { + *value = '\0'; /* cut on = */ + ++value; + } debugs(3,2, "SwapDir::parseOptions: parsing store option '" << name << "'='" << (value ? value : "") << "'"); diff -u -r -N squid-3.2.0.18/src/SwapDir.h squid-3.2.0.19/src/SwapDir.h --- squid-3.2.0.18/src/SwapDir.h 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/SwapDir.h 2012-08-03 00:14:34.000000000 +1200 @@ -60,6 +60,7 @@ /* Store parent API */ virtual void handleIdleEntry(StoreEntry &e); + virtual void maybeTrimMemory(StoreEntry &e, const bool preserveSwappable); virtual void init(); @@ -91,6 +92,7 @@ private: void createOneStore(Store &aStore); + bool keepForLocalMemoryCache(const StoreEntry &e) const; StorePointer swapDir; ///< summary view of all disk caches MemStore *memStore; ///< memory cache diff -u -r -N squid-3.2.0.18/src/tests/stub_cache_cf.cc squid-3.2.0.19/src/tests/stub_cache_cf.cc --- squid-3.2.0.18/src/tests/stub_cache_cf.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_cache_cf.cc 2012-08-03 00:14:34.000000000 +1200 @@ -66,7 +66,7 @@ self_destruct(); while (*token && xisspace(*token)) - token++; + ++token; if (!*token) self_destruct(); diff -u -r -N squid-3.2.0.18/src/tests/stub_debug.cc squid-3.2.0.19/src/tests/stub_debug.cc --- squid-3.2.0.18/src/tests/stub_debug.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_debug.cc 2012-08-03 00:14:34.000000000 +1200 @@ -73,9 +73,6 @@ static void _db_print_stderr(const char *format, va_list args) { - /* FIXME? */ - // if (opt_debug_stderr < Debug::level) - if (1 < Debug::level) return; diff -u -r -N squid-3.2.0.18/src/tests/stub_fd.cc squid-3.2.0.19/src/tests/stub_fd.cc --- squid-3.2.0.18/src/tests/stub_fd.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_fd.cc 2012-08-03 00:14:34.000000000 +1200 @@ -65,3 +65,10 @@ { fatal ("Not Implemented"); } + +void +fdAdjustReserved() +{ + fatal ("Not Implemented"); +} + diff -u -r -N squid-3.2.0.18/src/tests/stub_libcomm.cc squid-3.2.0.19/src/tests/stub_libcomm.cc --- squid-3.2.0.18/src/tests/stub_libcomm.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_libcomm.cc 2012-08-03 00:14:34.000000000 +1200 @@ -21,21 +21,24 @@ void Comm::Connection::setPeer(peer * p) STUB #include "comm/ConnOpener.h" +CBDATA_NAMESPACED_CLASS_INIT(Comm, ConnOpener); bool Comm::ConnOpener::doneAll() const STUB_RETVAL(false) -//Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &, AsyncCall::Pointer &, time_t) STUB -//Comm::ConnOpener::~ConnOpener() STUB -void Comm::ConnOpener::setHost(const char *) STUB -const char * Comm::ConnOpener::getHost() const STUB_RETVAL(NULL) +void Comm::ConnOpener::start() STUB +void Comm::ConnOpener::swanSong() STUB +Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &, AsyncCall::Pointer &, time_t) : AsyncJob("STUB Comm::ConnOpener") STUB + Comm::ConnOpener::~ConnOpener() STUB + void Comm::ConnOpener::setHost(const char *) STUB + const char * Comm::ConnOpener::getHost() const STUB_RETVAL(NULL) #include "comm/forward.h" -bool Comm::IsConnOpen(const Comm::ConnectionPointer &) STUB_RETVAL(false) + bool Comm::IsConnOpen(const Comm::ConnectionPointer &) STUB_RETVAL(false) #include "comm/IoCallback.h" -void Comm::IoCallback::setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz) STUB -void Comm::IoCallback::selectOrQueueWrite() STUB -void Comm::IoCallback::cancel(const char *reason) STUB -void Comm::IoCallback::finish(comm_err_t code, int xerrn) STUB -Comm::CbEntry *Comm::iocb_table = NULL; + void Comm::IoCallback::setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz) STUB + void Comm::IoCallback::selectOrQueueWrite() STUB + void Comm::IoCallback::cancel(const char *reason) STUB + void Comm::IoCallback::finish(comm_err_t code, int xerrn) STUB + Comm::CbEntry *Comm::iocb_table = NULL; void Comm::CallbackTableInit() STUB void Comm::CallbackTableDestruct() STUB @@ -57,4 +60,4 @@ void Comm::Write(const Comm::ConnectionPointer &, const char *, int, AsyncCall::Pointer &, FREE *) STUB void Comm::Write(const Comm::ConnectionPointer &conn, MemBuf *mb, AsyncCall::Pointer &callback) STUB void Comm::WriteCancel(const Comm::ConnectionPointer &conn, const char *reason) STUB -//PF Comm::HandleWrite STUB +/*PF*/ void Comm::HandleWrite(int, void*) STUB diff -u -r -N squid-3.2.0.18/src/tests/stub_libmgr.cc squid-3.2.0.19/src/tests/stub_libmgr.cc --- squid-3.2.0.18/src/tests/stub_libmgr.cc 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_libmgr.cc 2012-08-03 00:14:34.000000000 +1200 @@ -0,0 +1,241 @@ +#include "squid.h" +#include "comm/Connection.h" + +#define STUB_API "lmgr/libmgr.la" +#include "tests/STUB.h" + +// NP: used by Command.h instantiations +#include "mgr/ActionProfile.h" + +// NP: used by Action.h instantiations +#include "mgr/Command.h" +std::ostream &operator <<(std::ostream &os, const Mgr::Command &cmd) STUB_RETVAL(os) + +#include "mgr/Action.h" +Mgr::Action::Action(const CommandPointer &aCmd) STUB +Mgr::Action::~Action() STUB +void Mgr::Action::run(StoreEntry *entry, bool writeHttpHeader) STUB +void Mgr::Action::fillEntry(StoreEntry *entry, bool writeHttpHeader) STUB +void Mgr::Action::add(const Action &action) STUB +void Mgr::Action::respond(const Request &request) STUB +void Mgr::Action::sendResponse(unsigned int requestId) STUB +bool Mgr::Action::atomic() const STUB_RETVAL(false) +const char * Mgr::Action::name() const STUB_RETVAL(NULL) +static Mgr::Command static_Command; +const Mgr::Command & Mgr::Action::command() const STUB_RETVAL(static_Command) +StoreEntry * Mgr::Action::createStoreEntry() const STUB_RETVAL(NULL) +static Mgr::Action::Pointer dummyAction; + +#include "mgr/ActionParams.h" +Mgr::ActionParams::ActionParams() STUB +Mgr::ActionParams::ActionParams(const Ipc::TypedMsgHdr &msg) STUB +void Mgr::ActionParams::pack(Ipc::TypedMsgHdr &msg) const STUB +std::ostream &operator <<(std::ostream &os, const Mgr::ActionParams ¶ms) STUB_RETVAL(os) + +#include "mgr/ActionWriter.h" +//Mgr::ActionWriter::ActionWriter(const Action::Pointer &anAction, int aFd) STUB +//protected: +void Mgr::ActionWriter::start() STUB + +#include "mgr/BasicActions.h" +Mgr::Action::Pointer Mgr::MenuAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::MenuAction::dump(StoreEntry *entry) STUB +//protected: +//Mgr::MenuAction::MenuAction(const CommandPointer &cmd) STUB + +Mgr::Action::Pointer Mgr::ShutdownAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::ShutdownAction::dump(StoreEntry *entry) STUB +// protected: +//Mgr::ShutdownAction::ShutdownAction(const CommandPointer &cmd) STUB + +Mgr::Action::Pointer Mgr::ReconfigureAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::ReconfigureAction::dump(StoreEntry *entry) STUB +//protected: +//Mgr::ReconfigureAction::ReconfigureAction(const CommandPointer &cmd) STUB + +Mgr::Action::Pointer Mgr::RotateAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::RotateAction::dump(StoreEntry *entry) STUB +//protected: +//Mgr::RotateAction::RotateAction(const CommandPointer &cmd) STUB + +Mgr::Action::Pointer Mgr::OfflineToggleAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::OfflineToggleAction::dump(StoreEntry *entry) STUB +//protected: +//Mgr::OfflineToggleAction::OfflineToggleAction(const CommandPointer &cmd) STUB + +void Mgr::RegisterBasics() STUB + +#include "mgr/CountersAction.h" +//Mgr::CountersActionData::CountersActionData() STUB +Mgr::CountersActionData& Mgr::CountersActionData::operator +=(const Mgr::CountersActionData& stats) STUB_RETVAL(*this) + +Mgr::Action::Pointer Mgr::CountersAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::CountersAction::add(const Action& action) STUB +void Mgr::CountersAction::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::CountersAction::unpack(const Ipc::TypedMsgHdr& msg) STUB +//protected: +//Mgr::CountersAction::CountersAction(const CommandPointer &cmd) STUB +void Mgr::CountersAction::collect() STUB +void Mgr::CountersAction::dump(StoreEntry* entry) STUB + +#include "mgr/Filler.h" +//Mgr::Filler::Filler(const Action::Pointer &anAction, int aFd, unsigned int aRequestId) STUB +//protected: +//void Mgr::Filler::start() STUB +//void Mgr::Filler::swanSong() STUB + +#include "mgr/Forwarder.h" +//Mgr::Forwarder::Forwarder(int aFd, const ActionParams &aParams, HttpRequest* aRequest, StoreEntry* anEntry) STUB +//Mgr::Forwarder::~Forwarder() STUB +//protected: +void Mgr::Forwarder::cleanup() STUB +void Mgr::Forwarder::handleError() STUB +void Mgr::Forwarder::handleTimeout() STUB +void Mgr::Forwarder::handleException(const std::exception& e) STUB +void Mgr::Forwarder::handleRemoteAck() STUB + +#include "mgr/FunAction.h" +Mgr::Action::Pointer Mgr::FunAction::Create(const CommandPointer &cmd, OBJH *aHandler) STUB_RETVAL(dummyAction) +void Mgr::FunAction::respond(const Request& request) STUB +//protected: +//Mgr::FunAction::FunAction(const CommandPointer &cmd, OBJH *aHandler) STUB +void Mgr::FunAction::dump(StoreEntry *entry) STUB + +#include "mgr/InfoAction.h" +//Mgr::InfoActionData::InfoActionData() STUB +Mgr::InfoActionData& Mgr::InfoActionData::operator += (const Mgr::InfoActionData& stats) STUB_RETVAL(*this) + +Mgr::Action::Pointer Mgr::InfoAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::InfoAction::add(const Action& action) STUB +void Mgr::InfoAction::respond(const Request& request) STUB +void Mgr::InfoAction::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::InfoAction::unpack(const Ipc::TypedMsgHdr& msg) STUB +//protected: +//Mgr::InfoAction::InfoAction(const Mgr::CommandPointer &cmd) STUB +void Mgr::InfoAction::collect() STUB +void Mgr::InfoAction::dump(StoreEntry* entry) STUB + +#include "mgr/Inquirer.h" +//Mgr::Inquirer::Inquirer(Action::Pointer anAction, const Request &aCause, const Ipc::StrandCoords &coords) STUB +//protected: +void Mgr::Inquirer::start() STUB +bool Mgr::Inquirer::doneAll() const STUB_RETVAL(false) +void Mgr::Inquirer::cleanup() STUB +void Mgr::Inquirer::sendResponse() STUB +bool Mgr::Inquirer::aggregate(Ipc::Response::Pointer aResponse) STUB_RETVAL(false) + +#include "mgr/IntervalAction.h" +//Mgr::IntervalActionData::IntervalActionData() STUB +Mgr::IntervalActionData& Mgr::IntervalActionData::operator +=(const Mgr::IntervalActionData& stats) STUB_RETVAL(*this) + +//Mgr::Action::Pointer Mgr::IntervalAction::Create5min(const CommandPointer &cmd) STUB_RETVAL(new Mgr::IntervalAction(*cmd)) +//Mgr::Action::Pointer Mgr::IntervalAction::Create60min(const CommandPointer &cmd) STUB_RETVAL(new Mgr::IntervalAction(*cmd)) +void Mgr::IntervalAction::add(const Action& action) STUB +void Mgr::IntervalAction::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::IntervalAction::unpack(const Ipc::TypedMsgHdr& msg) STUB +//protected: +//Mgr::IntervalAction::IntervalAction(const CommandPointer &cmd, int aMinutes, int aHours) STUB +void Mgr::IntervalAction::collect() STUB +void Mgr::IntervalAction::dump(StoreEntry* entry) STUB + +#include "mgr/IntParam.h" +//Mgr::IntParam::IntParam() STUB +//Mgr::IntParam::IntParam(const std::vector& anArray) STUB +void Mgr::IntParam::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::IntParam::unpackValue(const Ipc::TypedMsgHdr& msg) STUB +static std::vector static_vector; +const std::vector& Mgr::IntParam::value() const STUB_RETVAL(static_vector) + +#include "mgr/IoAction.h" +//Mgr::IoActionData::IoActionData() STUB +Mgr::IoActionData& Mgr::IoActionData::operator += (const IoActionData& stats) STUB_RETVAL(*this) + +Mgr::Action::Pointer Mgr::IoAction::Create(const CommandPointer &cmd) STUB_RETVAL(dummyAction) +void Mgr::IoAction::add(const Action& action) STUB +void Mgr::IoAction::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::IoAction::unpack(const Ipc::TypedMsgHdr& msg) STUB +//protected: +//Mgr::IoAction::IoAction(const CommandPointer &cmd) STUB +void Mgr::IoAction::collect() STUB +void Mgr::IoAction::dump(StoreEntry* entry) STUB + +//#include "mgr/QueryParam.h" +//void Mgr::QueryParam::pack(Ipc::TypedMsgHdr& msg) const = 0; +//void Mgr::QueryParam::unpackValue(const Ipc::TypedMsgHdr& msg) = 0; + +#include "mgr/QueryParams.h" +Mgr::QueryParam::Pointer Mgr::QueryParams::get(const String& name) const STUB_RETVAL(Mgr::QueryParam::Pointer(NULL)) +void Mgr::QueryParams::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::QueryParams::unpack(const Ipc::TypedMsgHdr& msg) STUB +bool Mgr::QueryParams::Parse(const String& aParamsStr, QueryParams& aParams) STUB_RETVAL(false) +//private: +//Params::const_iterator Mgr::QueryParams::find(const String& name) const STUB_RETVAL(new Mgr::Params::const_iterator(*this)) +Mgr::QueryParam::Pointer Mgr::QueryParams::CreateParam(QueryParam::Type aType) STUB_RETVAL(Mgr::QueryParam::Pointer(NULL)) +bool Mgr::QueryParams::ParseParam(const String& paramStr, Param& param) STUB_RETVAL(false) + +#include "mgr/Registration.h" +void Mgr::RegisterAction(char const * action, char const * desc, OBJH * handler, int pw_req_flag, int atomic); +void Mgr::RegisterAction(char const * action, char const * desc, ClassActionCreationHandler *handler, int pw_req_flag, int atomic); + +#include "mgr/Request.h" +//Mgr::Request::Request(int aRequestorId, unsigned int aRequestId, int aFd, const Mgr::ActionParams &aParams) STUB +//Mgr::Request::Request(const Ipc::TypedMsgHdr& msg) STUB +void Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const STUB +Ipc::Request::Pointer Mgr::Request::clone() const STUB_RETVAL(const_cast(this)) + +#include "mgr/Response.h" +//Mgr::Response::Response(unsigned int aRequestId, Action::Pointer anAction = NULL) STUB +//Mgr::Response::Response(const Ipc::TypedMsgHdr& msg) STUB +void Mgr::Response::pack(Ipc::TypedMsgHdr& msg) const STUB +static Ipc::Response::Pointer ipr_static; +Ipc::Response::Pointer Mgr::Response::clone() const STUB_RETVAL(Ipc::Response::Pointer(NULL)) +bool Mgr::Response::hasAction() const STUB_RETVAL(false) +//static Mgr::Action mgraction_static; +//const Mgr::Action& Mgr::Response::getAction() const STUB_RETVAL(mgraction_static) + +#include "mgr/ServiceTimesAction.h" +//Mgr::ServiceTimesActionData::ServiceTimesActionData() STUB +Mgr::ServiceTimesActionData& Mgr::ServiceTimesActionData::operator +=(const Mgr::ServiceTimesActionData& stats) STUB_RETVAL(*this) + +Mgr::Action::Pointer Mgr::ServiceTimesAction::Create(const Mgr::CommandPointer &cmd) STUB_RETVAL(Mgr::Action::Pointer(NULL)) +void Mgr::ServiceTimesAction::add(const Action& action) STUB +void Mgr::ServiceTimesAction::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::ServiceTimesAction::unpack(const Ipc::TypedMsgHdr& msg) STUB +//protected: +//Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &cmd) STUB +void Mgr::ServiceTimesAction::collect() STUB +void Mgr::ServiceTimesAction::dump(StoreEntry* entry) STUB + +#include "mgr/StoreIoAction.h" +//Mgr::StoreIoActionData::StoreIoActionData() STUB +Mgr::StoreIoActionData & Mgr::StoreIoActionData::operator +=(const StoreIoActionData& stats) STUB_RETVAL(*this) +//Mgr::StoreIoAction::StoreIoAction(const CommandPointer &cmd) STUB +Mgr::Action::Pointer Mgr::StoreIoAction::Create(const CommandPointer &cmd) STUB_RETVAL(Mgr::Action::Pointer(NULL)) +void Mgr::StoreIoAction::add(const Action& action) STUB +void Mgr::StoreIoAction::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::StoreIoAction::unpack(const Ipc::TypedMsgHdr& msg) STUB +void Mgr::StoreIoAction::collect() STUB +void Mgr::StoreIoAction::dump(StoreEntry* entry) STUB + +#include "mgr/StoreToCommWriter.h" +//Mgr::StoreToCommWriter::StoreToCommWriter(int aFd, StoreEntry *anEntry) STUB +Mgr::StoreToCommWriter::~StoreToCommWriter() STUB +void Mgr::StoreToCommWriter::start() STUB +void Mgr::StoreToCommWriter::swanSong() STUB +bool Mgr::StoreToCommWriter::doneAll() const STUB_RETVAL(false) +void Mgr::StoreToCommWriter::scheduleStoreCopy() STUB +void Mgr::StoreToCommWriter::noteStoreCopied(StoreIOBuffer ioBuf) STUB +void Mgr::StoreToCommWriter::NoteStoreCopied(void* data, StoreIOBuffer ioBuf) STUB +void Mgr::StoreToCommWriter::Abort(void* param) STUB +void Mgr::StoreToCommWriter::scheduleCommWrite(const StoreIOBuffer& ioBuf) STUB +void Mgr::StoreToCommWriter::noteCommWrote(const CommIoCbParams& params) STUB +void Mgr::StoreToCommWriter::noteCommClosed(const CommCloseCbParams& params) STUB +void Mgr::StoreToCommWriter::close() STUB + +#include "mgr/StringParam.h" +//Mgr::StringParam::StringParam() STUB +//Mgr::StringParam::StringParam(const String& aString) STUB +void Mgr::StringParam::pack(Ipc::TypedMsgHdr& msg) const STUB +void Mgr::StringParam::unpackValue(const Ipc::TypedMsgHdr& msg) STUB +static String t; +const String& Mgr::StringParam::value() const STUB_RETVAL(t) diff -u -r -N squid-3.2.0.18/src/tests/stub_libsslsquid.cc squid-3.2.0.19/src/tests/stub_libsslsquid.cc --- squid-3.2.0.18/src/tests/stub_libsslsquid.cc 1970-01-01 12:00:00.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_libsslsquid.cc 2012-08-03 00:14:34.000000000 +1200 @@ -0,0 +1,63 @@ +#include "squid.h" + +#if USE_SSL + +#include "fatal.h" + +/* Stub File for the ssl/libsslsquid.la convenience library */ + +#define STUB_API "ssl/libsslsquid.la" +#include "tests/STUB.h" + + +#include "ssl/Config.h" +Ssl::Config::Config() { printf("Ssl::Config::Config No implemented\n"); } +Ssl::Config::~Config() { printf("Ssl::Config::Config No implemented\n"); } +Ssl::Config Ssl::TheConfig; + +#include "ssl/context_storage.h" +//Ssl::CertificateStorageAction::CertificateStorageAction(const Mgr::Command::Pointer &cmd) STUB +Ssl::CertificateStorageAction::Pointer Ssl::CertificateStorageAction::Create(const Mgr::Command::Pointer &cmd) STUB_RETSTATREF(Ssl::CertificateStorageAction::Pointer) +void Ssl::CertificateStorageAction::dump(StoreEntry *sentry) STUB +Ssl::LocalContextStorage::Item::Item(SSL_CTX * aSsl_ctx, std::string const & aName) STUB +Ssl::LocalContextStorage::Item::~Item() STUB +Ssl::LocalContextStorage::LocalContextStorage(size_t aMax_memory) STUB +Ssl::LocalContextStorage::~LocalContextStorage() STUB +void Ssl::LocalContextStorage::SetSize(size_t aMax_memory) STUB +SSL_CTX * Ssl::LocalContextStorage::add(char const * host_name, SSL_CTX * ssl_ctx) STUB_RETVAL(NULL) +SSL_CTX * Ssl::LocalContextStorage::find(char const * host_name) STUB_RETVAL(NULL) +void Ssl::LocalContextStorage::remove(char const * host_name) STUB +//Ssl::GlobalContextStorage::GlobalContextStorage() STUB +//Ssl::GlobalContextStorage::~GlobalContextStorage() STUB +void Ssl::GlobalContextStorage::addLocalStorage(Ip::Address const & address, size_t size_of_store) STUB +Ssl::LocalContextStorage & Ssl::GlobalContextStorage::getLocalStorage(Ip::Address const & address) +{ fatal(STUB_API " required"); static Ssl::LocalContextStorage v(0); return v; } +void Ssl::GlobalContextStorage::reconfigureStart() STUB +//Ssl::GlobalContextStorage Ssl::TheGlobalContextStorage; + +#include "ssl/ErrorDetail.h" +Ssl::ssl_error_t parseErrorString(const char *name) STUB_RETVAL(0) +//const char *Ssl::getErrorName(ssl_error_t value) STUB_RETVAL(NULL) +Ssl::ErrorDetail::ErrorDetail(ssl_error_t err_no, X509 *cert) STUB +Ssl::ErrorDetail::ErrorDetail(ErrorDetail const &) STUB +const String & Ssl::ErrorDetail::toString() const STUB_RETSTATREF(String) + +#include "ssl/support.h" +SSL_CTX *sslCreateServerContext(const char *certfile, const char *keyfile, int version, const char *cipher, const char *options, const char *flags, const char *clientCA, const char *CAfile, const char *CApath, const char *CRLfile, const char *dhpath, const char *context) STUB_RETVAL(NULL) +SSL_CTX *sslCreateClientContext(const char *certfile, const char *keyfile, int version, const char *cipher, const char *options, const char *flags, const char *CAfile, const char *CApath, const char *CRLfile) STUB_RETVAL(NULL) +int ssl_read_method(int, char *, int) STUB_RETVAL(0) +int ssl_write_method(int, const char *, int) STUB_RETVAL(0) +void ssl_shutdown_method(SSL *) STUB +const char *sslGetUserEmail(SSL *ssl) STUB_RETVAL(NULL) +// typedef char const *SSLGETATTRIBUTE(SSL *, const char *); +// SSLGETATTRIBUTE sslGetUserAttribute; +// SSLGETATTRIBUTE sslGetCAAttribute; +const char *sslGetUserCertificatePEM(SSL *ssl) STUB_RETVAL(NULL) +const char *sslGetUserCertificateChainPEM(SSL *ssl) STUB_RETVAL(NULL) +SSL_CTX *Ssl::generateSslContext(char const *host, Ssl::X509_Pointer const & signedX509, Ssl::EVP_PKEY_Pointer const & signedPkey) STUB_RETVAL(NULL) +bool Ssl::verifySslCertificateDate(SSL_CTX * sslContext) STUB_RETVAL(false) +SSL_CTX * Ssl::generateSslContextUsingPkeyAndCertFromMemory(const char * data) STUB_RETVAL(NULL) +int Ssl::matchX509CommonNames(X509 *peer_cert, void *check_data, int (*check_func)(void *check_data, ASN1_STRING *cn_data)) STUB_RETVAL(0) +int Ssl::asn1timeToString(ASN1_TIME *tm, char *buf, int len) STUB_RETVAL(0) + +#endif diff -u -r -N squid-3.2.0.18/src/tests/Stub.list squid-3.2.0.19/src/tests/Stub.list --- squid-3.2.0.18/src/tests/Stub.list 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/Stub.list 2012-08-03 00:14:34.000000000 +1200 @@ -31,6 +31,8 @@ tests/stub_ipcache.cc \ tests/stub_libcomm.cc \ tests/stub_libicmp.cc \ + tests/stub_libmgr.cc \ + tests/stub_libsslsquid.cc \ tests/stub_main_cc.cc \ tests/stub_mem.cc \ tests/stub_mem_node.cc \ diff -u -r -N squid-3.2.0.18/src/tests/stub_MemStore.cc squid-3.2.0.19/src/tests/stub_MemStore.cc --- squid-3.2.0.18/src/tests/stub_MemStore.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/stub_MemStore.cc 2012-08-03 00:14:34.000000000 +1200 @@ -13,6 +13,7 @@ MemStore::MemStore() STUB MemStore::~MemStore() STUB +bool MemStore::keepInLocalMemory(const StoreEntry &) const STUB_RETVAL(false) void MemStore::considerKeeping(StoreEntry &) STUB void MemStore::reference(StoreEntry &) STUB void MemStore::maintain() STUB diff -u -r -N squid-3.2.0.18/src/tests/testEvent.cc squid-3.2.0.19/src/tests/testEvent.cc --- squid-3.2.0.18/src/tests/testEvent.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/testEvent.cc 2012-08-03 00:14:34.000000000 +1200 @@ -87,7 +87,7 @@ /* 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 ( unsigned int i = 0; i < anEntry->_appended_text.size(); i++) { + for ( unsigned int i = 0; i < anEntry->_appended_text.size(); ++i) { CPPUNIT_ASSERT( expect[i] ); CPPUNIT_ASSERT( anEntry->_appended_text[i] ); diff -u -r -N squid-3.2.0.18/src/tests/testStoreController.cc squid-3.2.0.19/src/tests/testStoreController.cc --- squid-3.2.0.18/src/tests/testStoreController.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/testStoreController.cc 2012-08-03 00:14:34.000000000 +1200 @@ -93,7 +93,7 @@ e->swap_filen = 0; /* garh - lower level*/ e->swap_dirn = -1; - for (int i=0; i < Config.cacheSwap.n_configured; i++) { + for (int i=0; i < Config.cacheSwap.n_configured; ++i) { if (INDEXSD (i) == aStore.getRaw()) e->swap_dirn = i; } diff -u -r -N squid-3.2.0.18/src/tests/testStoreHashIndex.cc squid-3.2.0.19/src/tests/testStoreHashIndex.cc --- squid-3.2.0.18/src/tests/testStoreHashIndex.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tests/testStoreHashIndex.cc 2012-08-03 00:14:34.000000000 +1200 @@ -74,7 +74,7 @@ e->swap_filen = 0; /* garh - lower level*/ e->swap_dirn = -1; - for (int i=0; i < Config.cacheSwap.n_configured; i++) { + for (int i=0; i < Config.cacheSwap.n_configured; ++i) { if (INDEXSD (i) == aStore.getRaw()) e->swap_dirn = i; } diff -u -r -N squid-3.2.0.18/src/tools.cc squid-3.2.0.19/src/tools.cc --- squid-3.2.0.18/src/tools.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tools.cc 2012-08-03 00:14:34.000000000 +1200 @@ -1313,12 +1313,12 @@ case '\n': mb->append("\\n", 2); - str++; + ++str; break; case '\r': mb->append("\\r", 2); - str++; + ++str; break; case '\0': @@ -1327,7 +1327,7 @@ default: mb->append("\\", 1); mb->append(str, 1); - str++; + ++str; break; } } @@ -1363,9 +1363,11 @@ int ncaps = 0; int rc = 0; cap_value_t cap_list[10]; - cap_list[ncaps++] = CAP_NET_BIND_SERVICE; + cap_list[ncaps] = CAP_NET_BIND_SERVICE; + ++ncaps; if (Ip::Interceptor.TransparentActive() || Ip::Qos::TheConfig.isHitNfmarkActive() || Ip::Qos::TheConfig.isAclNfmarkActive()) { - cap_list[ncaps++] = CAP_NET_ADMIN; + cap_list[ncaps] = CAP_NET_ADMIN; + ++ncaps; } cap_clear_flag(caps, CAP_EFFECTIVE); diff -u -r -N squid-3.2.0.18/src/tunnel.cc squid-3.2.0.19/src/tunnel.cc --- squid-3.2.0.18/src/tunnel.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/tunnel.cc 2012-08-03 00:14:34.000000000 +1200 @@ -638,8 +638,8 @@ } debugs(26, 3, HERE << "'" << RequestMethodStr(request->method) << " " << url << " " << request->http_ver << "'"); - statCounter.server.all.requests++; - statCounter.server.other.requests++; + ++statCounter.server.all.requests; + ++statCounter.server.other.requests; tunnelState = new TunnelStateData; #if USE_DELAY_POOLS @@ -680,6 +680,7 @@ mb.Printf("CONNECT %s HTTP/1.1\r\n", tunnelState->url); HttpStateData::httpBuildRequestHeader(tunnelState->request, NULL, /* StoreEntry */ + NULL, /* AccessLogEntry */ &hdr_out, flags); /* flags */ packerToMemInit(&p, &mb); diff -u -r -N squid-3.2.0.18/src/unlinkd.cc squid-3.2.0.19/src/unlinkd.cc --- squid-3.2.0.18/src/unlinkd.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/unlinkd.cc 2012-08-03 00:14:34.000000000 +1200 @@ -108,9 +108,9 @@ if (bytes_read > 0) { rbuf[bytes_read] = '\0'; - for (i = 0; i < bytes_read; i++) + for (i = 0; i < bytes_read; ++i) if ('\n' == rbuf[i]) - queuelen--; + --queuelen; assert(queuelen >= 0); } @@ -119,7 +119,8 @@ l = strlen(path); assert(l < MAXPATHLEN); xstrncpy(buf, path, MAXPATHLEN); - buf[l++] = '\n'; + buf[l] = '\n'; + ++l; bytes_written = write(unlinkd_wfd, buf, l); if (bytes_written < 0) { @@ -139,7 +140,7 @@ * in counting unlink operations. */ ++statCounter.syscalls.disk.unlinks; - queuelen++; + ++queuelen; } void diff -u -r -N squid-3.2.0.18/src/url.cc squid-3.2.0.19/src/url.cc --- squid-3.2.0.18/src/url.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/url.cc 2012-08-03 00:14:34.000000000 +1200 @@ -254,7 +254,7 @@ src = url; i = 0; /* Find first : - everything before is protocol */ - for (i = 0, dst = proto; i < l && *src != ':'; i++, src++, dst++) { + for (i = 0, dst = proto; i < l && *src != ':'; ++i, ++src, ++dst) { *dst = *src; } if (i >= l) @@ -271,7 +271,7 @@ // bug 1881: If we don't get a "/" then we imply it was there // bug 3074: We could just be given a "?" or "#". These also imply "/" // bug 3233: whitespace is also a hostname delimiter. - for (dst = host; i < l && *src != '/' && *src != '?' && *src != '#' && *src != '\0' && !xisspace(*src); i++, src++, dst++) { + for (dst = host; i < l && *src != '/' && *src != '?' && *src != '#' && *src != '\0' && !xisspace(*src); ++i, ++src, ++dst) { *dst = *src; } @@ -292,7 +292,7 @@ dst = urlpath; } /* Then everything from / (inclusive) until \r\n or \0 - thats urlpath */ - for (; i < l && *src != '\r' && *src != '\n' && *src != '\0'; i++, src++, dst++) { + for (; i < l && *src != '\r' && *src != '\n' && *src != '\0'; ++i, ++src, ++dst) { *dst = *src; } @@ -301,7 +301,8 @@ return NULL; /* If the URL path is empty we set it to be "/" */ if (dst == urlpath) { - *(dst++) = '/'; + *dst = '/'; + ++dst; } *dst = '\0'; @@ -322,18 +323,20 @@ dst = host; /* only for IPv6 sadly, pre-IPv6/URL code can't handle the clean result properly anyway. */ src = host; - src++; + ++src; l = strlen(host); i = 1; - for (; i < l && *src != ']' && *src != '\0'; i++, src++, dst++) { + for (; i < l && *src != ']' && *src != '\0'; ++i, ++src, ++dst) { *dst = *src; } /* we moved in-place, so truncate the actual hostname found */ - *(dst++) = '\0'; + *dst = '\0'; + ++dst; /* skip ahead to either start of port, or original EOS */ - while (*dst != '\0' && *dst != ':') dst++; + while (*dst != '\0' && *dst != ':') + ++dst; t = dst; } else { t = strrchr(host, ':'); @@ -354,21 +357,23 @@ if (t && *t == ':') { *t = '\0'; - t++; + ++t; port = atoi(t); } } - for (t = host; *t; t++) + for (t = host; *t; ++t) *t = xtolower(*t); if (stringHasWhitespace(host)) { if (URI_WHITESPACE_STRIP == Config.uri_whitespace) { t = q = host; while (*t) { - if (!xisspace(*t)) - *q++ = *t; - t++; + if (!xisspace(*t)) { + *q = *t; + ++q; + } + ++t; } *q = '\0'; } @@ -433,9 +438,11 @@ default: t = q = urlpath; while (*t) { - if (!xisspace(*t)) - *q++ = *t; - t++; + if (!xisspace(*t)) { + *q = *t; + ++q; + } + ++t; } *q = '\0'; } @@ -581,8 +588,10 @@ */ if (Config.onoff.strip_query_terms) - if ((t = strchr(buf, '?'))) - *(++t) = '\0'; + if ((t = strchr(buf, '?'))) { + ++t; + *t = '\0'; + } break; } @@ -634,7 +643,7 @@ return (false); } - for (p = url; *p != '\0' && *p != ':' && *p != '/'; p++); + for (p = url; *p != '\0' && *p != ':' && *p != '/'; ++p); if (*p == ':') { return (false); @@ -698,10 +707,11 @@ const char *last_slash = strrchr(path, '/'); if (last_slash == NULL) { - urlbuf[urllen++] = '/'; + urlbuf[urllen] = '/'; + ++urllen; strncpy(&urlbuf[urllen], relUrl, MAX_URL - urllen - 1); } else { - last_slash++; + ++last_slash; size_t pathlen = last_slash - path; if (pathlen > MAX_URL - urllen - 1) { pathlen = MAX_URL - urllen - 1; @@ -746,7 +756,7 @@ int hl; while ('.' == *h) - h++; + ++h; hl = strlen(h); @@ -969,7 +979,7 @@ char *t; if ((t = strrchr(Host, '@'))) { - t++; + ++t; memmove(Host, t, strlen(t) + 1); } } diff -u -r -N squid-3.2.0.18/src/urn.cc squid-3.2.0.19/src/urn.cc --- squid-3.2.0.18/src/urn.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/urn.cc 2012-08-03 00:14:34.000000000 +1200 @@ -128,8 +128,8 @@ debugs(52, 3, "urnFindMinRtt"); assert(urls != NULL); - for (i = 0; NULL != urls[i].url; i++) - urlcnt++; + for (i = 0; NULL != urls[i].url; ++i) + ++urlcnt; debugs(53, 3, "urnFindMinRtt: Counted " << i << " URLs"); @@ -138,7 +138,7 @@ return urls; } - for (i = 0; i < urlcnt; i++) { + for (i = 0; i < urlcnt; ++i) { u = &urls[i]; debugs(52, 3, "urnFindMinRtt: " << u->host << " rtt=" << u->rtt); @@ -384,12 +384,12 @@ delete rep; while (xisspace(*s)) - s++; + ++s; urls = urnParseReply(s, urnState->request->method); - for (i = 0; NULL != urls[i].url; i++) - urlcnt++; + for (i = 0; NULL != urls[i].url; ++i) + ++urlcnt; debugs(53, 3, "urnFindMinRtt: Counted " << i << " URLs"); @@ -412,7 +412,7 @@ "

    Select URL for %s

    \n" "\n", e->url(), e->url()); - for (i = 0; i < urlcnt; i++) { + for (i = 0; i < urlcnt; ++i) { u = &urls[i]; debugs(52, 3, "URL {" << u->url << "}"); mb->Printf( @@ -449,7 +449,7 @@ e->replaceHttpReply(rep); e->complete(); - for (i = 0; i < urlcnt; i++) { + for (i = 0; i < urlcnt; ++i) { safe_free(urls[i].url); safe_free(urls[i].host); } @@ -508,7 +508,7 @@ // TODO: Use storeHas() or lock/unlock entry to avoid creating unlocked // ones. list[i].flags.cached = storeGetPublic(url, m) ? 1 : 0; - i++; + ++i; } debugs(52, 3, "urnParseReply: Found " << i << " URLs"); diff -u -r -N squid-3.2.0.18/src/wccp2.cc squid-3.2.0.19/src/wccp2.cc --- squid-3.2.0.18/src/wccp2.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/wccp2.cc 2012-08-03 00:14:34.000000000 +1200 @@ -331,6 +331,8 @@ #define WCCP2_CAPABILITY_FORWARDING_METHOD 0x01 #define WCCP2_CAPABILITY_ASSIGNMENT_METHOD 0x02 #define WCCP2_CAPABILITY_RETURN_METHOD 0x03 +// 0x04 ?? - advertised by a 4507 (ios v15.1) Cisco switch +// 0x05 ?? - advertised by a 4507 (ios v15.1) Cisco switch /* capability values */ #define WCCP2_METHOD_GRE 0x00000001 @@ -701,7 +703,7 @@ for (s = Config.Wccp2.router; s; s = s->next) { if (!s->s.IsAnyAddr()) { /* Increment the counter */ - wccp2_numrouters++; + ++wccp2_numrouters; } } @@ -1384,6 +1386,10 @@ break; + case 4: + case 5: + break; // ignore silently for now + default: debugs(80, 1, "Unknown capability type in WCCPv2 Packet (" << ntohs(router_capability_element->capability_type) << ")."); } @@ -1429,7 +1435,7 @@ if (ntohl(tmp) != 0) { /* search through the list of received-from ip addresses */ - for (num_caches = 0; num_caches < (int) ntohl(tmp); num_caches++) { + for (num_caches = 0; num_caches < (int) ntohl(tmp); ++num_caches) { /* Get a copy of the ip */ memset(&cache_address, 0, sizeof(cache_address)); // Make GCC happy @@ -1798,7 +1804,7 @@ if (num_caches) { int cache; - for (cache = 0, cache_list_ptr = &router_list_ptr->cache_list_head; cache_list_ptr->next; cache_list_ptr = cache_list_ptr->next, cache++) { + for (cache = 0, cache_list_ptr = &router_list_ptr->cache_list_head; cache_list_ptr->next; cache_list_ptr = cache_list_ptr->next, ++cache) { /* add caches */ cache_address = (struct in_addr *) &wccp_packet[offset]; @@ -1818,7 +1824,7 @@ if (num_caches != 0) { if (total_weight == 0) { - for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; bucket_counter++) { + for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; ++bucket_counter) { buckets[bucket_counter] = (char) (bucket_counter % num_caches); } } else { @@ -1827,18 +1833,18 @@ int cache = -1; unsigned long per_bucket = total_weight / WCCP_BUCKETS; - for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; bucket_counter++) { + for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; ++bucket_counter) { int n; unsigned long step; - for (n = num_caches; n; n--) { - cache++; + for (n = num_caches; n; --n) { + ++cache; if (cache >= num_caches) cache = 0; if (!weight[cache]) { - n++; + ++n; continue; } @@ -1899,13 +1905,13 @@ cache_list_ptr = &router_list_ptr->cache_list_head; value = 0; - for (valuecounter = 0; valuecounter < 64; valuecounter++) { + for (valuecounter = 0; valuecounter < 64; ++valuecounter) { value_element = (struct wccp2_value_element_t *) &wccp_packet[offset]; /* Update the value according the the "correct" formula */ - for (; (value & 0x1741) != value; value++) { + for (; (value & 0x1741) != value; ++value) { assert(value <= 0x1741); } @@ -1936,7 +1942,7 @@ value_element->cache_ip = cache_list_ptr->cache_ip; offset += sizeof(struct wccp2_value_element_t); - value++; + ++value; /* Assign the next value to the next cache */ @@ -2272,7 +2278,7 @@ } portlist[i] = p; - i++; + ++i; port = strsep(&tmp2, ","); } diff -u -r -N squid-3.2.0.18/src/wccp.cc squid-3.2.0.19/src/wccp.cc --- squid-3.2.0.18/src/wccp.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/wccp.cc 2012-08-03 00:14:34.000000000 +1200 @@ -283,7 +283,7 @@ * We sanity checked wccp_i_see_you.number back in wccpHandleUdp() */ - for (loop = 0; loop < (unsigned) ntohl(wccp_i_see_you.number); loop++) { + for (loop = 0; loop < (unsigned) ntohl(wccp_i_see_you.number); ++loop) { assert(loop < WCCP_ACTIVE_CACHES); if (local_ip > wccp_i_see_you.wccp_cache_entry[loop].ip_addr) @@ -351,20 +351,22 @@ buckets_per_cache = WCCP_BUCKETS / number_caches; - for (loop = 0; loop < number_caches; loop++) { + for (loop = 0; loop < number_caches; ++loop) { int i; memcpy(&caches[loop], &wccp_i_see_you.wccp_cache_entry[loop].ip_addr, sizeof(*caches)); - for (i = 0; i < buckets_per_cache; i++) { + for (i = 0; i < buckets_per_cache; ++i) { assert(bucket < WCCP_BUCKETS); - buckets[bucket++] = loop; + buckets[bucket] = loop; + ++bucket; } } while (bucket < WCCP_BUCKETS) { - buckets[bucket++] = number_caches - 1; + buckets[bucket] = number_caches - 1; + ++bucket; } wccp_assign_bucket->type = htonl(WCCP_ASSIGN_BUCKET); diff -u -r -N squid-3.2.0.18/src/win32.cc squid-3.2.0.19/src/win32.cc --- squid-3.2.0.18/src/win32.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/win32.cc 2012-08-03 00:14:34.000000000 +1200 @@ -70,7 +70,7 @@ handles[0] = handles[1] = -1; - statCounter.syscalls.sock.sockets++; + ++statCounter.syscalls.sock.sockets; handle0 = localhost; handle0.SetPort(0); diff -u -r -N squid-3.2.0.18/src/WinSvc.cc squid-3.2.0.19/src/WinSvc.cc --- squid-3.2.0.18/src/WinSvc.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/src/WinSvc.cc 2012-08-03 00:14:34.000000000 +1200 @@ -160,7 +160,7 @@ } hKey = hKeyNext; - index++; + ++index; } if (keys[index] == NULL) { @@ -268,7 +268,7 @@ /* Ignore spaces */ if (xisspace(*cmd)) { - cmd++; + ++cmd; continue; } @@ -276,7 +276,7 @@ word = cmd; while (*cmd) { - cmd++; /* Skip over this character */ + ++cmd; /* Skip over this character */ if (xisspace(*cmd)) /* End of argument if space */ break; @@ -602,7 +602,7 @@ WIN32_svcstatusupdate(DWORD svcstate, DWORD WaitHint) { if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) { - svcStatus.dwCheckPoint++; + ++svcStatus.dwCheckPoint; svcStatus.dwWaitHint = WaitHint; svcStatus.dwCurrentState = svcstate; SetServiceStatus(svcHandle, &svcStatus); @@ -987,7 +987,7 @@ int optlen = sizeof(opt); if (s_iInitCount > 0) { - s_iInitCount++; + ++s_iInitCount; return (0); } else if (s_iInitCount < 0) return (s_iInitCount); @@ -1026,7 +1026,7 @@ } WIN32_Socks_initialized = 1; - s_iInitCount++; + ++s_iInitCount; return (s_iInitCount); } diff -u -r -N squid-3.2.0.18/test-suite/splay.cc squid-3.2.0.19/test-suite/splay.cc --- squid-3.2.0.18/test-suite/splay.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/test-suite/splay.cc 2012-08-03 00:14:34.000000000 +1200 @@ -142,7 +142,7 @@ splayNode *top = NULL; squid_srandom(time(NULL)); - for (i = 0; i < 100; i++) { + for (i = 0; i < 100; ++i) { I = (intnode *)xcalloc(sizeof(intnode), 1); I->i = squid_random(); top = top->insert(I, compareintvoid); @@ -164,7 +164,7 @@ /* intnode* */ SplayNode *safeTop = NULL; - for ( int i = 0; i < 100; i++) { + for ( int i = 0; i < 100; ++i) { intnode *I; I = new intnode; I->i = squid_random(); @@ -183,7 +183,7 @@ /* intnode */ SplayNode *safeTop = NULL; - for (int i = 0; i < 100; i++) { + for (int i = 0; i < 100; ++i) { intnode I; I.i = squid_random(); safeTop = safeTop->insert(I, compareintref); @@ -219,7 +219,7 @@ if (safeTop->finish() != NULL) exit (1); - for (int i = 0; i < 100; i++) { + for (int i = 0; i < 100; ++i) { intnode I; I.i = squid_random(); diff -u -r -N squid-3.2.0.18/test-suite/stub_debug.cc squid-3.2.0.19/test-suite/stub_debug.cc --- squid-3.2.0.18/test-suite/stub_debug.cc 2012-06-29 13:57:20.000000000 +1200 +++ squid-3.2.0.19/test-suite/stub_debug.cc 2012-08-03 00:35:11.000000000 +1200 @@ -73,9 +73,6 @@ static void _db_print_stderr(const char *format, va_list args) { - /* FIXME? */ - // if (opt_debug_stderr < Debug::level) - if (1 < Debug::level) return; diff -u -r -N squid-3.2.0.18/tools/cachemgr.cc squid-3.2.0.19/tools/cachemgr.cc --- squid-3.2.0.18/tools/cachemgr.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/tools/cachemgr.cc 2012-08-03 00:14:34.000000000 +1200 @@ -175,7 +175,7 @@ int err; if (s_iInitCount > 0) { - s_iInitCount++; + ++s_iInitCount; return (0); } else if (s_iInitCount < 0) return (s_iInitCount); @@ -197,7 +197,7 @@ return (s_iInitCount); } - s_iInitCount++; + ++s_iInitCount; return (s_iInitCount); } @@ -245,7 +245,7 @@ tok[--len] = '\0'; while (xisspace(*tok)) - tok++; + ++tok; return tok; } else @@ -352,7 +352,7 @@ if (comment) while (*comment == ' ' || *comment == '\t') - comment++; + ++comment; if (!comment || !*comment) comment = server; @@ -361,7 +361,7 @@ printf("\n"); next_is_header = is_header && strstr(buf, "\t\t"); - table_line_num++; + ++table_line_num; return html; } @@ -934,15 +934,15 @@ value = args[1] + 2; } else if (argc > 2) { value = args[2]; - args++; - argc--; + ++args; + --argc; } else value = ""; #endif break; } - args++; - argc--; + ++args; + --argc; } req = read_request(); @@ -1027,7 +1027,8 @@ if ((q = strchr(t, '=')) == NULL) continue; - *q++ = '\0'; + *q = '\0'; + ++q; rfc1738_unescape(t); diff -u -r -N squid-3.2.0.18/tools/purge/conffile.cc squid-3.2.0.19/tools/purge/conffile.cc --- squid-3.2.0.18/tools/purge/conffile.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/tools/purge/conffile.cc 2012-08-03 00:14:34.000000000 +1200 @@ -136,7 +136,7 @@ cd.type = CacheDir::CDT_DISKD; else cd.type = CacheDir::CDT_OTHER; - offset++; + ++offset; } // extract base directory @@ -146,7 +146,7 @@ (int)subs[offset].rm_eo, line+subs[offset].rm_so ); cd.base = strdup( line+subs[offset].rm_so ); - offset++; + ++offset; // extract size information line[ subs[offset].rm_eo ] = '\0'; @@ -155,7 +155,7 @@ (int)subs[offset].rm_eo, line+subs[offset].rm_so ); cd.size = strtoul( line+subs[offset].rm_so, 0, 10 ); - offset++; + ++offset; // extract 1st level directories line[ subs[offset].rm_eo ] = '\0'; @@ -164,7 +164,7 @@ (int)subs[offset].rm_eo, line+subs[offset].rm_so ); cd.level[0] = strtoul( line+subs[offset].rm_so, 0, 10 ); - offset++; + ++offset; // extract 2nd level directories line[ subs[offset].rm_eo ] = '\0'; @@ -173,7 +173,7 @@ (int)subs[offset].rm_eo, line+subs[offset].rm_so ); cd.level[1] = strtoul( line+subs[offset].rm_so, 0, 10 ); - offset++; + ++offset; cachedir.push_back( cd ); } diff -u -r -N squid-3.2.0.18/tools/purge/copyout.cc squid-3.2.0.19/tools/purge/copyout.cc --- squid-3.2.0.18/tools/purge/copyout.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/tools/purge/copyout.cc 2012-08-03 00:14:34.000000000 +1200 @@ -157,7 +157,8 @@ } else if ( debug & 0x02 ) { fprintf( stderr, "# creating %s\n", filename ); } - *t++ = '/'; + *t = '/'; + ++t; } // create file @@ -198,7 +199,8 @@ // 1 || 0 | 4 | 0 | // 2 || 1 | 4 | 0 | // 3 || 4 | 2 | 0 | - state = table[ state ][ xlate(*s++) ]; + state = table[ state ][ xlate(*s) ]; + ++s; } if ( state < 4 ) diff -u -r -N squid-3.2.0.18/tools/purge/purge.cc squid-3.2.0.19/tools/purge/purge.cc --- squid-3.2.0.18/tools/purge/purge.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/tools/purge/purge.cc 2012-08-03 00:14:34.000000000 +1200 @@ -246,7 +246,8 @@ if ( strlen(s) != testlen ) return false; size_t i=0; - while ( i= LINESIZE ) { fprintf( stderr, "%s:%lu: line too long, sorry.\n", @@ -671,8 +674,10 @@ } // remove trailing line breaks - while ( len > 0 && ( line[len] == '\n' || line[len] == '\r' ) ) - line[len--] = '\0'; + while ( len > 0 && ( line[len] == '\n' || line[len] == '\r' ) ) { + line[len] = '\0'; + --len; + } // insert into list of expressions if ( head == 0 ) tail = head = new REList(line,option=='F'); @@ -712,7 +717,8 @@ } } else { // colon used, port is extra - *colon++ = 0; + *colon = 0; + ++colon; if ( convertHostname(optarg,serverHost) == -1 ) { fprintf( stderr, "unable to resolve host %s!\n", optarg ); exit(1); @@ -779,7 +785,8 @@ unsigned count(0); for ( tail = head; tail != NULL; tail = tail->next ) { - if ( count++ ) printf( "#%22u", count ); + if ( count++ ) + printf( "#%22u", count ); #if defined(LINUX) && putc==_IO_putc // I HATE BROKEN LINUX HEADERS! // purge.o(.text+0x1040): undefined reference to `_IO_putc' diff -u -r -N squid-3.2.0.18/tools/squidclient.cc squid-3.2.0.19/tools/squidclient.cc --- squid-3.2.0.18/tools/squidclient.cc 2012-06-29 13:38:29.000000000 +1200 +++ squid-3.2.0.19/tools/squidclient.cc 2012-08-03 00:14:34.000000000 +1200 @@ -210,7 +210,7 @@ int ping, pcount; int keep_alive = 0; int opt_noaccept = 0; - int opt_verbose = 0; + bool opt_verbose = false; #if HAVE_GSSAPI int www_neg = 0, proxy_neg = 0; #endif @@ -375,7 +375,7 @@ #endif case 'v': /* undocumented: may increase verb-level by giving more -v's */ - opt_verbose++; + opt_verbose=true; break; case '?': /* usage */ @@ -564,7 +564,7 @@ } loops = ping ? pcount : 1; - for (i = 0; loops == 0 || i < loops; i++) { + for (i = 0; loops == 0 || i < loops; ++i) { int fsize = 0; struct addrinfo *AI = NULL; diff -u -r -N squid-3.2.0.18/tools/stub_debug.cc squid-3.2.0.19/tools/stub_debug.cc --- squid-3.2.0.18/tools/stub_debug.cc 2012-06-29 13:57:20.000000000 +1200 +++ squid-3.2.0.19/tools/stub_debug.cc 2012-08-03 00:35:11.000000000 +1200 @@ -73,9 +73,6 @@ static void _db_print_stderr(const char *format, va_list args) { - /* FIXME? */ - // if (opt_debug_stderr < Debug::level) - if (1 < Debug::level) return;
    Cache Server: