Revision: 46354
Author:   mark
Date:     2009-01-27 16:39:16 +0000 (Tue, 27 Jan 2009)

Log Message:
-----------
Updated Tim Starling's X-Vary-Options patch to Squid 2.7.5

Modified Paths:
--------------
    trunk/debs/squid/debian/patches/26-vary_options.dpatch

Modified: trunk/debs/squid/debian/patches/26-vary_options.dpatch
===================================================================
--- trunk/debs/squid/debian/patches/26-vary_options.dpatch      2009-01-27 
16:17:38 UTC (rev 46353)
+++ trunk/debs/squid/debian/patches/26-vary_options.dpatch      2009-01-27 
16:39:16 UTC (rev 46354)
@@ -6,10 +6,10 @@
 ## DP: Adds support for the X-Vary-Options response header
 
 @DPATCH@
-diff -Xdiffx -ru squid-2.6.18.orig/configure.in squid-2.6.18/configure.in
---- squid-2.6.18.orig/configure.in     2008-01-10 23:34:23.000000000 +1100
-+++ squid-2.6.18/configure.in  2008-02-07 19:43:23.000000000 +1100
-@@ -1507,6 +1507,16 @@
+diff -urNad squid-2.7.5~/configure.in squid-2.7.5/configure.in
+--- squid-2.7.5~/configure.in  2009-01-27 16:20:36.000000000 +0000
++++ squid-2.7.5/configure.in   2009-01-27 16:34:13.000000000 +0000
+@@ -1533,6 +1533,16 @@
    fi
  ])
  
@@ -25,23 +25,120 @@
 +
  AC_ARG_ENABLE(follow-x-forwarded-for,
  [  --enable-follow-x-forwarded-for
-                          Enable support for following the X-Forwarded-For
-diff -Xdiffx -ru squid-2.6.18.orig/src/client_side.c 
squid-2.6.18/src/client_side.c
---- squid-2.6.18.orig/src/client_side.c        2008-02-07 19:28:38.000000000 
+1100
-+++ squid-2.6.18/src/client_side.c     2008-02-08 14:39:38.000000000 +1100
-@@ -735,10 +735,7 @@
+                         Enable support for following the X-Forwarded-For
+diff -urNad squid-2.7.5~/src/HttpHeader.c squid-2.7.5/src/HttpHeader.c
+--- squid-2.7.5~/src/HttpHeader.c      2009-01-27 16:20:36.000000000 +0000
++++ squid-2.7.5/src/HttpHeader.c       2009-01-27 16:34:13.000000000 +0000
+@@ -134,6 +134,9 @@
+ #if X_ACCELERATOR_VARY
+     {"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr},
+ #endif
++#if VARY_OPTIONS
++    {"X-Vary-Options", HDR_X_VARY_OPTIONS, ftStr},
++#endif
+     {"X-Error-URL", HDR_X_ERROR_URL, ftStr},
+     {"X-Error-Status", HDR_X_ERROR_STATUS, ftInt},
+     {"Front-End-Https", HDR_FRONT_END_HTTPS, ftStr},
+@@ -211,6 +214,9 @@
+ #if X_ACCELERATOR_VARY
+     HDR_X_ACCELERATOR_VARY,
+ #endif
++#if VARY_OPTIONS
++    HDR_X_VARY_OPTIONS,
++#endif
+     HDR_X_SQUID_ERROR
+ };
+ 
+@@ -1199,6 +1205,54 @@
+     return tot;
+ }
+ 
++/* Get the combined Vary headers as a String 
++ * Returns StringNull if there are no vary headers
++ */
++String httpHeaderGetVary(const HttpHeader * hdr)
++{
++    String hdrString = StringNull;
++#if VARY_OPTIONS
++    HttpHeaderEntry *e;
++    if ((e = httpHeaderFindEntry(hdr, HDR_X_VARY_OPTIONS))) {
++      stringInit(&hdrString, strBuf(e->value));
++      return hdrString;
++    }
++#endif
++    
++    hdrString = httpHeaderGetList(hdr, HDR_VARY);
++#if X_ACCELERATOR_VARY
++    {
++      String xavString = StringNull;
++      xavString = httpHeaderGetList(hdr, HDR_X_ACCELERATOR_VARY);
++      if (strBuf(xavString))
++          strListAdd(&hdrString, strBuf(xavString), ',');
++      stringClean(&xavString);
++    }
++#endif
++    return hdrString;
++}
++
++/*
++ * Returns TRUE if at least one of the vary headers are present 
++ */
++int httpHeaderHasVary(const HttpHeader * hdr)
++{
++#if VARY_OPTIONS
++    if (httpHeaderHas(hdr, HDR_X_VARY_OPTIONS)) {
++      return TRUE;
++    }
++#endif
++#if X_ACCELERATOR_VARY
++    if (httpHeaderHas(hdr, HDR_X_ACCELERATOR_VARY)) {
++      return TRUE;
++    }
++#endif
++    if (httpHeaderHas(hdr, HDR_VARY)) {
++      return TRUE;
++    }
++    return FALSE;
++}
++
+ /*
+  * HttpHeaderEntry
+  */
+@@ -1475,3 +1529,5 @@
+     assert(id >= 0 && id < HDR_ENUM_END);
+     return strBuf(Headers[id].name);
+ }
++
++
+diff -urNad squid-2.7.5~/src/HttpReply.c squid-2.7.5/src/HttpReply.c
+--- squid-2.7.5~/src/HttpReply.c       2009-01-27 16:20:36.000000000 +0000
++++ squid-2.7.5/src/HttpReply.c        2009-01-27 16:34:13.000000000 +0000
+@@ -315,8 +315,7 @@
+               return squid_curtime;
+       }
+     }
+-    if (Config.onoff.vary_ignore_expire &&
+-      httpHeaderHas(&rep->header, HDR_VARY)) {
++    if (Config.onoff.vary_ignore_expire && httpHeaderHasVary(&rep->header)) {
+       const time_t d = httpHeaderGetTime(&rep->header, HDR_DATE);
+       const time_t e = httpHeaderGetTime(&rep->header, HDR_EXPIRES);
+       if (d == e)
+diff -urNad squid-2.7.5~/src/client_side.c squid-2.7.5/src/client_side.c
+--- squid-2.7.5~/src/client_side.c     2009-01-27 16:34:13.000000000 +0000
++++ squid-2.7.5/src/client_side.c      2009-01-27 16:34:13.000000000 +0000
+@@ -643,10 +643,7 @@
            request_t *request = http->request;
-           const char *etag = httpHeaderGetStr(&mem->reply->header, HDR_ETAG);
+           const char *etag = httpHeaderGetStr(&rep->header, HDR_ETAG);
            const char *vary = request->vary_headers;
--          int has_vary = httpHeaderHas(&entry->mem_obj->reply->header, 
HDR_VARY);
+-          int has_vary = httpHeaderHas(&rep->header, HDR_VARY);
 -#if X_ACCELERATOR_VARY
--          has_vary |= httpHeaderHas(&entry->mem_obj->reply->header, 
HDR_X_ACCELERATOR_VARY);
+-          has_vary |= httpHeaderHas(&rep->header, HDR_X_ACCELERATOR_VARY);
 -#endif
 +          int has_vary = httpHeaderHasVary(&entry->mem_obj->reply->header);
            if (has_vary)
-               vary = httpMakeVaryMark(request, mem->reply);
+               vary = httpMakeVaryMark(request, rep);
  
-@@ -4948,10 +4945,7 @@
+@@ -5075,10 +5072,7 @@
  varyEvaluateMatch(StoreEntry * entry, request_t * request)
  {
      const char *vary = request->vary_headers;
@@ -53,13 +150,13 @@
      if (!has_vary || !entry->mem_obj->vary_headers) {
        if (vary) {
            /* Oops... something odd is going on here.. */
-diff -Xdiffx -ru squid-2.6.18.orig/src/defines.h squid-2.6.18/src/defines.h
---- squid-2.6.18.orig/src/defines.h    2008-02-07 19:28:37.000000000 +1100
-+++ squid-2.6.18/src/defines.h 2008-02-07 22:05:02.000000000 +1100
-@@ -364,4 +364,10 @@
- #define       DLINK_ISEMPTY(n)        ( (n).head == NULL )
- #define       DLINK_HEAD(n)           ( (n).head->data )
+diff -urNad squid-2.7.5~/src/defines.h squid-2.7.5/src/defines.h
+--- squid-2.7.5~/src/defines.h 2009-01-27 16:34:13.000000000 +0000
++++ squid-2.7.5/src/defines.h  2009-01-27 16:34:13.000000000 +0000
+@@ -366,4 +366,10 @@
  
+ #define       LOGFILE_SEQNO(n)        ( (n)->sequence_number )
+ 
 +
 +/* Hack to avoid re-running autoconf/automake -- TS */
 +#ifndef VARY_OPTIONS
@@ -67,10 +164,10 @@
 +#endif
 +
  #endif /* SQUID_DEFINES_H */
-diff -Xdiffx -ru squid-2.6.18.orig/src/enums.h squid-2.6.18/src/enums.h
---- squid-2.6.18.orig/src/enums.h      2008-02-07 19:28:38.000000000 +1100
-+++ squid-2.6.18/src/enums.h   2008-02-07 21:35:18.000000000 +1100
-@@ -256,6 +256,9 @@
+diff -urNad squid-2.7.5~/src/enums.h squid-2.7.5/src/enums.h
+--- squid-2.7.5~/src/enums.h   2009-01-27 16:34:13.000000000 +0000
++++ squid-2.7.5/src/enums.h    2009-01-27 16:34:13.000000000 +0000
+@@ -259,6 +259,9 @@
  #if X_ACCELERATOR_VARY
      HDR_X_ACCELERATOR_VARY,
  #endif
@@ -79,11 +176,11 @@
 +#endif
      HDR_X_ERROR_URL,          /* errormap, requested URL */
      HDR_X_ERROR_STATUS,               /* errormap, received HTTP status line 
*/
-     HDR_FRONT_END_HTTPS,
-diff -Xdiffx -ru squid-2.6.18.orig/src/http.c squid-2.6.18/src/http.c
---- squid-2.6.18.orig/src/http.c       2008-02-07 19:28:38.000000000 +1100
-+++ squid-2.6.18/src/http.c    2008-02-08 14:48:44.000000000 +1100
-@@ -353,20 +353,29 @@
+     HDR_X_HTTP09_FIRST_LINE,  /* internal, first line of HTTP/0.9 response */
+diff -urNad squid-2.7.5~/src/http.c squid-2.7.5/src/http.c
+--- squid-2.7.5~/src/http.c    2009-01-27 16:34:13.000000000 +0000
++++ squid-2.7.5/src/http.c     2009-01-27 16:34:13.000000000 +0000
+@@ -355,20 +355,29 @@
      String vstr = StringNull;
  
      stringClean(&vstr);
@@ -126,7 +223,7 @@
        if (strcmp(name, "accept-encoding") == 0) {
            aclCheck_t checklist;
            memset(&checklist, 0, sizeof(checklist));
-@@ -381,22 +390,76 @@
+@@ -383,22 +392,76 @@
        if (strcmp(name, "*") == 0) {
            /* Can not handle "Vary: *" efficiently, bail out making the 
response not cached */
            safe_free(name);
@@ -211,7 +308,7 @@
      safe_free(request->vary_hdr);
      safe_free(request->vary_headers);
      if (strBuf(vary) && strBuf(vstr)) {
-@@ -514,11 +577,7 @@
+@@ -539,11 +602,7 @@
        /* non-chunked. Handle as one single big chunk (-1 if terminated by 
EOF) */
        httpState->chunk_size = 
httpReplyBodySize(httpState->orig_request->method, reply);
      }
@@ -224,107 +321,10 @@
        const char *vary = NULL;
        if (Config.onoff.cache_vary)
            vary = httpMakeVaryMark(httpState->orig_request, reply);
-diff -Xdiffx -ru squid-2.6.18.orig/src/HttpHeader.c 
squid-2.6.18/src/HttpHeader.c
---- squid-2.6.18.orig/src/HttpHeader.c 2007-12-21 20:56:53.000000000 +1100
-+++ squid-2.6.18/src/HttpHeader.c      2008-02-08 14:49:24.000000000 +1100
-@@ -133,6 +133,9 @@
- #if X_ACCELERATOR_VARY
-     {"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr},
- #endif
-+#if VARY_OPTIONS
-+    {"X-Vary-Options", HDR_X_VARY_OPTIONS, ftStr},
-+#endif
-     {"X-Error-URL", HDR_X_ERROR_URL, ftStr},
-     {"X-Error-Status", HDR_X_ERROR_STATUS, ftInt},
-     {"Front-End-Https", HDR_FRONT_END_HTTPS, ftStr},
-@@ -210,6 +213,9 @@
- #if X_ACCELERATOR_VARY
-     HDR_X_ACCELERATOR_VARY,
- #endif
-+#if VARY_OPTIONS
-+    HDR_X_VARY_OPTIONS,
-+#endif
-     HDR_X_SQUID_ERROR
- };
- 
-@@ -1185,6 +1191,54 @@
-     return tot;
- }
- 
-+/* Get the combined Vary headers as a String 
-+ * Returns StringNull if there are no vary headers
-+ */
-+String httpHeaderGetVary(const HttpHeader * hdr)
-+{
-+    String hdrString = StringNull;
-+#if VARY_OPTIONS
-+    HttpHeaderEntry *e;
-+    if ((e = httpHeaderFindEntry(hdr, HDR_X_VARY_OPTIONS))) {
-+      stringInit(&hdrString, strBuf(e->value));
-+      return hdrString;
-+    }
-+#endif
-+    
-+    hdrString = httpHeaderGetList(hdr, HDR_VARY);
-+#if X_ACCELERATOR_VARY
-+    {
-+      String xavString = StringNull;
-+      xavString = httpHeaderGetList(hdr, HDR_X_ACCELERATOR_VARY);
-+      if (strBuf(xavString))
-+          strListAdd(&hdrString, strBuf(xavString), ',');
-+      stringClean(&xavString);
-+    }
-+#endif
-+    return hdrString;
-+}
-+
-+/*
-+ * Returns TRUE if at least one of the vary headers are present 
-+ */
-+int httpHeaderHasVary(const HttpHeader * hdr)
-+{
-+#if VARY_OPTIONS
-+    if (httpHeaderHas(hdr, HDR_X_VARY_OPTIONS)) {
-+      return TRUE;
-+    }
-+#endif
-+#if X_ACCELERATOR_VARY
-+    if (httpHeaderHas(hdr, HDR_X_ACCELERATOR_VARY)) {
-+      return TRUE;
-+    }
-+#endif
-+    if (httpHeaderHas(hdr, HDR_VARY)) {
-+      return TRUE;
-+    }
-+    return FALSE;
-+}
-+
- /*
-  * HttpHeaderEntry
-  */
-@@ -1438,3 +1492,5 @@
-     assert(id >= 0 && id < HDR_ENUM_END);
-     return strBuf(Headers[id].name);
- }
-+
-+
-diff -Xdiffx -ru squid-2.6.18.orig/src/HttpReply.c squid-2.6.18/src/HttpReply.c
---- squid-2.6.18.orig/src/HttpReply.c  2006-06-11 10:28:19.000000000 +1000
-+++ squid-2.6.18/src/HttpReply.c       2008-02-08 14:42:04.000000000 +1100
-@@ -325,8 +325,7 @@
-               return squid_curtime;
-       }
-     }
--    if (Config.onoff.vary_ignore_expire &&
--      httpHeaderHas(&rep->header, HDR_VARY)) {
-+    if (Config.onoff.vary_ignore_expire && httpHeaderHasVary(&rep->header)) {
-       const time_t d = httpHeaderGetTime(&rep->header, HDR_DATE);
-       const time_t e = httpHeaderGetTime(&rep->header, HDR_EXPIRES);
-       if (d == e)
-diff -Xdiffx -ru squid-2.6.18.orig/src/protos.h squid-2.6.18/src/protos.h
---- squid-2.6.18.orig/src/protos.h     2008-02-07 19:28:38.000000000 +1100
-+++ squid-2.6.18/src/protos.h  2008-02-08 14:46:21.000000000 +1100
-@@ -444,6 +444,8 @@
+diff -urNad squid-2.7.5~/src/protos.h squid-2.7.5/src/protos.h
+--- squid-2.7.5~/src/protos.h  2009-01-27 16:34:13.000000000 +0000
++++ squid-2.7.5/src/protos.h   2009-01-27 16:34:13.000000000 +0000
+@@ -464,6 +464,8 @@
  extern squid_off_t httpHeaderGetSize(const HttpHeader * hdr, http_hdr_type 
id);
  extern time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id);
  extern TimeOrTag httpHeaderGetTimeOrTag(const HttpHeader * hdr, http_hdr_type 
id);
@@ -333,13 +333,13 @@
  extern HttpHdrCc *httpHeaderGetCc(const HttpHeader * hdr);
  extern HttpHdrRange *httpHeaderGetRange(const HttpHeader * hdr);
  extern HttpHdrContRange *httpHeaderGetContRange(const HttpHeader * hdr);
-diff -Xdiffx -ru squid-2.6.18.orig/src/store.c squid-2.6.18/src/store.c
---- squid-2.6.18.orig/src/store.c      2008-02-07 19:28:38.000000000 +1100
-+++ squid-2.6.18/src/store.c   2008-02-08 14:55:06.000000000 +1100
-@@ -721,7 +721,12 @@
-     state->e = storeCreateEntry(url, log_url, flags, method);
-     httpBuildVersion(&version, 1, 0);
-     httpReplySetHeaders(state->e->mem_obj->reply, version, HTTP_OK, "Internal 
marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
+diff -urNad squid-2.7.5~/src/store.c squid-2.7.5/src/store.c
+--- squid-2.7.5~/src/store.c   2009-01-27 16:34:13.000000000 +0000
++++ squid-2.7.5/src/store.c    2009-01-27 16:34:13.000000000 +0000
+@@ -742,7 +742,12 @@
+     flags.cachable = 1;
+     state->e = storeCreateEntry(url, flags, method);
+     httpReplySetHeaders(state->e->mem_obj->reply, HTTP_OK, "Internal marker 
object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
 +#if VARY_OPTIONS
 +    /* Can't put a string into a list header */
 +    httpHeaderPutStr(&state->e->mem_obj->reply->header, HDR_X_VARY_OPTIONS, 
vary);
@@ -348,8 +348,8 @@
 +#endif
      storeSetPublicKey(state->e);
      if (!state->oe) {
-       /* New entry, create new unique ID */
-@@ -1039,20 +1044,8 @@
+         /* New entry, create new unique ID */
+@@ -1061,20 +1066,8 @@
        }
        newkey = storeKeyPublicByRequest(mem->request);
        if (mem->vary_headers && !EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
@@ -368,6 +368,6 @@
 -          stringClean(&varyhdr);
 -#endif
 +          String vary = httpHeaderGetVary(&mem->reply->header);
-           /* Create or update the vary object */
-           vary_id = storeAddVary(mem->url, mem->log_url, mem->method, newkey, 
httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), 
mem->vary_headers, mem->vary_encoding);
-           if (vary_id.create_time)  {
+             /* Create or update the vary object */
+             vary_id = storeAddVary(mem->url, mem->log_url, mem->method, 
newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), 
mem->vary_headers, mem->vary_encoding);
+             if (vary_id.create_time)  {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to