]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2833 pt3: Do not respond with HTTP/304 to unconditional requests
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Wed, 14 Jun 2017 21:59:06 +0000 (09:59 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 14 Jun 2017 21:59:06 +0000 (09:59 +1200)
... 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 ac712b5de00639eb74bc9100ff35ea3e3766a49d..06ae1c45e6f1526c85a2c85a966a117d474ecec6 100644 (file)
@@ -72,8 +72,8 @@ clientReplyContext::~clientReplyContext()
     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 @@ 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 */
@@ -204,9 +206,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 b380360f8851fdf4a99f22dae609b1929fc8d914..7e770388ea73a555efcd403a6c04272835df2767 100644 (file)
@@ -130,7 +130,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 {