]> git.ipfire.org Git - thirdparty/squid.git/blame_incremental - src/acl/MethodData.cc
Fix SQUID_YESNO 'syntax error near unexpected token' (#2117)
[thirdparty/squid.git] / src / acl / MethodData.cc
... / ...
CommitLineData
1/*
2 * Copyright (C) 1996-2025 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/* DEBUG: section 28 Access Control */
10
11#include "squid.h"
12#include "acl/Checklist.h"
13#include "acl/MethodData.h"
14#include "ConfigParser.h"
15#include "http/RequestMethod.h"
16
17int ACLMethodData::ThePurgeCount = 0;
18
19ACLMethodData::~ACLMethodData()
20{
21 values.clear();
22}
23
24bool
25ACLMethodData::match(HttpRequestMethod toFind)
26{
27 for (auto i = values.begin(); i != values.end(); ++i) {
28 if (*i == toFind) {
29 // tune the list for LRU ordering
30 values.erase(i);
31 values.push_front(toFind);
32 return true;
33 }
34 }
35 return false;
36}
37
38SBufList
39ACLMethodData::dump() const
40{
41 SBufList sl;
42 for (std::list<HttpRequestMethod>::const_iterator i = values.begin(); i != values.end(); ++i) {
43 sl.push_back((*i).image());
44 }
45
46 return sl;
47}
48
49void
50ACLMethodData::parse()
51{
52 while (char *t = ConfigParser::strtokFile()) {
53 HttpRequestMethod m;
54 m.HttpRequestMethodXXX(t);
55 values.push_back(m);
56 if (values.back() == Http::METHOD_PURGE)
57 ++ThePurgeCount; // configuration code wants to know
58 }
59}
60