]>
Commit | Line | Data |
---|---|---|
48071869 | 1 | /* |
1f7b830e | 2 | * Copyright (C) 1996-2025 The Squid Software Foundation and contributors |
48071869 | 3 | * |
bbc27441 AJ |
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. | |
48071869 | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 28 Access Control */ |
10 | ||
582c2af2 | 11 | #include "squid.h" |
3ad63615 | 12 | #include "acl/Checklist.h" |
602d9612 | 13 | #include "acl/MethodData.h" |
16c5ad96 | 14 | #include "ConfigParser.h" |
d477ce03 | 15 | #include "http/RequestMethod.h" |
48071869 | 16 | |
5491c11e AR |
17 | int ACLMethodData::ThePurgeCount = 0; |
18 | ||
48071869 | 19 | ACLMethodData::~ACLMethodData() |
20 | { | |
cd44274b | 21 | values.clear(); |
48071869 | 22 | } |
23 | ||
24 | bool | |
60745f24 | 25 | ACLMethodData::match(HttpRequestMethod toFind) |
48071869 | 26 | { |
c70b36bd | 27 | for (auto i = values.begin(); i != values.end(); ++i) { |
cd44274b AJ |
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; | |
48071869 | 36 | } |
37 | ||
9b859d6f | 38 | SBufList |
4f8ca96e | 39 | ACLMethodData::dump() const |
48071869 | 40 | { |
9b859d6f | 41 | SBufList sl; |
cd44274b AJ |
42 | for (std::list<HttpRequestMethod>::const_iterator i = values.begin(); i != values.end(); ++i) { |
43 | sl.push_back((*i).image()); | |
48071869 | 44 | } |
45 | ||
9b859d6f | 46 | return sl; |
48071869 | 47 | } |
48 | ||
49 | void | |
50 | ACLMethodData::parse() | |
51 | { | |
16c5ad96 | 52 | while (char *t = ConfigParser::strtokFile()) { |
f9688132 AJ |
53 | HttpRequestMethod m; |
54 | m.HttpRequestMethodXXX(t); | |
cd44274b AJ |
55 | values.push_back(m); |
56 | if (values.back() == Http::METHOD_PURGE) | |
d73e600f | 57 | ++ThePurgeCount; // configuration code wants to know |
48071869 | 58 | } |
59 | } | |
60 |