]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
moved httpMakePublic(), httpMakePrivate(), and httpCacheNegatively()
authorwessels <>
Fri, 3 Mar 2006 03:46:02 +0000 (03:46 +0000)
committerwessels <>
Fri, 3 Mar 2006 03:46:02 +0000 (03:46 +0000)
from HttpStateData to StoreEntry class so that they can be used
outside of http.cc.

src/Store.h
src/http.cc
src/store.cc

index f4b4bd4ac3454178092683913a951c2368e2cd3e..0a91a6fc09d56a70783c98c9224f7a7a28b77544 100644 (file)
@@ -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);
 
index 05d53c647f255a0fdf2d3114daf32f28654ecfc6..2ce88d7d29b85952e2ffe24c5f98d9a5326f006d 100644 (file)
@@ -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;
 
index 5ebc39b2f2577e08cdb7ee0af0187d46de813369..824b2a4b792a9b9298d8696278828355b61ae189 100644 (file)
@@ -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()
 {