]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Added httpMaybeRemovePublic() to purge public objects for
authorwessels <>
Fri, 21 Aug 1998 04:21:02 +0000 (04:21 +0000)
committerwessels <>
Fri, 21 Aug 1998 04:21:02 +0000 (04:21 +0000)
          certain responses even though they are uncachable.  This is
          needed, for example, when an initially cachable object
          later becomes uncachable.

ChangeLog
src/http.cc

index 1556ffef8335ccd0f4825713b7c26912cd2f657e..e3725ee2cb7a3f739eca9df5b930cdb7112e0a0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
          temporary disk_ctrl_t structures.
        - Changed ENOSPC disk write errors to reduce specific cache_dir
          sizes, and not just the size of the cache as a whole.
+       - Added httpMaybeRemovePublic() to purge public objects for
+         certain responses even though they are uncachable.  This is
+         needed, for example, when an initially cachable object
+         later becomes uncachable.
 
 Changes to squid-1.2.beta23 (June 22, 1998):
 
index 0941c0e02686af80d2d35a51521f18bbce29e32e..1fc8adfa6937cf3d01ef6b2ae1611998313edfdd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.309 1998/08/19 06:05:53 wessels Exp $
+ * $Id: http.cc,v 1.310 1998/08/20 22:21:02 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -54,6 +54,7 @@ static void httpCacheNegatively(StoreEntry *);
 static void httpMakePrivate(StoreEntry *);
 static void httpMakePublic(StoreEntry *);
 static int httpCachableReply(HttpStateData *);
+static void httpMaybeRemovePublic(StoreEntry *, http_status);
 
 static void
 httpStateFree(int fdnotused, void *data)
@@ -127,6 +128,42 @@ httpCacheNegatively(StoreEntry * entry)
        storeSetPublicKey(entry);
 }
 
+static void
+httpMaybeRemovePublic(StoreEntry * e, http_status status)
+{
+    int remove = 0;
+    const cache_key *key;
+    StoreEntry *pe;
+    switch (status) {
+    case HTTP_OK:
+    case HTTP_NON_AUTHORITATIVE_INFORMATION:
+    case HTTP_MULTIPLE_CHOICES:
+    case HTTP_MOVED_PERMANENTLY:
+    case HTTP_MOVED_TEMPORARILY:
+    case HTTP_FORBIDDEN:
+    case HTTP_NOT_FOUND:
+    case HTTP_METHOD_NOT_ALLOWED:
+    case HTTP_GONE:
+       remove = 1;
+       break;
+#if WORK_IN_PROGRESS
+       case HTTP_UNAUTHORIZED
+           remove = 1;
+       break;
+#endif
+    default:
+       remove = 0;
+       break;
+    }
+    if (!remove)
+       return;
+    assert(e->mem_obj);
+    key = storeKeyPublic(e->mem_obj->url, e->mem_obj->method);
+    if ((pe = storeGet(key)) == NULL)
+       return;
+    storeRelease(pe);
+}
+
 static int
 httpCachableReply(HttpStateData * httpState)
 {
@@ -261,6 +298,7 @@ httpProcessReplyHeader(HttpStateData * httpState, const char *buf, int size)
        storeTimestampsSet(entry);
        /* Check if object is cacheable or not based on reply code */
        debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", reply->sline.status);
+       httpMaybeRemovePublic(entry, reply->sline.status);
        switch (httpCachableReply(httpState)) {
        case 1:
            httpMakePublic(entry);