[squid-users] Caching Google Chrome googlechromestandaloneenterprise64.msi

Amos Jeffries squid3 at treenet.co.nz
Mon Oct 24 10:51:16 UTC 2016


On 24/10/2016 9:59 p.m., Garri Djavadyan wrote:
> Hi Amos,
> 
> Thank you very much for so detailed explanation. I've made conclusions
> from presented information. I deeply regret, that the topic took so
> many time from you. I believe, information presented here will be
> helpful for the community.
> 
> Nevertheless, the topic surfaced new details regarding the Vary and I
> tried conditional requests on same URL (Google Chrome) from different
> machines/IPs. Here results:
> 
> $ curl --head --header "If-Modified-Since: Thu, 22 Oct 2016 08:29:09
> GMT" https://dl.google.com/linux/direct/google-chrome-stable_current_am
> d64.deb
> HTTP/1.1 304 Not Modified
> Etag: "101395"
> Server: downloads
> Vary: *
> X-Content-Type-Options: nosniff
> X-Frame-Options: SAMEORIGIN
> X-Xss-Protection: 1; mode=block
> Date: Mon, 24 Oct 2016 08:53:44 GMT
> Alt-Svc: quic=":443"; ma=2592000; v="36,35,34"
> 
> ----
> 
> $ curl --head --header 'If-None-Match: "101395"' https://dl.google.com/
> linux/direct/google-chrome-stable_current_amd64.deb 
> HTTP/1.1 304 Not Modified
> Etag: "101395"
> Last-Modified: Thu, 20 Oct 2016 08:29:09 GMT
> Server: downloads
> Vary: *
> X-Content-Type-Options: nosniff
> X-Frame-Options: SAMEORIGIN
> X-Xss-Protection: 1; mode=block
> Date: Mon, 24 Oct 2016 08:54:18 GMT
> Alt-Svc: quic=":443"; ma=2592000; v="36,35,34"
> 

Sweet! Far better than I was expecting. That means this patch should work:

=== modified file 'src/http.cc'
--- src/http.cc 2016-10-08 22:19:44 +0000
+++ src/http.cc 2016-10-24 10:50:16 +0000
@@ -593,7 +593,7 @@
     while (strListGetItem(&vary, ',', &item, &ilen, &pos)) {
         SBuf name(item, ilen);
         if (name == asterisk) {
-            vstr.clear();
+            vstr = asterisk;
             break;
         }
         name.toLower();
@@ -947,6 +947,12 @@
             varyFailure = true;
         } else {
             entry->mem_obj->vary_headers = vary;
+
+            // RFC 7231 section 7.1.4
+            // Vary:* can be cached, but has mandatory revalidation
+            static const SBuf asterisk("*");
+            if (vary == asterisk)
+                EBIT_SET(entry->flags, ENTRY_REVALIDATE_ALWAYS);
         }
     }


Amos



More information about the squid-users mailing list