]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/NoteData.cc
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
11 #include "acl/Checklist.h"
12 #include "acl/NoteData.h"
13 #include "acl/StringData.h"
14 #include "ConfigParser.h"
16 #include "HttpRequest.h"
20 ACLNoteData::ACLNoteData() : values(new ACLStringData
)
23 ACLNoteData::~ACLNoteData()
29 ACLNoteData::matchNotes(NotePairs
*note
)
34 debugs(28, 3, "Checking " << name
);
37 return (note
->findFirst(name
.termedBuf()) != NULL
);
39 for (std::vector
<NotePairs::Entry
*>::iterator i
= note
->entries
.begin(); i
!= note
->entries
.end(); ++i
) {
40 if ((*i
)->name
.cmp(name
.termedBuf()) == 0) {
41 if (values
->match((*i
)->value
.termedBuf()))
49 ACLNoteData::match(HttpRequest
*request
)
51 if (request
->notes
!= NULL
&& matchNotes(request
->notes
.getRaw()))
54 const Adaptation::History::Pointer ah
= request
->adaptLogHistory();
55 if (ah
!= NULL
&& ah
->metaHeaders
!= NULL
&& matchNotes(ah
->metaHeaders
.getRaw()))
62 ACLNoteData::dump() const
65 sl
.push_back(SBuf(name
));
66 #if __cplusplus >= 201103L
67 sl
.splice(sl
.end(), values
->dump());
69 // temp is needed until c++11 move constructor
70 SBufList temp
= values
->dump();
71 sl
.splice(sl
.end(), temp
);
79 char* t
= ConfigParser::strtokFile();
86 ACLNoteData::empty() const
88 return name
.size() == 0;
91 ACLData
<HttpRequest
*> *
92 ACLNoteData::clone() const
94 ACLNoteData
* result
= new ACLNoteData
;
95 result
->values
= values
->clone();