From: wessels <> Date: Thu, 6 Jan 2000 06:32:17 +0000 (+0000) Subject: DW X-Git-Tag: SQUID_3_0_PRE1~2088 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=db043f2efa34dec566b2077957980ccce64d2e55;p=thirdparty%2Fsquid.git DW - User-Agent is taken from HTTP request headers. It seems silly to make it a special case in aclCheck_t and aclCreateChecklist. Now acl.c just gets it from request->headers when needed. --- diff --git a/src/acl.cc b/src/acl.cc index 1465865eb3..d00e93464f 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.209 1999/12/30 17:36:20 wessels Exp $ + * $Id: acl.cc,v 1.210 2000/01/05 23:32:17 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -1274,6 +1274,7 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist) const char *fqdn = NULL; char *esc_buf; const char *header; + const char *browser; int k; if (!ae) return 0; @@ -1398,7 +1399,10 @@ aclMatchAcl(acl * ae, aclCheck_t * checklist) return aclMatchInteger(ae->data, r->method); /* NOTREACHED */ case ACL_BROWSER: - return aclMatchRegex(ae->data, checklist->browser); + browser = httpHeaderGetStr(&checklist->request->header, HDR_USER_AGENT); + if (NULL == browser) + return 0; + return aclMatchRegex(ae->data, browser); /* NOTREACHED */ case ACL_PROXY_AUTH: if (NULL == r) { @@ -1724,7 +1728,6 @@ aclLookupProxyAuthDone(void *data, char *result) aclCheck_t * aclChecklistCreate(const acl_access * A, request_t * request, - const char *user_agent, const char *ident) { int i; @@ -1744,8 +1747,6 @@ aclChecklistCreate(const acl_access * A, } for (i = 0; i < ACL_ENUM_MAX; i++) checklist->state[i] = ACL_LOOKUP_NONE; - if (user_agent) - xstrncpy(checklist->browser, user_agent, BROWSERNAMELEN); #if USE_IDENT if (ident) xstrncpy(checklist->ident, ident, USER_IDENT_SZ); diff --git a/src/client_side.cc b/src/client_side.cc index 668ae87803..4e6a9e6198 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.467 2000/01/05 22:44:00 wessels Exp $ + * $Id: client_side.cc,v 1.468 2000/01/05 23:32:19 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -139,15 +139,12 @@ clientAccessCheck(void *data) { clientHttpRequest *http = data; ConnStateData *conn = http->conn; - const char *browser; if (checkAccelOnly(http)) { clientAccessCheckDone(0, http); return; } - browser = httpHeaderGetStr(&http->request->header, HDR_USER_AGENT); http->acl_checklist = aclChecklistCreate(Config.accessList.http, http->request, - browser, conn->ident); #if USE_IDENT /* diff --git a/src/peer_select.cc b/src/peer_select.cc index 67d0b3dc2c..1be75ce945 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.103 2000/01/03 19:32:33 wessels Exp $ + * $Id: peer_select.cc,v 1.104 2000/01/05 23:32:20 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -237,7 +237,6 @@ peerSelectFoo(ps_state * ps) ps->acl_checklist = aclChecklistCreate( Config.accessList.AlwaysDirect, request, - NULL, /* user agent */ NULL); /* ident */ aclNBCheck(ps->acl_checklist, peerCheckAlwaysDirectDone, @@ -249,7 +248,6 @@ peerSelectFoo(ps_state * ps) ps->acl_checklist = aclChecklistCreate( Config.accessList.NeverDirect, request, - NULL, /* user agent */ NULL); /* ident */ aclNBCheck(ps->acl_checklist, peerCheckNeverDirectDone, diff --git a/src/protos.h b/src/protos.h index f42f4b58e1..6483c897a5 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.351 2000/01/05 22:44:01 wessels Exp $ + * $Id: protos.h,v 1.352 2000/01/05 23:32:21 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -44,7 +44,6 @@ extern void fvdbCountForw(const char *key); extern aclCheck_t *aclChecklistCreate(const struct _acl_access *, request_t *, - const char *user_agent, const char *ident); extern void aclNBCheck(aclCheck_t *, PF *, void *); extern int aclCheckFast(const struct _acl_access *A, aclCheck_t *); diff --git a/src/structs.h b/src/structs.h index 80f89433de..a1bcbadcd6 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.309 2000/01/05 22:44:03 wessels Exp $ + * $Id: structs.h,v 1.310 2000/01/05 23:32:22 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -150,7 +150,6 @@ struct _aclCheck_t { ConnStateData *conn; /* hack for ident */ char ident[USER_IDENT_SZ]; #endif - char browser[BROWSERNAMELEN]; acl_proxy_auth_user *auth_user; acl_lookup_state state[ACL_ENUM_MAX]; #if SQUID_SNMP