The Key: header being proposed for standardization replaces and extends the Vary header to provide more fine-grained variant selection by caches.

The attached patch add the Key: header on Squid generated error pages so that any receiving clients which support the new header are able to use it for handling our error pages.

This also serves as a implementation example for how origin servers can easily implement Key headers alongside Vary headers during the upgrade transition period. see http://tools.ietf.org/html/draft-fielding-http-key-02 for the current specification.

Amos

=== modified file 'src/errorpage.cc'
--- src/errorpage.cc    2013-03-17 12:19:16 +0000
+++ src/errorpage.cc    2013-03-20 23:31:40 +0000
@@ -1199,8 +1199,18 @@
          */
         if (!Config.errorDirectory) {
             /* We 'negotiated' this ONLY from the Accept-Language. */
+            String tmp = "Accept-Language";
+
+            // Vary:Accept-Language
             rep->header.delById(HDR_VARY);
-            rep->header.putStr(HDR_VARY, "Accept-Language");
+            rep->header.putStr(HDR_VARY,tmp.termedBuf());
+
+            // Key:Accept-Language;b="foo"
+            tmp.append(";b=\"");
+            tmp.append(err_language);
+            tmp.append('"');
+            rep->header.delById(HDR_KEY);
+            rep->header.putStr(HDR_KEY, tmp.termedBuf());
         }
 
         /* add the Content-Language header according to RFC section 14.12 */

Reply via email to