This adds a directive configure_miss_revalidate based closely on squid-2.7 ignore_ims_on_miss by Henrik.
The following changes are made: * rename to cache_miss_revalidate Inverted the behaviour viewpoint from suppression to one of ability extension. * fix RFC 2616 violation in 2.7 REFRESH In 2.7 any If-None-Match values added by Squid on a refresh HIT caused client header values to be dropped. The two sets of values need to be combined and delivered to the server to preserve '*' special case and allow a 304 from server with ETag to be reliably authoritative in regards to the client delivered ETag values. Otherwise the server might return ambiguous succcess regarding Squid ETag when it should have sent 412 regarding a client ETag. * handle case where client is sending 'If-None-Match: *' * remove HTTP_VIOLATIONS requirement This behaviour is permitted within the RFC 2616 update clarifications from IETF HTTPbis WG. * improved documentation of behaviour and use cases For now the default setting is to retain the current behaviour of Squid-3 and Squid-2.7. Which is to pass If-* headers through and continue MISS until e full fetch is requested by a client. Amos
=== modified file 'configure.ac' --- configure.ac 2013-09-27 15:21:54 +0000 +++ configure.ac 2013-09-27 17:07:20 +0000 @@ -42,14 +42,14 @@ # might be cross-compiling. if test "x$HOSTCXX" = "x"; then HOSTCXX="$CXX" - if test "x$squid_cv_check_marchnative" = "xyes"; then - CXXFLAGS="$CXXFLAGS -march=native" - fi -fi -if test "x$squid_cv_check_marchnative" = "xyes"; then - # always valid for the Host compiler. - HOSTCXX="$HOSTCXX -march=native" -fi +# if test "x$squid_cv_check_marchnative" = "xyes"; then +# CXXFLAGS="$CXXFLAGS -march=native" +# fi +fi +#if test "x$squid_cv_check_marchnative" = "xyes"; then +# # always valid for the Host compiler. +# HOSTCXX="$HOSTCXX -march=native" +#fi AC_SUBST(HOSTCXX) AC_MSG_CHECKING([simplified host os]) === modified file 'doc/release-notes/release-3.3.sgml' --- doc/release-notes/release-3.3.sgml 2013-09-11 01:31:14 +0000 +++ doc/release-notes/release-3.3.sgml 2013-09-29 12:06:06 +0000 @@ -180,6 +180,12 @@ <sect1>New tags<label id="newtags"> <p> <descrip> + <tag>cache_miss_revalidate</tag> + <p>Whether Squid is to pass-through If-Modified-Since and If-None-Match headers on cache MISS. + Revalidation requests can prevent cache gathering objects to HIT on. + <p>Based on the Squid-2.7 <em>ignore_ims_on_miss</em> feature. + <p><em>IMPORTANT:</em> the meaning for on/off values has changed along with the name since 2.7. + <tag>request_header_add</tag> <p>New directive to add custom headers on HTTP traffic sent to upstream servers. @@ -231,7 +237,8 @@ <p> <descrip> - <p><em>There are no removed squid.conf options in Squid-3.3.</em> + <tag>ignore_ims_on_miss</tag> + <p>This option has been replaced by the <em>cache_miss_revalidate</em> feature. </descrip> @@ -318,9 +325,6 @@ <tag>external_refresh_check</tag> <p>Not yet ported from 2.7 - <tag>ignore_ims_on_miss</tag> - <p>Not yet ported from 2.7 - <tag>location_rewrite_access</tag> <p>Not yet ported from 2.6 === modified file 'src/SquidConfig.h' --- src/SquidConfig.h 2013-08-01 20:45:56 +0000 +++ src/SquidConfig.h 2013-09-29 08:52:12 +0000 @@ -337,6 +337,7 @@ int check_hostnames; int allow_underscore; int via; + int cache_miss_revalidate; int emailErrData; int httpd_suppress_version_string; int global_internal_static; === modified file 'src/cache_cf.cc' --- src/cache_cf.cc 2013-08-29 09:21:53 +0000 +++ src/cache_cf.cc 2013-09-29 09:14:28 +0000 @@ -1013,6 +1013,14 @@ if (!strcmp(name, "log_icap")) self_destruct(); + + if (!strcmp(name, "ignore_ims_on_miss")) { + // the replacement directive cache_revalidate_on_miss has opposite meanings for ON/OFF value + // than the 2.7 directive. We need to parse and invert the configured value. + int temp = 0; + parse_onoff(&temp); + Config.onoff.cache_miss_revalidate = !temp; + } } /* Parse a time specification from the config file. Store the === modified file 'src/cf.data.pre' --- src/cf.data.pre 2013-08-29 09:21:53 +0000 +++ src/cf.data.pre 2013-09-29 09:15:12 +0000 @@ -148,12 +148,6 @@ This option is not yet supported by Squid-3. DOC_END -NAME: ignore_ims_on_miss -TYPE: obsolete -DOC_START - This option is not yet supported by Squid-3. -DOC_END - NAME: location_rewrite_program location_rewrite_access location_rewrite_children location_rewrite_concurrency TYPE: obsolete DOC_START @@ -166,7 +160,12 @@ This option is not yet supported by Squid-3. DOC_END -# no Options Removed in 3.3 +# Options Removed in 3.3 +NAME: ignore_ims_on_miss +TYPE: obsolete +DOC_START + Remove this line. The HTTP/1.1 feature is now fully supported by default. +DOC_END # Options Removed in 3.2 NAME: ignore_expect_100 @@ -7310,6 +7309,25 @@ acts on cacheable requests. DOC_END +NAME: cache_miss_revalidate +COMMENT: on|off +TYPE: onoff +DEFAULT: on +LOC: Config.onoff.cache_miss_revalidate +DOC_START + Whether Squid on cache MISS will pass client revalidation requests + to the server or tries to fetch new content for caching. + This is useful while the cache is mostly empty to more quickly + have the cache populated. + + When set to 'on' (default), Squid will pass all client If-* headers + to the server. + + When set to 'off' and if the request is cacheable, Squid will + remove the clients If-Modified-Since and If-None-Match headers from + the request sent to the server. +DOC_END + NAME: always_direct TYPE: acl_access LOC: Config.accessList.AlwaysDirect === modified file 'src/http.cc' --- src/http.cc 2013-07-16 00:13:03 +0000 +++ src/http.cc 2013-09-29 11:22:17 +0000 @@ -1966,12 +1966,30 @@ case HDR_IF_MODIFIED_SINCE: /** \par If-Modified-Since: - * append unless we added our own; - * \note at most one client's ims header can pass through */ + * append unless we added our own, + * but only if cache_miss_revalidate is enabled, or + * the request is not cacheable, or + * the request contains authentication credentials. + * \note at most one client's If-Modified-Since header can pass through + */ + // XXX: need to check and cleanup the auth case so cacheable auth requests get cached. + if (hdr_out->has(HDR_IF_MODIFIED_SINCE)) + break; + else if (Config.onoff.cache_miss_revalidate || !request->flags.cachable || request->flags.auth) + hdr_out->addEntry(e->clone()); + break; - if (!hdr_out->has(HDR_IF_MODIFIED_SINCE)) + case HDR_IF_NONE_MATCH: + /** \par If-None-Match: + * append if the wildcard '*' special case value is present, or + * cache_miss_revalidate is disabled, or + * the request is not cacheable in this proxy, or + * the request contains authentication credentials. + * \note this header lists a set of responses for the server to elide sending. Squid added values are extending that set. + */ + // XXX: need to check and cleanup the auth case so cacheable auth requests get cached. + if (hdr_out->hasListMember(HDR_IF_MATCH, "*", ',') || Config.onoff.cache_miss_revalidate || !request->flags.cachable || request->flags.auth) hdr_out->addEntry(e->clone()); - break; case HDR_MAX_FORWARDS: