]> git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreMetaVary.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / StoreMetaVary.cc
1 /*
2 * Copyright (C) 1996-2020 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 /* DEBUG: section 20 Storage Manager Swapfile Metadata */
10
11 #include "squid.h"
12 #include "MemObject.h"
13 #include "Store.h"
14 #include "StoreMetaVary.h"
15
16 bool
17 StoreMetaVary::checkConsistency(StoreEntry *e) const
18 {
19 assert (getType() == STORE_META_VARY_HEADERS);
20
21 if (e->mem_obj->vary_headers.isEmpty()) {
22 /* XXX separate this mutator from the query */
23 /* Assume the object is OK.. remember the vary request headers */
24 e->mem_obj->vary_headers.assign(static_cast<const char *>(value), length);
25 /* entries created before SBuf vary handling may include string terminator */
26 static const SBuf nul("\0", 1);
27 e->mem_obj->vary_headers.trim(nul);
28 return true;
29 }
30
31 if (e->mem_obj->vary_headers.cmp(static_cast<const char *>(value), length) != 0)
32 return false;
33
34 return true;
35 }
36