Squid Web Cache master
Loading...
Searching...
No Matches
AnnotateClient.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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/AnnotateClient.h"
11#include "acl/AnnotationData.h"
12#include "acl/FilledChecklist.h"
13#include "client_side.h"
14#include "http/Stream.h"
15
16int
18{
19 const auto checklist = Filled(ch);
20 auto annotated = false;
21 const auto tdata = dynamic_cast<ACLAnnotationData*>(data.get());
22 assert(tdata);
23 const auto conn = checklist->conn();
24
25 if (conn) {
26 tdata->annotate(conn->notes(), &delimiters.value, checklist->al);
27 annotated = true;
28 }
29
30 if (const auto &request = checklist->request) {
31 tdata->annotate(request->notes(), &delimiters.value, checklist->al);
32 annotated = true;
33 } else if (conn && !conn->pipeline.empty()) {
34 debugs(28, DBG_IMPORTANT, "ERROR: Squid BUG: " << name << " ACL is used in context with " <<
35 "an unexpectedly nil ACLFilledChecklist::request. Did not annotate the current transaction.");
36 }
37
38 if (!annotated) {
39 debugs(28, DBG_IMPORTANT, "WARNING: " << name << " ACL is used in context without " <<
40 "active client-to-Squid connection and current transaction information. Did not annotate.");
41 }
42
43 return 1; // this is an "always matching" ACL
44}
45
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
#define assert(EX)
Definition assert.h:17
int match(ACLChecklist *) override
Matches the actual data in checklist against this Acl::Node.
Acl::CharacterSetOptionValue delimiters
annotation separators
Definition Note.h:27
SBuf name
Definition Node.h:81
Value value
final value storage, possibly after conversions
Definition Options.h:120
#define DBG_IMPORTANT
Definition Stream.h:38
#define debugs(SECTION, LEVEL, CONTENT)
Definition Stream.h:192