From: Amos Jeffries Date: Mon, 25 May 2015 14:02:29 +0000 (-0700) Subject: Use StoreEntry Packable API directly without class Packer wrapper X-Git-Tag: merge-candidate-3-v1~101^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=151799849980ace0dad5371b681a509702da2395;p=thirdparty%2Fsquid.git Use StoreEntry Packable API directly without class Packer wrapper --- diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 95d6dd649b..a39ac7079f 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -365,10 +365,9 @@ HttpRequest::parseHeader(Http1::RequestParser &hp) void HttpRequest::swapOut(StoreEntry * e) { - Packer p; assert(e); - packerToStoreInit(&p, e); - pack(&p); + e->buffer(); + pack(e); } /* packs request-line and headers, appends terminator */ diff --git a/src/Store.h b/src/Store.h index 1464639b68..dabbcee225 100644 --- a/src/Store.h +++ b/src/Store.h @@ -31,7 +31,6 @@ class AsyncCall; class HttpRequest; -class Packer; class RequestFlags; class StoreClient; class StoreSearch; @@ -497,12 +496,6 @@ void storeReplAdd(const char *, REMOVALPOLICYCREATE *); /// \ingroup StoreAPI extern FREE destroyStoreEntry; -/** - \ingroup StoreAPI - \todo should be a subclass of Packer perhaps ? - */ -void packerToStoreInit(Packer * p, StoreEntry * e); - /// \ingroup StoreAPI void storeGetMemSpace(int size); diff --git a/src/store.cc b/src/store.cc index 112f454776..55a54f4d05 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1918,12 +1918,9 @@ StoreEntry::replaceHttpReply(HttpReply *rep, bool andStartWriting) void StoreEntry::startWriting() { - Packer p; - /* TODO: when we store headers serparately remove the header portion */ /* TODO: mark the length of the headers ? */ /* We ONLY want the headers */ - packerToStoreInit(&p, this); assert (isEmpty()); assert(mem_obj); @@ -1931,11 +1928,12 @@ StoreEntry::startWriting() const HttpReply *rep = getReply(); assert(rep); - rep->packHeadersInto(&p); + buffer(); + rep->packHeadersInto(this); mem_obj->markEndOfReplyHeaders(); EBIT_CLR(flags, ENTRY_FWD_HDR_WAIT); - rep->body.packInto(&p); + rep->body.packInto(this); } char const * diff --git a/src/tests/testRock.cc b/src/tests/testRock.cc index c841c0c913..3e2c0ab33e 100644 --- a/src/tests/testRock.cc +++ b/src/tests/testRock.cc @@ -14,7 +14,6 @@ #include "HttpHeader.h" #include "HttpReply.h" #include "MemObject.h" -#include "Packer.h" #include "RequestFlags.h" #include "SquidConfig.h" #include "Store.h" @@ -202,13 +201,7 @@ testRock::addEntry(const int i) StoreEntry *const pe = createEntry(i); pe->buffer(); - /* TODO: remove this when the metadata is separated */ - { - Packer p; - packerToStoreInit(&p, pe); - pe->getReply()->packHeadersInto(&p); - } - + pe->getReply()->packHeadersInto(pe); pe->flush(); pe->timestampsSet(); pe->complete(); diff --git a/src/tests/testUfs.cc b/src/tests/testUfs.cc index 35698e27e4..3665531d4e 100644 --- a/src/tests/testUfs.cc +++ b/src/tests/testUfs.cc @@ -13,7 +13,6 @@ #include "HttpHeader.h" #include "HttpReply.h" #include "MemObject.h" -#include "Packer.h" #include "RequestFlags.h" #include "SquidConfig.h" #include "Store.h" @@ -153,13 +152,7 @@ testUfs::testUfsSearch() pe->setPublicKey(); pe->buffer(); - /* TODO: remove this when the metadata is separated */ - { - Packer p; - packerToStoreInit(&p, pe); - pe->getReply()->packHeadersInto(&p); - } - + pe->getReply()->packHeadersInto(pe); pe->flush(); pe->timestampsSet(); pe->complete();