]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3806: Caching responses with Vary header
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 23 Dec 2013 05:26:23 +0000 (22:26 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 23 Dec 2013 05:26:23 +0000 (22:26 -0700)
Various fixes making Vary caching work better.
More work is needed to re-enable shared memory caching of Vary responses.

bag5s r12741: Do not start storing the vary marker object until its key becomes public.
bag5s r12742: Log failed (due to "Vary object loop" or "URL mismatch") hits as TCP_MISSes.
bag5s r12743: Refuse to cache Vary-controlled objects in shared memory (for now).

Based on trunk r13179.

src/MemStore.cc
src/client_side_reply.cc
src/store.cc

index 116ba0651a96c45e07c97d25515d65b5343a11d1..623794ee23e2e226e1904be8d0d9aaa0386b1235 100644 (file)
@@ -430,6 +430,13 @@ MemStore::shouldCache(const StoreEntry &e) const
     }
 
     assert(e.mem_obj);
+
+    if (e.mem_obj->vary_headers) {
+        // XXX: We must store/load SerialisedMetaData to cache Vary in RAM
+        debugs(20, 5, "Vary not yet supported: " << e.mem_obj->vary_headers);
+        return false;
+    }
+
     const int64_t expectedSize = e.mem_obj->expectedReplySize(); // may be < 0
 
     // objects of unknown size are not allowed into memory cache, for now
index b3212f1d2ed7eaa3cf4b51f6b7609c3a25bf7ced..68584070868fbdf71d535623a54449d4467bae8b 100644 (file)
@@ -487,6 +487,7 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
 
     if (strcmp(e->mem_obj->storeId(), http->request->storeId()) != 0) {
         debugs(33, DBG_IMPORTANT, "clientProcessHit: URL mismatch, '" << e->mem_obj->storeId() << "' != '" << http->request->storeId() << "'");
+        http->logType = LOG_TCP_MISS; // we lack a more precise LOG_*_MISS code
         processMiss();
         return;
     }
@@ -518,6 +519,7 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
     case VARY_CANCEL:
         /* varyEvaluateMatch found a object loop. Process as miss */
         debugs(88, DBG_IMPORTANT, "clientProcessHit: Vary object loop!");
+        http->logType = LOG_TCP_MISS; // we lack a more precise LOG_*_MISS code
         processMiss();
         return;
     }
index 683deff73e1b005811aa11994a15feca83d6c6f5..3dcff35f795f4fa13fa2bbdcfa045a38e65424bc 100644 (file)
@@ -754,12 +754,14 @@ StoreEntry::setPublicKey()
             }
 
 #endif
-            pe->replaceHttpReply(rep);
+            pe->replaceHttpReply(rep, false); // no write until key is public
 
             pe->timestampsSet();
 
             pe->makePublic();
 
+            pe->startWriting(); // after makePublic()
+
             pe->complete();
 
             pe->unlock("StoreEntry::setPublicKey+Vary");