]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Henrik Nordstrom <henrik@nordstrom.net>
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 24 Aug 2010 11:31:44 +0000 (23:31 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 24 Aug 2010 11:31:44 +0000 (23:31 +1200)
Author: Amos Jeffries <squid3@treenet.co.nz>
Collapse HTCP cache_peer options into one setting.

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.

doc/release-notes/release-3.2.sgml
src/cache_cf.cc
src/cf.data.pre
src/neighbors.cc

index 4cc6b3382bdeb4bef3cb274b7c73dd04c154bcd8..e84ecd006652cd9e44ff38747c85e66b189eb9ae 100644 (file)
@@ -373,6 +373,10 @@ This section gives a thorough account of those changes in three categories:
           <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.
 
index 76267b06e6e522dbb53c13c56152ad015d2c8d0b..1788f8468dbb97eeabab2ab7a65881fb0e7b8cac 100644 (file)
@@ -1908,30 +1908,38 @@ parse_peer(peer ** head)
         } 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");
+        } else if (!strncasecmp(token, "htcp=", 5) || !strncasecmp(token, "htcp-", 5)) {
+            /* Note: The htcp- form is deprecated, replaced by htcp= */
             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;
+            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;
 
index 0d63f7903c86cd36eecc48e019f41e2fd0c61030..c3710756bb0248f57d47c288dd5e4e4c19d7c561 100644 (file)
@@ -1053,7 +1053,7 @@ DOC_START
 
        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 @@ DOC_START
        
        htcp            Send HTCP, instead of ICP, queries to the neighbor.
                        You probably also want to set the "icp-port" to 4827
-                       instead of 3130.
+                       instead of 3130. This directive accepts a comma separated
+                       list of options described below.
        
-       htcp-oldsquid   Send HTCP to old Squid versions.
+       htcp=oldsquid   Send HTCP to old Squid versions (2.5 or earlier).
        
-       htcp-no-clr     Send HTCP to the neighbor but without
+       htcp=no-clr     Send HTCP to the neighbor but without
                        sending any CLR requests.  This cannot be used with
-                       htcp-only-clr.
+                       only-clr.
        
-       htcp-only-clr   Send HTCP to the neighbor but ONLY CLR requests.
-                       This cannot be used with htcp-no-clr.
+       htcp=only-clr   Send HTCP to the neighbor but ONLY CLR requests.
+                       This cannot be used with no-clr.
        
-       htcp-no-purge-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.
        
        
index 409bd29a75d19e7e8a6fcd8d14e962eeddcd81a7..48cad03eb76dad21b187f0637b23217704a3dc29 100644 (file)
@@ -1602,16 +1602,20 @@ dump_peer_options(StoreEntry * sentry, peer * p)
         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)