MethodData.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
18 
20 {
21  assert(old.values.empty());
22 }
23 
25 {
26  values.clear();
27 }
28 
29 bool
31 {
32  for (auto i = values.begin(); i != values.end(); ++i) {
33  if (*i == toFind) {
34  // tune the list for LRU ordering
35  values.erase(i);
36  values.push_front(toFind);
37  return true;
38  }
39  }
40  return false;
41 }
42 
45 {
46  SBufList sl;
47  for (std::list<HttpRequestMethod>::const_iterator i = values.begin(); i != values.end(); ++i) {
48  sl.push_back((*i).image());
49  }
50 
51  return sl;
52 }
53 
54 void
56 {
57  while (char *t = ConfigParser::strtokFile()) {
60  values.push_back(m);
61  if (values.back() == Http::METHOD_PURGE)
62  ++ThePurgeCount; // configuration code wants to know
63  }
64 }
65 
68 {
69  assert(values.empty());
70  return new ACLMethodData(*this);
71 }
72 
#define assert(EX)
Definition: assert.h:17
void parse()
Definition: MethodData.cc:55
int i
Definition: membanger.c:49
bool match(HttpRequestMethod)
Definition: MethodData.cc:30
static int ThePurgeCount
PURGE methods seen by parse()
Definition: MethodData.h:35
virtual ~ACLMethodData()
Definition: MethodData.cc:24
std::list< SBuf > SBufList
Definition: forward.h:26
virtual SBufList dump() const
Definition: MethodData.cc:44
void HttpRequestMethodXXX(char const *)
static char * strtokFile()
Definition: ConfigParser.cc:82
std::list< HttpRequestMethod > values
Definition: MethodData.h:33
virtual ACLData< HttpRequestMethod > * clone() const
Definition: MethodData.cc:67

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors