]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not respond with HTTP/304 to unconditional requests
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Thu, 1 Jun 2017 23:49:09 +0000 (17:49 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 1 Jun 2017 23:49:09 +0000 (17:49 -0600)
... 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.

src/client_side_reply.cc
src/client_side_reply.h

index a367b5b67481db3d9ae68651cc6aa64d90e72410..767a43ac2530f628bf82b822765eb59b812e0266 100644 (file)
@@ -89,6 +89,7 @@ clientReplyContext::clientReplyContext(ClientHttpRequest *clientContext) :
     reply(NULL),
     old_entry(NULL),
     old_sc(NULL),
+    old_lastmod(-1),
     deleting(false),
     collapsedRevalidation(crNone)
 {
@@ -204,6 +205,8 @@ clientReplyContext::saveState()
     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 */
@@ -223,9 +226,13 @@ clientReplyContext::restoreState()
     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;
 }
index fee2425a977191f381dbe1ad60e0003444f4a9ee..62fb08e93d799afeefac31fd750f7f516b8350be 100644 (file)
@@ -131,7 +131,11 @@ private:
     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 {