]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
referer_regex ACL type by "Brian"
authorhno <>
Fri, 21 Dec 2001 16:47:33 +0000 (16:47 +0000)
committerhno <>
Fri, 21 Dec 2001 16:47:33 +0000 (16:47 +0000)
CONTRIBUTORS
src/acl.cc
src/cf.data.pre
src/enums.h

index cde86a4720080111f4d09d618cdd559a1ffe36be..bf5e3e91c9ca0a298896d0d04dd85b1b6108fe7a 100644 (file)
@@ -84,5 +84,6 @@ and ideas to make this software available.
        Moez Mahfoudh <moez.mahfoudh@imag.fr>
        Guido Serassio <serassio@libero.it>
        Miquel van Smoorenburg <miquels@cistron.nl>
+       Brian <hiryuu@envisiongames.net>
 
        Duane Wessels <wessels@squid-cache.org>
index 22aaa3b58cd2cd83321ee199e101aefdaa9c669f..03f6d844f52882b7700377365999b3f88871f8b5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.269 2001/11/13 18:50:43 hno Exp $
+ * $Id: acl.cc,v 1.270 2001/12/21 09:47:34 hno Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -198,6 +198,8 @@ aclStrToType(const char *s)
        return ACL_METHOD;
     if (!strcmp(s, "browser"))
        return ACL_BROWSER;
+    if (!strcmp(s, "referer_regex"))
+       return ACL_REFERER_REGEX;
     if (!strcmp(s, "proxy_auth"))
        return ACL_PROXY_AUTH;
     if (!strcmp(s, "proxy_auth_regex"))
@@ -268,6 +270,8 @@ aclTypeToStr(squid_acl type)
        return "method";
     if (type == ACL_BROWSER)
        return "browser";
+    if (type == ACL_REFERER_REGEX)
+       return "referer_regex";
     if (type == ACL_PROXY_AUTH)
        return "proxy_auth";
     if (type == ACL_PROXY_AUTH_REGEX)
@@ -781,6 +785,7 @@ aclParseAclLine(acl ** head)
     case ACL_URL_REGEX:
     case ACL_URLPATH_REGEX:
     case ACL_BROWSER:
+    case ACL_REFERER_REGEX:
     case ACL_SRC_DOM_REGEX:
     case ACL_DST_DOM_REGEX:
     case ACL_REQ_MIME_TYPE:
@@ -1425,6 +1430,7 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist)
        return 0;
     switch (ae->type) {
     case ACL_BROWSER:
+    case ACL_REFERER_REGEX:
     case ACL_DST_ASN:
     case ACL_DST_DOMAIN:
     case ACL_DST_DOM_REGEX:
@@ -1583,6 +1589,12 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist)
            return 0;
        return aclMatchRegex(ae->data, browser);
        /* NOTREACHED */
+    case ACL_REFERER_REGEX:
+       header = httpHeaderGetStr(&checklist->request->header, HDR_REFERER);
+       if (NULL == header)
+           return 0;
+       return aclMatchRegex(ae->data, header);
+       /* NOTREACHED */
     case ACL_PROXY_AUTH:
     case ACL_PROXY_AUTH_REGEX:
     case ACL_MAX_USER_IP:
@@ -2081,6 +2093,7 @@ aclDestroyAcls(acl ** head)
        case ACL_URL_REGEX:
        case ACL_URLPATH_REGEX:
        case ACL_BROWSER:
+       case ACL_REFERER_REGEX:
        case ACL_SRC_DOM_REGEX:
        case ACL_DST_DOM_REGEX:
        case ACL_REP_MIME_TYPE:
@@ -2427,6 +2440,7 @@ aclDumpGeneric(const acl * a)
     case ACL_URL_REGEX:
     case ACL_URLPATH_REGEX:
     case ACL_BROWSER:
+    case ACL_REFERER_REGEX:
     case ACL_SRC_DOM_REGEX:
     case ACL_DST_DOM_REGEX:
     case ACL_REQ_MIME_TYPE:
index b8984760d1cda34239f1908e5de6debb31502dd3..924b43b648baab7b540a40837cce13189443207b 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.244 2001/12/11 02:35:54 hno Exp $
+# $Id: cf.data.pre,v 1.245 2001/12/21 09:47:34 hno Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -1823,8 +1823,7 @@ DOC_START
 
        when using "file", the file should contain one item per line
 
-       acltype is one of src dst srcdomain dstdomain url_pattern
-               urlpath_pattern time port proto method browser user
+       acltype is one of the types described below
 
        By default, regular expressions are CASE-SENSITIVE.  To make
        them case-insensitive, use the -i option.
@@ -1859,8 +1858,11 @@ DOC_START
        acl aclname myport   3128 ...           # (local socket TCP port)
        acl aclname proto    HTTP FTP ...
        acl aclname method   GET POST ...
-       acl aclname browser  [-i] regexp
+       acl aclname browser  [-i] regexp ...
          # pattern match on User-Agent header
+        acl aclname referer_regex  [-i] regexp ...
+          # pattern match on Referer header
+          # Referer is highly unreliable, so use with care
        acl aclname ident    username ...
        acl aclname ident_regex [-i] pattern ...
          # string match on ident output.
index bbf8f75227e1ef65d7072b98f75a1d510cbb225e..97734ce3a026c836fdf11975b6b229bd434848c8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.202 2001/11/28 08:01:46 robertc Exp $
+ * $Id: enums.h,v 1.203 2001/12/21 09:47:34 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -116,6 +116,7 @@ typedef enum {
     ACL_PROTO,
     ACL_METHOD,
     ACL_BROWSER,
+    ACL_REFERER_REGEX,
     ACL_PROXY_AUTH,
     ACL_PROXY_AUTH_REGEX,
     ACL_SRC_ASN,