------------------------------------------------------------ revno: 14170 revision-id: squid3@treenet.co.nz-20170614215906-ly36sobvlr2pt0u6 parent: squid3@treenet.co.nz-20170614213720-3qmiohlx4zr2jnqq fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=2833 author: Eduard Bagdasaryan committer: Amos Jeffries branch nick: 3.5 timestamp: Thu 2017-06-15 09:59:06 +1200 message: Bug 2833 pt3: Do not respond with HTTP/304 to unconditional requests ... after internal revalidation. The original unconditional HttpRequest was still marked (and processed) as conditional after internal revalidation because the original (clear) Last-Modified and ETag values were not restored (cleared) after the internal revalidation abused them. TODO: Isolate the code converting the request into conditional one _and_ the code that undoes that conversion, to keep both actions in sync. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20170614215906-ly36sobvlr2pt0u6 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 0991e2d39b3bcebcf18cba3db0e3b57aabf23b8b # timestamp: 2017-06-14 22:22:43 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20170614213720-\ # 3qmiohlx4zr2jnqq # # Begin patch === modified file 'src/client_side_reply.cc' --- src/client_side_reply.cc 2017-06-14 21:37:20 +0000 +++ src/client_side_reply.cc 2017-06-14 21:59:06 +0000 @@ -72,8 +72,8 @@ HTTPMSGUNLOCK(reply); } -clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) : http (cbdataReference(clientContext)), old_entry (NULL), old_sc(NULL), deleting(false), - collapsedRevalidation(crNone) +clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) : http (cbdataReference(clientContext)), old_entry (NULL), + old_sc(NULL), old_lastmod(-1), deleting(false), collapsedRevalidation(crNone) {} /** Create an error in the store awaiting the client side to read it. @@ -185,6 +185,8 @@ debugs(88, 3, "clientReplyContext::saveState: saving store context"); old_entry = http->storeEntry(); old_sc = sc; + old_lastmod = http->request->lastmod; + old_etag = http->request->etag; old_reqsize = reqsize; tempBuffer.offset = reqofs; /* Prevent accessing the now saved entries */ @@ -204,9 +206,13 @@ sc = old_sc; reqsize = old_reqsize; reqofs = tempBuffer.offset; + http->request->lastmod = old_lastmod; + http->request->etag = old_etag; /* Prevent accessed the old saved entries */ old_entry = NULL; old_sc = NULL; + old_lastmod = -1; + old_etag.clean(); old_reqsize = 0; tempBuffer.offset = 0; } === modified file 'src/client_side_reply.h' --- src/client_side_reply.h 2017-01-01 00:16:45 +0000 +++ src/client_side_reply.h 2017-06-14 21:59:06 +0000 @@ -130,7 +130,11 @@ void sendNotModifiedOrPreconditionFailedError(); StoreEntry *old_entry; - store_client *old_sc; /* ... for entry to be validated */ + /* ... for entry to be validated */ + store_client *old_sc; + time_t old_lastmod; + String old_etag; + bool deleting; typedef enum {