------------------------------------------------------------ revno: 12670 revision-id: squid3@treenet.co.nz-20131215052323-ijocst9eqalo3mpw parent: squid3@treenet.co.nz-20131201065722-mpt32kk87okttvbb fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3806 author: Alex Rousskov committer: Amos Jeffries branch nick: 3.3 timestamp: Sat 2013-12-14 22:23:23 -0700 message: Bug 3806: Caching responses with Vary header Ported from 3.5 by Martin Sperl ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20131215052323-ijocst9eqalo3mpw # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: d77a0db770a8f901d3f1aaa21d7e399b7db75dc7 # timestamp: 2013-12-15 05:25:35 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20131201065722-\ # mpt32kk87okttvbb # # Begin patch === modified file 'src/MemStore.cc' --- src/MemStore.cc 2012-10-16 23:43:54 +0000 +++ src/MemStore.cc 2013-12-15 05:23:23 +0000 @@ -310,6 +310,12 @@ return; } + 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; + } + keep(e); // may still fail } === modified file 'src/client_side_reply.cc' --- src/client_side_reply.cc 2013-07-26 12:21:20 +0000 +++ src/client_side_reply.cc 2013-12-15 05:23:23 +0000 @@ -507,6 +507,7 @@ if (strcmp(e->mem_obj->url, urlCanonical(r)) != 0) { debugs(33, DBG_IMPORTANT, "clientProcessHit: URL mismatch, '" << e->mem_obj->url << "' != '" << urlCanonical(r) << "'"); + http->logType = LOG_TCP_MISS; // we lack a more precise LOG_*_MISS code processMiss(); return; } @@ -538,6 +539,7 @@ 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; } === modified file 'src/store.cc' --- src/store.cc 2013-07-26 12:21:20 +0000 +++ src/store.cc 2013-12-15 05:23:23 +0000 @@ -761,7 +761,7 @@ StoreEntry *pe = storeCreateEntry(mem_obj->url, mem_obj->log_url, request->flags, request->method); /* We are allowed to do this typecast */ HttpReply *rep = new HttpReply; - rep->setHeaders(HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000); + rep->setHeaders(HTTP_OK, "Internal marker object", "x-squid-internal/vary", 0, -1, squid_curtime + 100000); vary = mem_obj->getReply()->header.getList(HDR_VARY); if (vary.size()) { @@ -780,12 +780,14 @@ } #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();