1 /* 2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors 3 * 4 * Squid software is distributed under GPLv2+ license and includes 5 * contributions from numerous individuals and organizations. 6 * Please see the COPYING and CONTRIBUTORS files for details. 7 */ 8 9 #ifndef SQUID_ACLREQUESTHEADERSTRATEGY_H 10 #define SQUID_ACLREQUESTHEADERSTRATEGY_H 11 #include "acl/Acl.h" 12 #include "acl/Data.h" 13 #include "acl/FilledChecklist.h" 14 #include "acl/Strategy.h" 15 #include "HttpRequest.h" 16 17 template <Http::HdrType header> 18 class ACLRequestHeaderStrategy : public ACLStrategy<char const *> 19 { 20 21 public: 22 virtual int match (ACLData<char const *> * &, ACLFilledChecklist *); requiresRequest()23 virtual bool requiresRequest() const {return true;} 24 }; 25 26 template <Http::HdrType header> 27 int match(ACLData<char const * > * & data,ACLFilledChecklist * checklist)28ACLRequestHeaderStrategy<header>::match (ACLData<char const *> * &data, ACLFilledChecklist *checklist) 29 { 30 char const *theHeader = checklist->request->header.getStr(header); 31 32 if (NULL == theHeader) 33 return 0; 34 35 return data->match(theHeader); 36 } 37 38 #endif /* SQUID_REQUESTHEADERSTRATEGY_H */ 39 40