From: wessels <> Date: Fri, 3 Mar 2006 03:46:02 +0000 (+0000) Subject: moved httpMakePublic(), httpMakePrivate(), and httpCacheNegatively() X-Git-Tag: SQUID_3_0_PRE4~305 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ed72359ef72dd6be4bd98490a9aeacfd335a45e;p=thirdparty%2Fsquid.git moved httpMakePublic(), httpMakePrivate(), and httpCacheNegatively() from HttpStateData to StoreEntry class so that they can be used outside of http.cc. --- diff --git a/src/Store.h b/src/Store.h index f4b4bd4ac3..0a91a6fc09 100644 --- a/src/Store.h +++ b/src/Store.h @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.17 2006/01/23 20:04:24 wessels Exp $ + * $Id: Store.h,v 1.18 2006/03/02 20:46:03 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -75,6 +75,9 @@ public: virtual bool swapoutPossible(); virtual void trimMemory(); void unlink(); + void makePublic(); + void makePrivate(); + void cacheNegatively(); void delayAwareRead(int fd, char *buf, int len, IOCB *handler, void *data); diff --git a/src/http.cc b/src/http.cc index 05d53c647f..2ce88d7d29 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.488 2006/02/21 23:52:08 wessels Exp $ + * $Id: http.cc,v 1.489 2006/03/02 20:46:03 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -64,9 +64,6 @@ static const char *const crlf = "\r\n"; static PF httpStateFree; static PF httpTimeout; -static void httpCacheNegatively(StoreEntry *); -static void httpMakePrivate(StoreEntry *); -static void httpMakePublic(StoreEntry *); static void httpMaybeRemovePublic(StoreEntry *, http_status); static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags); @@ -197,33 +194,6 @@ httpTimeout(int fd, void *data) comm_close(fd); } -/* This object can be cached for a long time */ -static void -httpMakePublic(StoreEntry * entry) -{ - if (EBIT_TEST(entry->flags, ENTRY_CACHABLE)) - storeSetPublicKey(entry); -} - -/* This object should never be cached at all */ -static void -httpMakePrivate(StoreEntry * entry) -{ - storeExpireNow(entry); - storeReleaseRequest(entry); /* delete object when not used */ - /* storeReleaseRequest clears ENTRY_CACHABLE flag */ -} - -/* This object may be negatively cached */ -static void -httpCacheNegatively(StoreEntry * entry) -{ - storeNegativeCache(entry); - - if (EBIT_TEST(entry->flags, ENTRY_CACHABLE)) - storeSetPublicKey(entry); -} - static void httpMaybeRemovePublic(StoreEntry * e, http_status status) { @@ -377,7 +347,7 @@ HttpStateData::processSurrogateControl(HttpReply *reply) (Config.onoff.surrogate_is_remote && EBIT_TEST(sctusable->mask, SC_NO_STORE_REMOTE))) { surrogateNoStore = true; - httpMakePrivate(entry); + entry->makePrivate(); } /* The HttpHeader logic cannot tell if the header it's parsing is a reply to an @@ -846,7 +816,7 @@ HttpStateData::haveParsedReplyHeaders() const char *vary = httpMakeVaryMark(orig_request, getReply()); if (!vary) { - httpMakePrivate(entry); + entry->makePrivate(); goto no_cache; } @@ -868,19 +838,19 @@ HttpStateData::haveParsedReplyHeaders() switch (cacheableReply()) { case 1: - httpMakePublic(entry); + entry->makePublic(); break; case 0: - httpMakePrivate(entry); + entry->makePrivate(); break; case -1: if (Config.negativeTtl > 0) - httpCacheNegatively(entry); + entry->cacheNegatively(); else - httpMakePrivate(entry); + entry->makePrivate(); break; diff --git a/src/store.cc b/src/store.cc index 5ebc39b2f2..824b2a4b79 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.584 2006/02/17 20:15:35 wessels Exp $ + * $Id: store.cc,v 1.585 2006/03/02 20:46:02 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -167,6 +167,34 @@ StoreEntry::operator delete (void *address) pool->free(address); } +void +StoreEntry::makePublic() +{ + /* This object can be cached for a long time */ + + if (EBIT_TEST(flags, ENTRY_CACHABLE)) + storeSetPublicKey(this); +} + +void +StoreEntry::makePrivate() +{ + /* This object should never be cached at all */ + storeExpireNow(this); + storeReleaseRequest(this); /* delete object when not used */ + /* storeReleaseRequest clears ENTRY_CACHABLE flag */ +} + +void +StoreEntry::cacheNegatively() +{ + /* This object may be negatively cached */ + storeNegativeCache(this); + + if (EBIT_TEST(flags, ENTRY_CACHABLE)) + storeSetPublicKey(this); +} + size_t StoreEntry::inUseCount() {