From: Alex Rousskov Date: Mon, 23 Dec 2013 05:26:23 +0000 (-0700) Subject: Bug 3806: Caching responses with Vary header X-Git-Tag: SQUID_3_5_0_1~444^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8a899c01051c27f2d46f5b9fcbcd27622f388ff;p=thirdparty%2Fsquid.git Bug 3806: Caching responses with Vary header 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. --- diff --git a/src/MemStore.cc b/src/MemStore.cc index 116ba0651a..623794ee23 100644 --- a/src/MemStore.cc +++ b/src/MemStore.cc @@ -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 diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index b3212f1d2e..6858407086 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -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; } diff --git a/src/store.cc b/src/store.cc index 683deff73e..3dcff35f79 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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");