]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Replaced cache_stoplist with 'no_cache' access list
authorwessels <>
Fri, 17 Apr 1998 00:06:32 +0000 (00:06 +0000)
committerwessels <>
Fri, 17 Apr 1998 00:06:32 +0000 (00:06 +0000)
- started coding SRC_RTT acl
- s/struct _// on structs.h;

src/acl.cc
src/cf.data.pre
src/client_side.cc
src/enums.h
src/structs.h

index 8a1cc7de1d7eb2019372930c03e464cdcc3c500c..cf806dedf9f7eca9781e5fab4ed7b95767b4404a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.159 1998/04/08 05:33:27 wessels Exp $
+ * $Id: acl.cc,v 1.160 1998/04/16 18:06:32 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -186,6 +186,8 @@ aclStrToType(const char *s)
        return ACL_DST_ASN;
     if (!strcmp(s, "snmp_community"))
        return ACL_SNMP_COMM;
+    if (!strcmp(s, "src_rtt"))
+       return ACL_NETDB_SRC_RTT;
 #if USE_ARP_ACL
     if (!strcmp(s, "arp"))
        return ACL_SRC_ARP;
@@ -232,6 +234,8 @@ aclTypeToStr(squid_acl type)
        return "dst_as";
     if (type == ACL_SNMP_COMM)
        return "snmp_community";
+    if (type == ACL_NETDB_SRC_RTT)
+       return "src_rtt";
 #if USE_ARP_ACL
     if (type == ACL_SRC_ARP)
        return "arp";
@@ -757,6 +761,7 @@ aclParseAclLine(acl ** head)
     case ACL_URL_PORT:
     case ACL_SRC_ASN:
     case ACL_DST_ASN:
+    case ACL_NETDB_SRC_RTT:
        aclParseIntlist(&A->data);
        break;
     case ACL_USER:
index dd6068afef299e267ef5a349f409def8244c5454..79c323dfc6ea0150f40eec05aa0b698992556279 100644 (file)
@@ -321,22 +321,22 @@ hierarchy_stoplist cgi-bin ?
 DOC_END
 
 
-NAME: cache_stoplist
-TYPE: wordlist
-DEFAULT: cgi-bin ?
-LOC: Config.cache_stoplist
+NAME: no_cache
+TYPE: acl_access
+DEFAULT: none
+LOC: Config.accessList.noCache
 DOC_START
-       A list of words which, if found in a URL, cause the object to
+       A list of ACL elements which, if matched, cause the reply to
        immediately removed from the cache.  In other words, use this
-       to force certain objects to never be cached.  You may list this
-       option multiple times.
+       to force certain objects to never be cached.
 
-       The default is to not cache URLs containing 'cgi-bin' or '?'.
+       There is no default.  We recommend you uncomment the following
+       two lines.
 
-cache_stoplist cgi-bin ?
+acl QUERY urlpath_regex cgi-bin \?
+no_cache QUERY
 DOC_END
 
-
 NAME: cache_stoplist_pattern
 TYPE: regexlist
 LOC: Config.cache_stop_relist
index a54b844b5fb4fe6e86233d9798bce28f26224bcb..fda9de28d3145bbf44b3bd72de07afcf38375048 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.277 1998/04/14 15:16:24 rousskov Exp $
+ * $Id: client_side.cc,v 1.278 1998/04/16 18:06:34 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -833,11 +833,20 @@ clientCachable(clientHttpRequest * http)
     const char *url = http->uri;
     request_t *req = http->request;
     method_t method = req->method;
-    const wordlist *p;
-    for (p = Config.cache_stoplist; p; p = p->next) {
-       if (strstr(url, p->key))
+    aclCheck_t ch;
+    memset(&ch, '\0', sizeof(ch));
+    /*
+     * Hopefully, nobody really wants 'no_cache' by client's IP
+     * address, but if they do, this should work if they use IP
+     * addresses in their ACLs, or if the client's address is in
+     * the FQDN cache.
+     *
+     * This may not work yet for 'dst' and 'dst_domain' ACLs.
+     */
+    ch.src_addr = http->conn->peer.sin_addr;
+    ch.request = http->request;
+    if (0 == aclCheckFast(Config.accessList.noCache, &ch))
            return 0;
-    }
     if (Config.cache_stop_relist)
        if (aclMatchRegex(Config.cache_stop_relist, url))
            return 0;
index 8a355322d9273315a3b0ae948a825767997b1510..65a28a6154a48d4af98fee3cdc650bc61cdd0008 100644 (file)
@@ -75,6 +75,7 @@ typedef enum {
     ACL_DST_ASN,
     ACL_SRC_ARP,
     ACL_SNMP_COMM,
+    ACL_NETDB_SRC_RTT,
     ACL_ENUM_MAX
 } squid_acl;
 
index 2c007fc1b3ffc526ca8e405d2962a84072f3e6f3..688d3c2ee10f14f7c1ab75a3f5fc5f4aefe3051b 100644 (file)
@@ -93,11 +93,11 @@ typedef struct _communityEntry {
     char name[64];
     int readView;
     int writeView;
-    struct _acl_access *acls;
-    struct _communityEntry *next;
+    acl_access *acls;
+    communityEntry *next;
 } communityEntry;
 
-typedef struct _usecEntry {
+typedef usecEntry {
     u_char userName[32];
     int userLen;
     int qoS;
@@ -107,7 +107,7 @@ typedef struct _usecEntry {
     int noauthWriteView;
     int authReadView;
     int authWriteView;
-    struct _usecEntry *next;
+    usecEntry *next;
 } usecEntry;
 
 #endif
@@ -117,24 +117,24 @@ struct _acl {
     squid_acl type;
     void *data;
     char *cfgline;
-    struct _acl *next;
+    acl *next;
 };
 
 struct _acl_list {
     int op;
-    struct _acl *acl;
-    struct _acl_list *next;
+    acl *acl;
+    acl_list *next;
 };
 
 struct _acl_access {
     int allow;
-    struct _acl_list *acl_list;
+    acl_list *acl_list;
     char *cfgline;
-    struct _acl_access *next;
+    acl_access *next;
 };
 
 struct _aclCheck_t {
-    const struct _acl_access *access_list;
+    const acl_access *access_list;
     struct in_addr src_addr;
     struct in_addr dst_addr;
     request_t *request;
@@ -152,23 +152,23 @@ struct _aio_result_t {
 
 struct _wordlist {
     char *key;
-    struct _wordlist *next;
+    wordlist *next;
 };
 
 struct _intlist {
     int i;
-    struct _intlist *next;
+    intlist *next;
 };
 
 struct _ushortlist {
     u_short i;
-    struct _ushortlist *next;
+    ushortlist *next;
 };
 
 struct _relist {
     char *pattern;
     regex_t regex;
-    struct _relist *next;
+    relist *next;
 };
 
 struct _SquidConfig {
@@ -276,7 +276,6 @@ struct _SquidConfig {
     } Addrs;
     size_t tcpRcvBufsz;
     size_t udpMaxHitObjsz;
-    wordlist *cache_stoplist;
     wordlist *hierarchy_stoplist;
     wordlist *mcast_group_list;
     wordlist *dns_testname_list;
@@ -322,16 +321,17 @@ struct _SquidConfig {
        int mem_pools;
        int test_reachability;
     } onoff;
-    struct _acl *aclList;
+    acl *aclList;
     struct {
-       struct _acl_access *http;
-       struct _acl_access *icp;
-       struct _acl_access *miss;
-       struct _acl_access *NeverDirect;
-       struct _acl_access *AlwaysDirect;
-       struct _acl_access *ASlists;
+       acl_access *http;
+       acl_access *icp;
+       acl_access *miss;
+       acl_access *NeverDirect;
+       acl_access *AlwaysDirect;
+       acl_access *ASlists;
+       acl_access *noCache;
     } accessList;
-    struct _acl_deny_info_list *denyInfoList;
+    acl_deny_info_list *denyInfoList;
     struct {
        size_t list_width;
        int list_wrap;
@@ -404,7 +404,7 @@ struct _dwrite_q {
     char *buf;
     int len;
     off_t buf_offset;
-    struct _dwrite_q *next;
+    dwrite_q *next;
     FREE *free_func;
 };
 
@@ -450,7 +450,7 @@ struct _fileMap {
 
 struct _hash_link {
     char *key;
-    struct _hash_link *next;
+    hash_link *next;
     void *item;
 };
 
@@ -650,7 +650,7 @@ struct _AccessLogEntry {
     struct {
        const char *method_str;
     } private;
-    struct _HierarchyLogEntry hier;
+    HierarchyLogEntry hier;
 };
 
 struct _clientHttpRequest {
@@ -675,7 +675,7 @@ struct _clientHttpRequest {
     int redirect_state;
     aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */
     clientHttpRequest *next;
-    struct _AccessLogEntry al;
+    AccessLogEntry al;
 };
 
 struct _ConnStateData {
@@ -733,7 +733,7 @@ struct _ip_pending {
 struct _ipcache_entry {
     /* first two items must be equivalent to hash_link */
     char *name;
-    struct _ipcache_entry *next;
+    ipcache_entry *next;
     time_t lastref;
     time_t expires;
     ipcache_addrs addrs;
@@ -754,7 +754,7 @@ struct _fqdn_pending {
 struct _fqdncache_entry {
     /* first two items must be equivalent to hash_link */
     char *name;
-    struct _fqdncache_entry *next;
+    fqdncache_entry *next;
     time_t lastref;
     time_t expires;
     unsigned char name_count;
@@ -769,13 +769,13 @@ struct _fqdncache_entry {
 struct _domain_ping {
     char *domain;
     int do_ping;               /* boolean */
-    struct _domain_ping *next;
+    domain_ping *next;
 };
 
 struct _domain_type {
     char *domain;
     peer_t type;
-    struct _domain_type *next;
+    domain_type *next;
 };
 
 struct _Version {
@@ -847,9 +847,9 @@ struct _peer {
     u_short icp_port;
     u_short http_port;
     int icp_version;
-    struct _domain_ping *pinglist;
-    struct _domain_type *typelist;
-    struct _acl_list *acls;
+    domain_ping *pinglist;
+    domain_type *typelist;
+    acl_list *acls;
     int options;
     int weight;
     struct {
@@ -866,7 +866,7 @@ struct _peer {
     struct in_addr addresses[10];
     int n_addresses;
     int rr_count;
-    struct _peer *next;
+    peer *next;
     int ck_conn_event_pend;
     int test_fd;
 };
@@ -999,7 +999,7 @@ struct _store_client {
     StoreEntry *entry;         /* ptr to the parent StoreEntry, argh! */
     int swapin_fd;
     int disk_op_in_progress;
-    struct _store_client *next;
+    store_client *next;
 };
 
 
@@ -1010,7 +1010,7 @@ struct _MemObject {
     mem_hdr *data;
     off_t inmem_hi;
     off_t inmem_lo;
-    struct _store_client *clients;
+    store_client *clients;
     int nclients;
     struct {
        off_t queue_offset;     /* relative to in-mem data */
@@ -1038,7 +1038,7 @@ struct _MemObject {
 struct _StoreEntry {
     /* first two items must be same as hash_link */
     const cache_key *key;
-    struct _StoreEntry *next;
+    StoreEntry *next;
     MemObject *mem_obj;
     time_t timestamp;
     time_t lastref;
@@ -1089,14 +1089,14 @@ struct _request_t {
     size_t headers_sz;
     char *body;
     size_t body_sz;
-    struct _HierarchyLogEntry hier;
+    HierarchyLogEntry hier;
     err_type err_type;
 };
 
 struct _cachemgr_passwd {
     char *passwd;
     wordlist *actions;
-    struct _cachemgr_passwd *next;
+    cachemgr_passwd *next;
 };
 
 struct _refresh_t {
@@ -1105,7 +1105,7 @@ struct _refresh_t {
     time_t min;
     int pct;
     time_t max;
-    struct _refresh_t *next;
+    refresh_t *next;
 };
 
 struct _CommWriteStateData {
@@ -1237,7 +1237,7 @@ struct _tlv {
     char type;
     int length;
     void *value;
-    struct _tlv *next;
+    tlv *next;
 };
 
 struct _storeSwapLogData {