This patch uses a tri-state setting on enable_purge and acl parsing to detect PURGE method addition/removal instead of a complicated ACL creation test post-configure.

This removes the annoying false errors about temp ACL and some minor speed up in all actions that parse squid.conf.

Amos
--
Please be using
  Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14
  Current Beta Squid 3.1.0.7
=== modified file 'src/acl/MethodData.cc'
--- src/acl/MethodData.cc	2009-04-06 13:22:42 +0000
+++ src/acl/MethodData.cc	2009-05-03 07:10:33 +0000
@@ -89,6 +89,10 @@
 
     for (Tail = &values; *Tail; Tail = &((*Tail)->next));
     while ((t = strtokFile())) {
+        if(strcmp(t, "PURGE") == 0) {
+            // we need to use PURGE, can't just blanket-deny it.
+            Config2.onoff.enable_purge = 1;
+        }
         CbDataList<HttpRequestMethod> *q = new CbDataList<HttpRequestMethod> (HttpRequestMethod(t, NULL));
         *(Tail) = q;
         Tail = &q->next;

=== modified file 'src/cache_cf.cc'
--- src/cache_cf.cc	2009-04-12 08:17:19 +0000
+++ src/cache_cf.cc	2009-05-03 07:10:33 +0000
@@ -608,8 +608,10 @@
 
 #endif
 
-    if (aclPurgeMethodInUse(Config.accessList.http))
-        Config2.onoff.enable_purge = 1;
+    // we have reconfigured and in the process disabled any need for PURGE.
+    // turn it off now.
+    if(Config2.onoff.enable_purge == 2)
+        Config2.onoff.enable_purge = 0;
 
     Config2.onoff.mangle_request_headers = httpReqHdrManglersConfigured();
 

=== modified file 'src/main.cc'
--- src/main.cc	2009-04-12 08:17:19 +0000
+++ src/main.cc	2009-05-03 07:10:33 +0000
@@ -709,7 +709,13 @@
 
     errorClean();
     enter_suid();		/* root to read config file */
+
+    // we may have disabled the need for PURGE
+    if(Config2.onoff.enable_purge)
+        Config2.onoff.enable_purge = 2;
+
     parseConfigFile(ConfigFile);
+
     setUmask(Config.umask);
     Mem::Report();
     setEffectiveUser();

Reply via email to