From: Henrik Nordstrom Date: Tue, 27 Oct 2009 23:45:48 +0000 (+0100) Subject: Forward-port of STORE_META_OBJSIZE swapout from squid-2 X-Git-Tag: SQUID_3_2_0_1~645 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ffcd6c5f1f2b92e169c6c13b88a7bd2d19f1eee8;p=thirdparty%2Fsquid.git Forward-port of STORE_META_OBJSIZE swapout from squid-2 --- 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;