Henrik Nordstrom wrote:
the list of HTCP mode options had grown a bit too large. Collapse them
all into a single htcp= option taking a list of mode flags.
Updated version of Henriks patch. (why did it not get committed last
year when approved?)
* parser bug fixed to handle a list of exactly one parameter without
trailing comma (which the original would call bungled).
* special parse case for htcp-oldsquid fully combined with new parser.
* alters the cachemgr config dump to show the new syntax.
Other than parse no operational changes. Fully backward-compatible and
tested.
Amos
--
Please be using
Current Stable Squid 2.7.STABLE9 or 3.1.6
Beta testers wanted for 3.2.0.1
=== modified file 'doc/release-notes/release-3.2.sgml'
--- doc/release-notes/release-3.2.sgml 2010-08-02 13:55:59 +0000
+++ doc/release-notes/release-3.2.sgml 2010-08-22 11:38:01 +0000
@@ -373,6 +373,10 @@
<em>concurrency=N</em> previously called <em>auth_param ... concurrency</em> as a separate option.
<p>Removed Basic, Digest, NTLM, Negotiate <em>auth_param ... concurrency</em> setting option.
+ <tag>cache_peer</tag>
+ <p><em>htcp-*</em> options collapsed into <em>htcp=</em> taking an optional comma-separated list of flags.
+ The old form is deprecated but still accepted.
+
<tag>deny_info</tag>
<p>Support URL format tags. For dynamically generated URL in denial redirect.
=== modified file 'src/cache_cf.cc'
--- src/cache_cf.cc 2010-08-15 00:12:43 +0000
+++ src/cache_cf.cc 2010-08-22 13:06:51 +0000
@@ -1908,30 +1908,38 @@
} else if (!strcasecmp(token, "weighted-round-robin")) {
p->options.weighted_roundrobin = 1;
#if USE_HTCP
-
} else if (!strcasecmp(token, "htcp")) {
p->options.htcp = 1;
- } else if (!strcasecmp(token, "htcp-oldsquid")) {
- p->options.htcp = 1;
- p->options.htcp_oldsquid = 1;
- } else if (!strcasecmp(token, "htcp-no-clr")) {
- if (p->options.htcp_only_clr)
- fatalf("parse_peer: can't set htcp-no-clr and htcp-only-clr simultaneously");
- p->options.htcp = 1;
- p->options.htcp_no_clr = 1;
- } else if (!strcasecmp(token, "htcp-no-purge-clr")) {
- p->options.htcp = 1;
- p->options.htcp_no_purge_clr = 1;
- } else if (!strcasecmp(token, "htcp-only-clr")) {
- if (p->options.htcp_no_clr)
- fatalf("parse_peer: can't set htcp-no-clr and htcp-only-clr simultaneously");
- p->options.htcp = 1;
- p->options.htcp_only_clr = 1;
- } else if (!strcasecmp(token, "htcp-forward-clr")) {
- p->options.htcp = 1;
- p->options.htcp_forward_clr = 1;
+ } else if (!strncasecmp(token, "htcp=", 5) || !strncasecmp(token, "htcp-", 5)) {
+ /* Note: The htcp- form is deprecated, replaced by htcp= */
+ p->options.htcp = 1;
+ char *tmp = xstrdup(token+5);
+ char *mode, *nextmode;
+ for (mode = nextmode = tmp; mode; mode = nextmode) {
+ nextmode = strchr(mode, ',');
+ debugs(0,0,"HTCP mode '" << mode << "' next=" << nextmode);
+ if (nextmode)
+ *nextmode++ = '\0';
+ 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");
+ p->options.htcp_no_clr = 1;
+ } else if (!strcasecmp(mode, "no-purge-clr")) {
+ p->options.htcp_no_purge_clr = 1;
+ } else if (!strcasecmp(mode, "only-clr")) {
+ if (p->options.htcp_no_clr)
+ fatalf("parse_peer: can't set htcp no-clr and only-clr simultaneously");
+ p->options.htcp_only_clr = 1;
+ } else if (!strcasecmp(mode, "forward-clr")) {
+ p->options.htcp_forward_clr = 1;
+ } else if (!strcasecmp(mode, "oldsquid")) {
+ p->options.htcp_oldsquid = 1;
+ } else {
+ fatalf("invalid HTCP mode '%s'", mode);
+ }
+ }
+ safe_free(tmp);
#endif
-
} else if (!strcasecmp(token, "no-netdb-exchange")) {
p->options.no_netdb_exchange = 1;
=== modified file 'src/cf.data.pre'
--- src/cf.data.pre 2010-08-14 16:38:27 +0000
+++ src/cf.data.pre 2010-08-22 11:28:25 +0000
@@ -1053,7 +1053,7 @@
NOTE: The default if no htcp_access lines are present is to
deny all traffic. This default may cause problems with peers
- using the htcp or htcp-oldsquid options.
+ using the htcp option.
This clause only supports fast acl types.
See http://wiki.squid-cache.org/SquidFaq/SquidAcl for details.
@@ -1904,22 +1904,23 @@
htcp Send HTCP, instead of ICP, queries to the neighbor.
You probably also want to set the "icp-port" to 4827
- instead of 3130.
-
- htcp-oldsquid Send HTCP to old Squid versions.
-
- htcp-no-clr Send HTCP to the neighbor but without
+ instead of 3130. This directive accepts a comma separated
+ list of options described below.
+
+ htcp=oldsquid Send HTCP to old Squid versions (2.5 or earlier).
+
+ htcp=no-clr Send HTCP to the neighbor but without
sending any CLR requests. This cannot be used with
- htcp-only-clr.
-
- htcp-only-clr Send HTCP to the neighbor but ONLY CLR requests.
- This cannot be used with htcp-no-clr.
-
- htcp-no-purge-clr
+ only-clr.
+
+ htcp=only-clr Send HTCP to the neighbor but ONLY CLR requests.
+ This cannot be used with no-clr.
+
+ htcp=no-purge-clr
Send HTCP to the neighbor including CLRs but only when
they do not result from PURGE requests.
- htcp-forward-clr
+ htcp=forward-clr
Forward any HTCP CLR requests this proxy receives to the peer.
=== modified file 'src/neighbors.cc'
--- src/neighbors.cc 2010-08-13 05:53:22 +0000
+++ src/neighbors.cc 2010-08-22 11:49:14 +0000
@@ -1602,16 +1602,20 @@
storeAppendPrintf(sentry, " closest-only");
#if USE_HTCP
- if (p->options.htcp)
+ if (p->options.htcp) {
storeAppendPrintf(sentry, " htcp");
- if (p->options.htcp_oldsquid)
- storeAppendPrintf(sentry, " htcp-oldsquid");
- if (p->options.htcp_no_clr)
- storeAppendPrintf(sentry, " htcp-no-clr");
- if (p->options.htcp_no_purge_clr)
- storeAppendPrintf(sentry, " htcp-no-purge-clr");
- if (p->options.htcp_only_clr)
- storeAppendPrintf(sentry, " htcp-only-clr");
+ if (p->options.htcp_oldsquid || p->options.htcp_no_clr || p->options.htcp_no_purge_clr || p->options.htcp_only_clr) {
+ int doneopts=0;
+ if (p->options.htcp_oldsquid)
+ storeAppendPrintf(sentry, "%soldsquid",(doneopts++>0?",":"="));
+ if (p->options.htcp_no_clr)
+ storeAppendPrintf(sentry, "%sno-clr",(doneopts++>0?",":"="));
+ if (p->options.htcp_no_purge_clr)
+ storeAppendPrintf(sentry, "%sno-purge-clr",(doneopts++>0?",":"="));
+ if (p->options.htcp_only_clr)
+ storeAppendPrintf(sentry, "%sonly-clr",(doneopts++>0?",":"="));
+ }
+ }
#endif
if (p->options.no_netdb_exchange)