Note.cc
Go to the documentation of this file.
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 #include "squid.h"
10 #include "acl/FilledChecklist.h"
11 #include "acl/HttpHeaderData.h"
12 #include "acl/Note.h"
13 #include "acl/NoteData.h"
14 #include "HttpRequest.h"
15 
16 /* Acl::AnnotationStrategy */
17 
18 const Acl::Options &
20 {
21  static const Acl::CharacterSetOption Delimiters("-m");
22  static const Acl::Options MyOptions = { &Delimiters };
23  Delimiters.linkWith(&delimiters);
24  return MyOptions;
25 }
26 
27 /* ACLNoteStrategy */
28 
29 int
31 {
32  if (const auto request = checklist->request) {
33  if (request->hasNotes() && matchNotes(data, request->notes().getRaw()))
34  return 1;
35 #if USE_ADAPTATION
36  const Adaptation::History::Pointer ah = request->adaptLogHistory();
37  if (ah != NULL && ah->metaHeaders != NULL && matchNotes(data, ah->metaHeaders.getRaw()))
38  return 1;
39 #endif
40  }
41  return 0;
42 }
43 
44 bool
46 {
47  const NotePairs::Entries &entries = note->expandListEntries(&delimiters.value);
48  for (auto e: entries)
49  if (noteData->match(e.getRaw()))
50  return true;
51  return false;
52 }
53 
virtual int match(ACLData< MatchType > *&, ACLFilledChecklist *)
Definition: Note.cc:30
std::vector< const Option * > Options
Definition: Options.h:214
void linkWith(Recipient *recipient) const
who to tell when this option is enabled
Definition: Options.h:137
C * getRaw() const
Definition: RefCount.h:80
#define NULL
Definition: types.h:166
bool matchNotes(ACLData< MatchType > *, const NotePairs *) const
Definition: Note.cc:45
Acl::CharacterSetOptionValue delimiters
annotation separators
Definition: Note.h:27
NotePairs::Pointer metaHeaders
Definition: History.h:65
HttpRequest * request
const Entries & expandListEntries(const CharacterSet *delimiters) const
Definition: Notes.cc:346
option value to configure one or more characters (e.g., -m=",;")
virtual bool match(M)=0
std::vector< Entry::Pointer > Entries
The key/value pair entries.
Definition: Notes.h:198
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
virtual const Acl::Options & options() override
Definition: Note.cc:19

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors