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
18const 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
29int
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
46bool
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
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
Acl::CharacterSetOptionValue delimiters
annotation separators
Definition: Note.h:27
const Acl::Options & options() override
Definition: Note.cc:19
option value to configure one or more characters (e.g., -m=",;")
int match(ACLChecklist *) override
Matches the actual data in checklist against this ACL.
Definition: Note.cc:30
bool matchNotes(const NotePairs *) const
Definition: Note.cc:47
void linkWith(Recipient *recipient) const
who to tell when this option is enabled
Definition: Options.h:137
NotePairs::Pointer metaHeaders
Definition: History.h:66
std::vector< Entry::Pointer > Entries
The key/value pair entries.
Definition: Notes.h:198
const Entries & expandListEntries(const CharacterSet *delimiters) const
Definition: Notes.cc:346
C * getRaw() const
Definition: RefCount.h:89
std::vector< const Option * > Options
Definition: Options.h:214

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors