]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/NoteData.cc
2 * Copyright (C) 1996-2014 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"
15 #include "ConfigParser.h"
17 #include "HttpRequest.h"
21 ACLNoteData::ACLNoteData() : values(new ACLStringData
)
24 ACLNoteData::~ACLNoteData()
30 ACLNoteData::matchNotes(NotePairs
*note
)
35 debugs(28, 3, "Checking " << name
);
38 return (note
->findFirst(name
.termedBuf()) != NULL
);
40 for (std::vector
<NotePairs::Entry
*>::iterator i
= note
->entries
.begin(); i
!= note
->entries
.end(); ++i
) {
41 if ((*i
)->name
.cmp(name
.termedBuf()) == 0) {
42 if (values
->match((*i
)->value
.termedBuf()))
50 ACLNoteData::match(HttpRequest
*request
)
52 if (request
->notes
!= NULL
&& matchNotes(request
->notes
.getRaw()))
55 const Adaptation::History::Pointer ah
= request
->adaptLogHistory();
56 if (ah
!= NULL
&& ah
->metaHeaders
!= NULL
&& matchNotes(ah
->metaHeaders
.getRaw()))
63 ACLNoteData::dump() const
66 sl
.push_back(SBuf(name
));
67 // temp is needed until c++11 move constructor
68 SBufList temp
= values
->dump();
69 sl
.splice(sl
.end(), temp
);
76 char* t
= strtokFile();
83 ACLNoteData::empty() const
85 return name
.size() == 0;
88 ACLData
<HttpRequest
*> *
89 ACLNoteData::clone() const
91 ACLNoteData
* result
= new ACLNoteData
;
92 result
->values
= values
->clone();