From ffcd6c5f1f2b92e169c6c13b88a7bd2d19f1eee8 Mon Sep 17 00:00:00 2001 From: Henrik Nordstrom Date: Wed, 28 Oct 2009 00:45:48 +0100 Subject: [PATCH] Forward-port of STORE_META_OBJSIZE swapout from squid-2 --- src/StoreMeta.h | 4 ---- src/store_swapmeta.cc | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/StoreMeta.h b/src/StoreMeta.h index 50f3fca36b..ffe12aea19 100644 --- a/src/StoreMeta.h +++ b/src/StoreMeta.h @@ -127,10 +127,6 @@ enum { */ STORE_META_STD_LFS, - /** - \deprecated - * Object size, not implemented, squid26 compatibility - */ STORE_META_OBJSIZE, STORE_META_STOREURL, /* the store url, if different to the normal URL */ diff --git a/src/store_swapmeta.cc b/src/store_swapmeta.cc index 1a7be1f587..77045253fe 100644 --- a/src/store_swapmeta.cc +++ b/src/store_swapmeta.cc @@ -61,6 +61,7 @@ storeSwapMetaBuild(StoreEntry * e) tlv **T = &TLV; const char *url; const char *vary; + const int64_t objsize = e->objectLen(); assert(e->mem_obj != NULL); assert(e->swap_status == SWAPOUT_WRITING); url = e->url(); @@ -88,6 +89,17 @@ storeSwapMetaBuild(StoreEntry * e) return NULL; } + + if (objsize >= 0) { + T = StoreMeta::Add(T, t); + t = StoreMeta::Factory(STORE_META_OBJSIZE, sizeof(objsize), &objsize); + + if (!t) { + storeSwapTLVFree(TLV); + return NULL; + } + } + T = StoreMeta::Add(T, t); vary = e->mem_obj->vary_headers; -- 2.47.3