Note.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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::AnnotationCheck */
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 /* Acl::NoteCheck */
28 
29 int
31 {
32  const auto checklist = Filled(ch);
33 
34  if (const auto request = checklist->request) {
35  if (request->hasNotes() && matchNotes(request->notes().getRaw()))
36  return 1;
37 #if USE_ADAPTATION
38  const Adaptation::History::Pointer ah = request->adaptLogHistory();
39  if (ah != nullptr && ah->metaHeaders != nullptr && matchNotes(ah->metaHeaders.getRaw()))
40  return 1;
41 #endif
42  }
43  return 0;
44 }
45 
46 bool
48 {
49  const NotePairs::Entries &entries = note->expandListEntries(&delimiters.value);
50  for (auto e: entries)
51  if (data->match(e.getRaw()))
52  return true;
53  return false;
54 }
55 
bool matchNotes(const NotePairs *) const
Definition: Note.cc:47
std::vector< const Option * > Options
Definition: Options.h:217
int match(ACLChecklist *) override
Matches the actual data in checklist against this Acl::Node.
Definition: Note.cc:30
void linkWith(Recipient *recipient) const
who to tell when this option is enabled
Definition: Options.h:137
Acl::CharacterSetOptionValue delimiters
annotation separators
Definition: Note.h:27
C * getRaw() const
Definition: RefCount.h:89
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
NotePairs::Pointer metaHeaders
Definition: History.h:66
const Entries & expandListEntries(const CharacterSet *delimiters) const
Definition: Notes.cc:351
option value to configure one or more characters (e.g., -m=",;")
const Acl::Options & options() override
Definition: Note.cc:19
std::vector< Entry::Pointer > Entries
The key/value pair entries.
Definition: Notes.h:205

 

Introduction

Documentation

Support

Miscellaneous