]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Associate external acl message with the request
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Thu, 25 Feb 2010 23:00:39 +0000 (00:00 +0100)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Thu, 25 Feb 2010 23:00:39 +0000 (00:00 +0100)
this change associates external acl message with the request just as
is done with the log message, tags etc. Was in a global variable.

The old global variable is still there as a fallback, but can probably
be removed.

src/HttpRequest.cc
src/HttpRequest.h
src/errorpage.cc
src/external_acl.cc

index 0ce9786b0ba8990568bffa0cfb39c197c26f8451..6f83a3387fd839a9638fbf19158d515a14500d99 100644 (file)
@@ -104,6 +104,7 @@ HttpRequest::init()
     extacl_user = null_string;
     extacl_passwd = null_string;
     extacl_log = null_string;
+    extacl_message = null_string;
     pstate = psReadyToParseStartLine;
 #if FOLLOW_X_FORWARDED_FOR
     indirect_client_addr.SetEmpty();
@@ -154,6 +155,8 @@ HttpRequest::clean()
 
     extacl_log.clean();
 
+    extacl_message.clean();
+
 #if USE_ADAPTATION
     adaptHistory_ = NULL;
 #endif
@@ -207,6 +210,7 @@ HttpRequest::clone() const
     copy->extacl_user = extacl_user;
     copy->extacl_passwd = extacl_passwd;
     copy->extacl_log = extacl_log;
+    copy->extacl_message = extacl_message;
 
     assert(copy->inheritProperties(this));
 
index 5c935e94409b6c567819bc1ed5ad5658dda4e751..8946ff27152c4ab703495229f0a16558b7474819 100644 (file)
@@ -208,6 +208,8 @@ public:
 
     String extacl_log;         /* String to be used for access.log purposes */
 
+    String extacl_message;     /* String to be used for error page purposes */
+
 #if FOLLOW_X_FORWARDED_FOR
     String x_forwarded_for_iterator; /* XXX a list of IP addresses */
 #endif /* FOLLOW_X_FORWARDED_FOR */
index 834c6587c8d2eff8221eea7ff239965cae3db45e..c5987e7db8ce304e0913f2e4e615d069da107047 100644 (file)
@@ -716,7 +716,9 @@ ErrorState::Convert(char token, bool url_presentable)
         break;
 
     case 'o':
-        p = external_acl_message ? external_acl_message : "[not available]";
+        p = request ? request->extacl_message.termedBuf() : external_acl_message;
+       if (!p)
+           p = "[not available]";
         break;
 
     case 'p':
index 1b9ae8091bf4f765828107ef943f521d4816fa99..5bd276e6ce79e701224eb595a9896c3cbe19dacd 100644 (file)
@@ -806,6 +806,9 @@ aclMatchExternal(external_acl_data *acl, ACLFilledChecklist *ch)
 
         if (entry->log.size())
             ch->request->extacl_log = entry->log;
+
+        if (entry->message.size())
+            ch->request->extacl_message = entry->message;
     }
 
     return result;