57 SwapMetaUnpacker(
const char *buf, ssize_t bufferLength,
size_t &swap_hdr_sz);
83 static unsigned int md5_mismatches = 0;
113 const auto &emem = entry.
mem();
118 const auto storedUrl =
static_cast<const char *
>(meta.
rawValue);
120 if (strcasecmp(emem.urlXXX(), storedUrl) != 0) {
135 static const SBuf nul(
"\0", 1);
136 rawVary.
trim(nul,
false,
true);
139 if (knownVary.isEmpty())
142 if (knownVary == rawVary)
155 const auto end = buf +
size;
177 fieldStart_(static_cast<const char*>(start)),
186 Assure(fieldStart_ != bufEnd_);
189 fieldStart_ += meta_.rawLength;
199 if (fieldStart_ == bufEnd_)
204 Assure(fieldStart_ < bufEnd_);
233 swap_hdr_sz = headerSize;
245 size_t swap_hdr_sz = 0;
248 for (
const auto &meta: metaFields) {
280 static_assert(offsetof(old_metahdr, flags) +
sizeof(old_metahdr::flags) ==
STORE_HDR_METASIZE_OLD,
"we reproduced old swap meta basics format");
281 auto basics =
static_cast<const old_metahdr*
>(meta.rawValue);
283 tmpe.
lastref = basics->lastref;
284 tmpe.
expires = basics->expires;
288 tmpe.
flags = basics->flags;
312 debugs(90, 7, entry <<
" buf len: " << len);
315 size_t swap_hdr_sz = 0;
319 for (
const auto &meta: metaFields) {
349 auto &emem = entry.
mem();
357 " (" << swap_hdr_sz <<
" + " << emem.object_sz <<
")");
360 emem.vary_headers = varyHeaders;
#define Assure(condition)
#define Assure2(condition, description)
#define Here()
source code location of the caller
constexpr bool Less(const A a, const B b)
whether integer a is less than integer b, with correct overflow handling
static std::ostream & Extra(std::ostream &)
char * content()
start of the added data
mb_size_t contentSize() const
available data size
const char * rawContent() const
size_type length() const
Returns the number of bytes stored in SBuf.
SBuf & trim(const SBuf &toRemove, bool atBeginning=true, bool atEnd=true)
void lastModified(const time_t when)
const char * getMD5Text() const
an std::runtime_error with thrower location info
#define debugs(SECTION, LEVEL, CONTENT)
#define EBIT_TEST(flag, bit)
#define SQUID_MD5_DIGEST_LENGTH
void * memrchr(const void *s, int c, size_t n)
const auto SwapMetaPrefixSize
The size of the initial (and required) portion of any swap metadata.
void SwapMetaExtract(Item &item, const char *&input, const void *end)
static void UnpackSwapMetaKey(const SwapMetaView &meta, cache_key *key)
deserializes STORE_META_KEY_MD5 swap meta field
size_t UnpackSwapMetaSize(const SBuf &)
void UnpackHitSwapMeta(char const *, ssize_t, StoreEntry &)
deserializes entry metadata from the given buffer into the cache hit entry
size_t UnpackIndexSwapMeta(const MemBuf &, StoreEntry &, cache_key *)
@ STORE_META_VARY_HEADERS
Stores Vary request headers.
static void CheckSwapMetaKey(const SwapMetaView &meta, const StoreEntry &entry)
validates serialized STORE_META_KEY_MD5 swap meta field
static SBuf UnpackNewSwapMetaVaryHeaders(const SwapMetaView &meta, const StoreEntry &entry)
deserializes STORE_META_VARY_HEADERS swap meta field
const char SwapMetaMagic
the start of the swap meta section
const auto STORE_HDR_METASIZE_OLD
static size_t UnpackPrefix(const char *const buf, const size_t size)
const auto STORE_HDR_METASIZE
static void CheckSwapMetaUrl(const SwapMetaView &meta, const StoreEntry &entry)
validates serialized STORE_META_URL swap meta field
int RawSwapMetaPrefixLength
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
unsigned char cache_key
Store key.