Amos Jeffries wrote:
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
This patch actually removes the now unused function. No other additional
changes.
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/Gadgets.cc'
--- src/acl/Gadgets.cc 2009-03-08 19:45:44 +0000
+++ src/acl/Gadgets.cc 2009-05-03 07:21:35 +0000
@@ -309,37 +309,3 @@
*list = NULL;
}
-
-/*
- * This function traverses all ACL elements referenced
- * by an access list (presumably 'http_access'). If
- * it finds a PURGE method ACL, then it returns TRUE,
- * otherwise FALSE.
- */
-/* XXX: refactor this more sensibly. perhaps have the parser detect it ? */
-int
-aclPurgeMethodInUse(acl_access * a)
-{
- ACLList *b;
-
- debugs(28, 6, "aclPurgeMethodInUse: invoked for '" << a->cfgline << "'");
-
- for (; a; a = a->next) {
- for (b = a->aclList; b; b = b->next) {
- ACLStrategised<HttpRequestMethod> *tempAcl = dynamic_cast<ACLStrategised<HttpRequestMethod> *>(b->_acl);
-
- if (!tempAcl) {
- debugs(28, 7, "aclPurgeMethodInUse: can't create tempAcl");
- continue;
- }
-
- if (tempAcl->match(METHOD_PURGE)) {
- debugs(28, 6, "aclPurgeMethodInUse: returning true");
- return true;
- }
- }
- }
-
- debugs(28, 6, "aclPurgeMethodInUse: returning false");
- return false;
-}
=== modified file 'src/acl/Gadgets.h'
--- src/acl/Gadgets.h 2009-03-08 19:45:44 +0000
+++ src/acl/Gadgets.h 2009-05-03 07:21:13 +0000
@@ -37,7 +37,5 @@
extern void aclCacheMatchFlush(dlink_list * cache);
/// \ingroup ACLAPI
extern void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head);
-/// \ingroup ACLAPI
-int aclPurgeMethodInUse(acl_access * a);
#endif /* SQUID_ACL_GADGETS_H */
=== 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();