Note.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
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/* ACLNoteStrategy */
28
29int
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 != nullptr && ah->metaHeaders != nullptr && matchNotes(data, ah->metaHeaders.getRaw()))
38 return 1;
39#endif
40 }
41 return 0;
42}
43
44bool
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 bool match(M)=0
HttpRequest * request
bool matchNotes(ACLData< MatchType > *, const NotePairs *) const
Definition: Note.cc:45
virtual int match(ACLData< MatchType > *&, ACLFilledChecklist *)
Definition: Note.cc:30
virtual const Acl::Options & options() override
Definition: Note.cc:19
Acl::CharacterSetOptionValue delimiters
annotation separators
Definition: Note.h:27
option value to configure one or more characters (e.g., -m=",;")
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:80
std::vector< const Option * > Options
Definition: Options.h:214
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors