r46354 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46353‎ | r46354 | r46355 >
Date:16:39, 27 January 2009
Author:mark
Status:deferred
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/debs/squid/debian/patches/26-vary_options.dpatch
@@ -6,10 +6,10 @@
77 ## DP: Adds support for the X-Vary-Options response header
88
99 @DPATCH@
10 -diff -Xdiffx -ru squid-2.6.18.orig/configure.in squid-2.6.18/configure.in
11 -+++ squid-2.6.18/configure.in 2008-02-07 19:43:23.000000000 +1100
12 -@@ -1507,6 +1507,16 @@
 10+diff -urNad squid-2.7.5~/configure.in squid-2.7.5/configure.in
 11+--- squid-2.7.5~/configure.in 2009-01-27 16:20:36.000000000 +0000
 12+@@ -1533,6 +1533,16 @@
1313 fi
1414 ])
1515
@@ -25,23 +25,120 @@
2626 +
2727 AC_ARG_ENABLE(follow-x-forwarded-for,
2828 [ --enable-follow-x-forwarded-for
29 - Enable support for following the X-Forwarded-For
30 -diff -Xdiffx -ru squid-2.6.18.orig/src/client_side.c squid-2.6.18/src/client_side.c
31 -+++ squid-2.6.18/src/client_side.c 2008-02-08 14:39:38.000000000 +1100
32 -@@ -735,10 +735,7 @@
 29+ Enable support for following the X-Forwarded-For
 30+diff -urNad squid-2.7.5~/src/HttpHeader.c squid-2.7.5/src/HttpHeader.c
 31+--- squid-2.7.5~/src/HttpHeader.c 2009-01-27 16:20:36.000000000 +0000
 32+@@ -134,6 +134,9 @@
 33+ #if X_ACCELERATOR_VARY
 34+ {"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr},
 35+ #endif
 36++#if VARY_OPTIONS
 37++ {"X-Vary-Options", HDR_X_VARY_OPTIONS, ftStr},
 38++#endif
 39+ {"X-Error-URL", HDR_X_ERROR_URL, ftStr},
 40+ {"X-Error-Status", HDR_X_ERROR_STATUS, ftInt},
 41+ {"Front-End-Https", HDR_FRONT_END_HTTPS, ftStr},
 42+@@ -211,6 +214,9 @@
 43+ #if X_ACCELERATOR_VARY
 44+ HDR_X_ACCELERATOR_VARY,
 45+ #endif
 46++#if VARY_OPTIONS
 47++ HDR_X_VARY_OPTIONS,
 48++#endif
 49+ HDR_X_SQUID_ERROR
 50+ };
 51+
 52+@@ -1199,6 +1205,54 @@
 53+ return tot;
 54+ }
 55+
 56++/* Get the combined Vary headers as a String
 57++ * Returns StringNull if there are no vary headers
 58++ */
 59++String httpHeaderGetVary(const HttpHeader * hdr)
 60++{
 61++ String hdrString = StringNull;
 62++#if VARY_OPTIONS
 63++ HttpHeaderEntry *e;
 64++ if ((e = httpHeaderFindEntry(hdr, HDR_X_VARY_OPTIONS))) {
 65++ stringInit(&hdrString, strBuf(e->value));
 66++ return hdrString;
 67++ }
 68++#endif
 69++
 70++ hdrString = httpHeaderGetList(hdr, HDR_VARY);
 71++#if X_ACCELERATOR_VARY
 72++ {
 73++ String xavString = StringNull;
 74++ xavString = httpHeaderGetList(hdr, HDR_X_ACCELERATOR_VARY);
 75++ if (strBuf(xavString))
 76++ strListAdd(&hdrString, strBuf(xavString), ',');
 77++ stringClean(&xavString);
 78++ }
 79++#endif
 80++ return hdrString;
 81++}
 82++
 83++/*
 84++ * Returns TRUE if at least one of the vary headers are present
 85++ */
 86++int httpHeaderHasVary(const HttpHeader * hdr)
 87++{
 88++#if VARY_OPTIONS
 89++ if (httpHeaderHas(hdr, HDR_X_VARY_OPTIONS)) {
 90++ return TRUE;
 91++ }
 92++#endif
 93++#if X_ACCELERATOR_VARY
 94++ if (httpHeaderHas(hdr, HDR_X_ACCELERATOR_VARY)) {
 95++ return TRUE;
 96++ }
 97++#endif
 98++ if (httpHeaderHas(hdr, HDR_VARY)) {
 99++ return TRUE;
 100++ }
 101++ return FALSE;
 102++}
 103++
 104+ /*
 105+ * HttpHeaderEntry
 106+ */
 107+@@ -1475,3 +1529,5 @@
 108+ assert(id >= 0 && id < HDR_ENUM_END);
 109+ return strBuf(Headers[id].name);
 110+ }
 111++
 112++
 113+diff -urNad squid-2.7.5~/src/HttpReply.c squid-2.7.5/src/HttpReply.c
 114+--- squid-2.7.5~/src/HttpReply.c 2009-01-27 16:20:36.000000000 +0000
 115+@@ -315,8 +315,7 @@
 116+ return squid_curtime;
 117+ }
 118+ }
 119+- if (Config.onoff.vary_ignore_expire &&
 120+- httpHeaderHas(&rep->header, HDR_VARY)) {
 121++ if (Config.onoff.vary_ignore_expire && httpHeaderHasVary(&rep->header)) {
 122+ const time_t d = httpHeaderGetTime(&rep->header, HDR_DATE);
 123+ const time_t e = httpHeaderGetTime(&rep->header, HDR_EXPIRES);
 124+ if (d == e)
 125+diff -urNad squid-2.7.5~/src/client_side.c squid-2.7.5/src/client_side.c
 126+--- squid-2.7.5~/src/client_side.c 2009-01-27 16:34:13.000000000 +0000
 127+@@ -643,10 +643,7 @@
33128 request_t *request = http->request;
34 - const char *etag = httpHeaderGetStr(&mem->reply->header, HDR_ETAG);
 129+ const char *etag = httpHeaderGetStr(&rep->header, HDR_ETAG);
35130 const char *vary = request->vary_headers;
36 -- int has_vary = httpHeaderHas(&entry->mem_obj->reply->header, HDR_VARY);
 131+- int has_vary = httpHeaderHas(&rep->header, HDR_VARY);
37132 -#if X_ACCELERATOR_VARY
38 -- has_vary |= httpHeaderHas(&entry->mem_obj->reply->header, HDR_X_ACCELERATOR_VARY);
 133+- has_vary |= httpHeaderHas(&rep->header, HDR_X_ACCELERATOR_VARY);
39134 -#endif
40135 + int has_vary = httpHeaderHasVary(&entry->mem_obj->reply->header);
41136 if (has_vary)
42 - vary = httpMakeVaryMark(request, mem->reply);
 137+ vary = httpMakeVaryMark(request, rep);
43138
44 -@@ -4948,10 +4945,7 @@
 139+@@ -5075,10 +5072,7 @@
45140 varyEvaluateMatch(StoreEntry * entry, request_t * request)
46141 {
47142 const char *vary = request->vary_headers;
@@ -53,13 +150,13 @@
54151 if (!has_vary || !entry->mem_obj->vary_headers) {
55152 if (vary) {
56153 /* Oops... something odd is going on here.. */
57 -diff -Xdiffx -ru squid-2.6.18.orig/src/defines.h squid-2.6.18/src/defines.h
58 -+++ squid-2.6.18/src/defines.h 2008-02-07 22:05:02.000000000 +1100
59 -@@ -364,4 +364,10 @@
60 - #define DLINK_ISEMPTY(n) ( (n).head == NULL )
61 - #define DLINK_HEAD(n) ( (n).head->data )
 154+diff -urNad squid-2.7.5~/src/defines.h squid-2.7.5/src/defines.h
 155+--- squid-2.7.5~/src/defines.h 2009-01-27 16:34:13.000000000 +0000
 156+@@ -366,4 +366,10 @@
62157
 158+ #define LOGFILE_SEQNO(n) ( (n)->sequence_number )
 159+
63160 +
64161 +/* Hack to avoid re-running autoconf/automake -- TS */
65162 +#ifndef VARY_OPTIONS
@@ -67,10 +164,10 @@
68165 +#endif
69166 +
70167 #endif /* SQUID_DEFINES_H */
71 -diff -Xdiffx -ru squid-2.6.18.orig/src/enums.h squid-2.6.18/src/enums.h
72 -+++ squid-2.6.18/src/enums.h 2008-02-07 21:35:18.000000000 +1100
73 -@@ -256,6 +256,9 @@
 168+diff -urNad squid-2.7.5~/src/enums.h squid-2.7.5/src/enums.h
 169+--- squid-2.7.5~/src/enums.h 2009-01-27 16:34:13.000000000 +0000
 170+@@ -259,6 +259,9 @@
74171 #if X_ACCELERATOR_VARY
75172 HDR_X_ACCELERATOR_VARY,
76173 #endif
@@ -79,11 +176,11 @@
80177 +#endif
81178 HDR_X_ERROR_URL, /* errormap, requested URL */
82179 HDR_X_ERROR_STATUS, /* errormap, received HTTP status line */
83 - HDR_FRONT_END_HTTPS,
84 -diff -Xdiffx -ru squid-2.6.18.orig/src/http.c squid-2.6.18/src/http.c
85 -+++ squid-2.6.18/src/http.c 2008-02-08 14:48:44.000000000 +1100
86 -@@ -353,20 +353,29 @@
 180+ HDR_X_HTTP09_FIRST_LINE, /* internal, first line of HTTP/0.9 response */
 181+diff -urNad squid-2.7.5~/src/http.c squid-2.7.5/src/http.c
 182+--- squid-2.7.5~/src/http.c 2009-01-27 16:34:13.000000000 +0000
 183+@@ -355,20 +355,29 @@
87184 String vstr = StringNull;
88185
89186 stringClean(&vstr);
@@ -126,7 +223,7 @@
127224 if (strcmp(name, "accept-encoding") == 0) {
128225 aclCheck_t checklist;
129226 memset(&checklist, 0, sizeof(checklist));
130 -@@ -381,22 +390,76 @@
 227+@@ -383,22 +392,76 @@
131228 if (strcmp(name, "*") == 0) {
132229 /* Can not handle "Vary: *" efficiently, bail out making the response not cached */
133230 safe_free(name);
@@ -211,7 +308,7 @@
212309 safe_free(request->vary_hdr);
213310 safe_free(request->vary_headers);
214311 if (strBuf(vary) && strBuf(vstr)) {
215 -@@ -514,11 +577,7 @@
 312+@@ -539,11 +602,7 @@
216313 /* non-chunked. Handle as one single big chunk (-1 if terminated by EOF) */
217314 httpState->chunk_size = httpReplyBodySize(httpState->orig_request->method, reply);
218315 }
@@ -224,107 +321,10 @@
225322 const char *vary = NULL;
226323 if (Config.onoff.cache_vary)
227324 vary = httpMakeVaryMark(httpState->orig_request, reply);
228 -diff -Xdiffx -ru squid-2.6.18.orig/src/HttpHeader.c squid-2.6.18/src/HttpHeader.c
229 -+++ squid-2.6.18/src/HttpHeader.c 2008-02-08 14:49:24.000000000 +1100
230 -@@ -133,6 +133,9 @@
231 - #if X_ACCELERATOR_VARY
232 - {"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr},
233 - #endif
234 -+#if VARY_OPTIONS
235 -+ {"X-Vary-Options", HDR_X_VARY_OPTIONS, ftStr},
236 -+#endif
237 - {"X-Error-URL", HDR_X_ERROR_URL, ftStr},
238 - {"X-Error-Status", HDR_X_ERROR_STATUS, ftInt},
239 - {"Front-End-Https", HDR_FRONT_END_HTTPS, ftStr},
240 -@@ -210,6 +213,9 @@
241 - #if X_ACCELERATOR_VARY
242 - HDR_X_ACCELERATOR_VARY,
243 - #endif
244 -+#if VARY_OPTIONS
245 -+ HDR_X_VARY_OPTIONS,
246 -+#endif
247 - HDR_X_SQUID_ERROR
248 - };
249 -
250 -@@ -1185,6 +1191,54 @@
251 - return tot;
252 - }
253 -
254 -+/* Get the combined Vary headers as a String
255 -+ * Returns StringNull if there are no vary headers
256 -+ */
257 -+String httpHeaderGetVary(const HttpHeader * hdr)
258 -+{
259 -+ String hdrString = StringNull;
260 -+#if VARY_OPTIONS
261 -+ HttpHeaderEntry *e;
262 -+ if ((e = httpHeaderFindEntry(hdr, HDR_X_VARY_OPTIONS))) {
263 -+ stringInit(&hdrString, strBuf(e->value));
264 -+ return hdrString;
265 -+ }
266 -+#endif
267 -+
268 -+ hdrString = httpHeaderGetList(hdr, HDR_VARY);
269 -+#if X_ACCELERATOR_VARY
270 -+ {
271 -+ String xavString = StringNull;
272 -+ xavString = httpHeaderGetList(hdr, HDR_X_ACCELERATOR_VARY);
273 -+ if (strBuf(xavString))
274 -+ strListAdd(&hdrString, strBuf(xavString), ',');
275 -+ stringClean(&xavString);
276 -+ }
277 -+#endif
278 -+ return hdrString;
279 -+}
280 -+
281 -+/*
282 -+ * Returns TRUE if at least one of the vary headers are present
283 -+ */
284 -+int httpHeaderHasVary(const HttpHeader * hdr)
285 -+{
286 -+#if VARY_OPTIONS
287 -+ if (httpHeaderHas(hdr, HDR_X_VARY_OPTIONS)) {
288 -+ return TRUE;
289 -+ }
290 -+#endif
291 -+#if X_ACCELERATOR_VARY
292 -+ if (httpHeaderHas(hdr, HDR_X_ACCELERATOR_VARY)) {
293 -+ return TRUE;
294 -+ }
295 -+#endif
296 -+ if (httpHeaderHas(hdr, HDR_VARY)) {
297 -+ return TRUE;
298 -+ }
299 -+ return FALSE;
300 -+}
301 -+
302 - /*
303 - * HttpHeaderEntry
304 - */
305 -@@ -1438,3 +1492,5 @@
306 - assert(id >= 0 && id < HDR_ENUM_END);
307 - return strBuf(Headers[id].name);
308 - }
309 -+
310 -+
311 -diff -Xdiffx -ru squid-2.6.18.orig/src/HttpReply.c squid-2.6.18/src/HttpReply.c
312 -+++ squid-2.6.18/src/HttpReply.c 2008-02-08 14:42:04.000000000 +1100
313 -@@ -325,8 +325,7 @@
314 - return squid_curtime;
315 - }
316 - }
317 -- if (Config.onoff.vary_ignore_expire &&
318 -- httpHeaderHas(&rep->header, HDR_VARY)) {
319 -+ if (Config.onoff.vary_ignore_expire && httpHeaderHasVary(&rep->header)) {
320 - const time_t d = httpHeaderGetTime(&rep->header, HDR_DATE);
321 - const time_t e = httpHeaderGetTime(&rep->header, HDR_EXPIRES);
322 - if (d == e)
323 -diff -Xdiffx -ru squid-2.6.18.orig/src/protos.h squid-2.6.18/src/protos.h
324 -+++ squid-2.6.18/src/protos.h 2008-02-08 14:46:21.000000000 +1100
325 -@@ -444,6 +444,8 @@
 325+diff -urNad squid-2.7.5~/src/protos.h squid-2.7.5/src/protos.h
 326+--- squid-2.7.5~/src/protos.h 2009-01-27 16:34:13.000000000 +0000
 327+@@ -464,6 +464,8 @@
326328 extern squid_off_t httpHeaderGetSize(const HttpHeader * hdr, http_hdr_type id);
327329 extern time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id);
328330 extern TimeOrTag httpHeaderGetTimeOrTag(const HttpHeader * hdr, http_hdr_type id);
@@ -333,13 +333,13 @@
334334 extern HttpHdrCc *httpHeaderGetCc(const HttpHeader * hdr);
335335 extern HttpHdrRange *httpHeaderGetRange(const HttpHeader * hdr);
336336 extern HttpHdrContRange *httpHeaderGetContRange(const HttpHeader * hdr);
337 -diff -Xdiffx -ru squid-2.6.18.orig/src/store.c squid-2.6.18/src/store.c
338 -+++ squid-2.6.18/src/store.c 2008-02-08 14:55:06.000000000 +1100
339 -@@ -721,7 +721,12 @@
340 - state->e = storeCreateEntry(url, log_url, flags, method);
341 - httpBuildVersion(&version, 1, 0);
342 - httpReplySetHeaders(state->e->mem_obj->reply, version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
 337+diff -urNad squid-2.7.5~/src/store.c squid-2.7.5/src/store.c
 338+--- squid-2.7.5~/src/store.c 2009-01-27 16:34:13.000000000 +0000
 339+@@ -742,7 +742,12 @@
 340+ flags.cachable = 1;
 341+ state->e = storeCreateEntry(url, flags, method);
 342+ httpReplySetHeaders(state->e->mem_obj->reply, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
343343 +#if VARY_OPTIONS
344344 + /* Can't put a string into a list header */
345345 + httpHeaderPutStr(&state->e->mem_obj->reply->header, HDR_X_VARY_OPTIONS, vary);
@@ -348,8 +348,8 @@
349349 +#endif
350350 storeSetPublicKey(state->e);
351351 if (!state->oe) {
352 - /* New entry, create new unique ID */
353 -@@ -1039,20 +1044,8 @@
 352+ /* New entry, create new unique ID */
 353+@@ -1061,20 +1066,8 @@
354354 }
355355 newkey = storeKeyPublicByRequest(mem->request);
356356 if (mem->vary_headers && !EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
@@ -368,6 +368,6 @@
369369 - stringClean(&varyhdr);
370370 -#endif
371371 + String vary = httpHeaderGetVary(&mem->reply->header);
372 - /* Create or update the vary object */
373 - 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);
374 - if (vary_id.create_time) {
 372+ /* Create or update the vary object */
 373+ 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);
 374+ if (vary_id.create_time) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r88075updating wmf vary header patches for squid 2.7.stable9...asher13:33, 14 May 2011

Status & tagging log