r88075 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88074‎ | r88075 | r88076 >
Date:13:33, 14 May 2011
Author:asher
Status:deferred
Tags:
Comment:
updating wmf vary header patches for squid 2.7.stable9
based on r46354
Modified paths:
  • /trunk/debs/squid/debian/patches/23-variant-invalidation.dpatch (modified) (history)
  • /trunk/debs/squid/debian/patches/26-vary_options.dpatch (modified) (history)

Diff [purge]

Index: trunk/debs/squid/debian/patches/26-vary_options.dpatch
@@ -379,5 +379,5 @@
380380 -#endif
381381 + String vary = httpHeaderGetVary(&mem->reply->header);
382382 /* Create or update the vary object */
383 - vary_id = storeAddVary(mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
 383+ vary_id = storeAddVary(mem->store_url, mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
384384 if (vary_id.create_time) {
Index: trunk/debs/squid/debian/patches/23-variant-invalidation.dpatch
@@ -5,423 +5,27 @@
66 ## DP: No description.
77
88 @DPATCH@
9 -diff -urNad squid-2.7.9~/debian/patches/23-variant-invalidation.dpatch~ squid-2.7.9/debian/patches/23-variant-invalidation.dpatch~
10 -+++ squid-2.7.9/debian/patches/23-variant-invalidation.dpatch~ 2011-04-11 20:17:45.000000000 +0000
11 -@@ -0,0 +1,358 @@
12 -+#! /bin/sh /usr/share/dpatch/dpatch-run
13 -+## 23-variant-invalidation.dpatch by Tim Starling <tstarling@wikimedia.org>
14 -+##
15 -+## All lines beginning with `## DP:' are a description of the patch.
16 -+## DP: No description.
17 -+
18 -+@DPATCH@
19 -+diff -urNad squid-2.7.6~/src/client_side.c squid-2.7.6/src/client_side.c
20 -+--- squid-2.7.6~/src/client_side.c 2009-02-12 20:02:24.000000000 +0000
21 -++++ squid-2.7.6/src/client_side.c 2009-02-12 20:13:01.000000000 +0000
22 -+@@ -2331,6 +2331,16 @@
23 -+ http->sc = NULL;
24 -+ clientProcessMiss(http);
25 -+ return;
26 -++ case VARY_EXPIRED:
27 -++ /* Variant is expired. Delete it and process as a miss. */
28 -++ debug(33, 2) ("clientProcessHit: Variant expired, deleting\n");
29 -++ storeClientUnregister(http->sc, e, http);
30 -++ http->sc = NULL;
31 -++ storeRelease(e);
32 -++ storeUnlockObject(e);
33 -++ http->entry = NULL;
34 -++ clientProcessMiss(http);
35 -++ return;
36 -+ }
37 -+ if (r->method == METHOD_PURGE) {
38 -+ http->entry = NULL;
39 -+@@ -5086,6 +5096,8 @@
40 -+ */
41 -+ vary = httpMakeVaryMark(request, entry->mem_obj->reply);
42 -+ if (vary) {
43 -++ /* Save the vary_id for the second time through. */
44 -++ request->vary_id = entry->mem_obj->vary_id;
45 -+ return VARY_OTHER;
46 -+ } else {
47 -+ /* Ouch.. we cannot handle this kind of variance */
48 -+@@ -5103,6 +5115,13 @@
49 -+ /* This request was merged before we knew the outcome. Don't trust the response */
50 -+ /* restart vary processing from the beginning */
51 -+ return VARY_RESTART;
52 -++ } else if (request->vary_id.create_time != entry->mem_obj->vary_id.create_time ||
53 -++ request->vary_id.serial != entry->mem_obj->vary_id.serial) {
54 -++ /* vary_id mismatch, the variant must be expired */
55 -++ debug(33, 3) ("varyEvaluateMatch: vary ID mismatch, parent is %ld.%u, child is %ld.%u\n",
56 -++ request->vary_id.create_time, request->vary_id.serial,
57 -++ entry->mem_obj->vary_id.create_time, entry->mem_obj->vary_id.serial);
58 -++ return VARY_EXPIRED;
59 -+ } else {
60 -+ return VARY_MATCH;
61 -+ }
62 -+diff -urNad squid-2.7.6~/src/comm_generic.c squid-2.7.6/src/comm_generic.c
63 -+--- squid-2.7.6~/src/comm_generic.c 2009-02-12 20:02:24.000000000 +0000
64 -++++ squid-2.7.6/src/comm_generic.c 2009-02-12 20:13:01.000000000 +0000
65 -+@@ -360,7 +360,7 @@
66 -+ int rc;
67 -+ double start = current_dtime;
68 -+
69 -+- debug(5, 3) ("comm_select: timeout %d\n", msec);
70 -++ debug(5, 5) ("comm_select: timeout %d\n", msec);
71 -+
72 -+ if (msec > MAX_POLL_TIME)
73 -+ msec = MAX_POLL_TIME;
74 -+diff -urNad squid-2.7.6~/src/enums.h squid-2.7.6/src/enums.h
75 -+--- squid-2.7.6~/src/enums.h 2009-02-12 20:02:24.000000000 +0000
76 -++++ squid-2.7.6/src/enums.h 2009-02-12 20:13:01.000000000 +0000
77 -+@@ -661,6 +661,7 @@
78 -+ STORE_META_VARY_HEADERS, /* Stores Vary request headers */
79 -+ STORE_META_STD_LFS, /* standard metadata in lfs format */
80 -+ STORE_META_OBJSIZE, /* object size, if its known */
81 -++ STORE_META_VARY_ID, /* Unique ID linking variants */
82 -+ STORE_META_STOREURL, /* the store url, if different to the normal URL */
83 -+ STORE_META_END
84 -+ };
85 -+@@ -755,7 +756,8 @@
86 -+ VARY_MATCH,
87 -+ VARY_OTHER,
88 -+ VARY_RESTART,
89 -+- VARY_CANCEL
90 -++ VARY_CANCEL,
91 -++ VARY_EXPIRED
92 -+ };
93 -+
94 -+ /* Windows Port */
95 -+diff -urNad squid-2.7.6~/src/http.c squid-2.7.6/src/http.c
96 -+--- squid-2.7.6~/src/http.c 2009-02-12 20:13:01.000000000 +0000
97 -++++ squid-2.7.6/src/http.c 2009-02-12 20:13:01.000000000 +0000
98 -+@@ -229,7 +229,7 @@
99 -+ const char *v;
100 -+ #if HTTP_VIOLATIONS
101 -+ const refresh_t *R = NULL;
102 -+- /* This strange looking define first looks up the frefresh pattern
103 -++ /* This strange looking define first looks up the refresh pattern
104 -+ * and then checks if the specified flag is set. The main purpose
105 -+ * of this is to simplify the refresh pattern lookup
106 -+ */
107 -+diff -urNad squid-2.7.6~/src/protos.h squid-2.7.6/src/protos.h
108 -+--- squid-2.7.6~/src/protos.h 2009-02-12 20:02:24.000000000 +0000
109 -++++ squid-2.7.6/src/protos.h 2009-02-12 20:13:01.000000000 +0000
110 -+@@ -1468,7 +1468,7 @@
111 -+ /* ETag support */
112 -+ void storeLocateVaryDone(VaryData * data);
113 -+ void storeLocateVary(StoreEntry * e, int offset, const char *vary_data, String accept_encoding, STLVCB * callback, void *cbdata);
114 -+-void storeAddVary(const char *url, const method_t method, const cache_key * key, const char *etag, const char *vary, const char *vary_headers, const char *accept_encoding);
115 -++vary_id_t storeAddVary(const char *url, const method_t method, const cache_key * key, const char *etag, const char *vary, const char *vary_headers, const char *accept_encoding);
116 -+
117 -+ /* New HTTP message parsing support */
118 -+ extern void HttpMsgBufInit(HttpMsgBuf * hmsg, const char *buf, size_t size);
119 -+diff -urNad squid-2.7.6~/src/store.c squid-2.7.6/src/store.c
120 -+--- squid-2.7.6~/src/store.c 2009-02-12 20:02:24.000000000 +0000
121 -++++ squid-2.7.6/src/store.c 2009-02-12 20:18:06.000000000 +0000
122 -+@@ -87,6 +87,7 @@
123 -+ static void storeEntryDereferenced(StoreEntry *);
124 -+ static int getKeyCounter(void);
125 -+ static int storeKeepInMemory(const StoreEntry *);
126 -++static void initVaryId(vary_id_t *);
127 -+ static OBJH storeCheckCachableStats;
128 -+ static EVH storeLateRelease;
129 -+
130 -+@@ -347,8 +348,9 @@
131 -+ StoreEntry *
132 -+ storeGet(const cache_key * key)
133 -+ {
134 -+- debug(20, 3) ("storeGet: looking up %s\n", storeKeyText(key));
135 -+- return (StoreEntry *) hash_lookup(store_table, key);
136 -++ StoreEntry * e = (StoreEntry *) hash_lookup(store_table, key);
137 -++ debug(20, 3) ("storeGet: %s -> %p\n", storeKeyText(key), e);
138 -++ return e;
139 -+ }
140 -+
141 -+ StoreEntry *
142 -+@@ -452,6 +454,11 @@
143 -+ storeAppendPrintf(state->e, "ETag: %s\n", state->etag);
144 -+ storeAppendPrintf(state->e, "VaryData: %s\n", state->vary_headers);
145 -+ }
146 -++ if (state->oe) {
147 -++ debug(11, 3)("free_AddVaryState: copying vary ID %ld.%u to new entry\n",
148 -++ state->oe->mem_obj->vary_id.create_time, state->oe->mem_obj->vary_id.serial);
149 -++ state->e->mem_obj->vary_id = state->oe->mem_obj->vary_id;
150 -++ }
151 -+ storeTimestampsSet(state->e);
152 -+ storeComplete(state->e);
153 -+ storeTimestampsSet(state->e);
154 -+@@ -563,6 +570,7 @@
155 -+ debug(11, 3) ("storeAddVaryReadOld: %p seen_offset=%" PRINTF_OFF_T " buf_offset=%d size=%d\n", data, state->seen_offset, (int) state->buf_offset, (int) size);
156 -+ if (size <= 0) {
157 -+ debug(11, 2) ("storeAddVaryReadOld: DONE\n");
158 -++ /* Call back to the destructor free_AddVaryState */
159 -+ cbdataFree(state);
160 -+ return;
161 -+ }
162 -+@@ -706,12 +714,13 @@
163 -+
164 -+ /*
165 -+ * Adds/updates a Vary record.
166 -+- * For updates only one of key or etag needs to be specified
167 -+- * At leas one of key or etag must be specified, preferably both.
168 -++ * At least one of key or etag must be specified, preferably both.
169 -++ * Returns the vary ID if it can be determined immediately, zero otherwise
170 -+ */
171 -+-void
172 -++vary_id_t
173 -+ storeAddVary(const char *url, const method_t method, const cache_key * key, const char *etag, const char *vary, const char *vary_headers, const char *accept_encoding)
174 -+ {
175 -++ vary_id_t vary_id = {0, 0};
176 -+ AddVaryState *state;
177 -+ request_flags flags = null_request_flags;
178 -+ CBDATA_INIT_TYPE_FREECB(AddVaryState, free_AddVaryState);
179 -+@@ -734,6 +743,11 @@
180 -+ httpReplySetHeaders(state->e->mem_obj->reply, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
181 -+ httpHeaderPutStr(&state->e->mem_obj->reply->header, HDR_VARY, vary);
182 -+ storeSetPublicKey(state->e);
183 -++ if (!state->oe) {
184 -++ /* New entry, create new unique ID */
185 -++ initVaryId(&vary_id);
186 -++ state->e->mem_obj->vary_id = vary_id;
187 -++ }
188 -+ storeBuffer(state->e);
189 -+ httpReplySwapOut(state->e->mem_obj->reply, state->e);
190 -+ if (state->oe) {
191 -+@@ -752,7 +766,15 @@
192 -+ * modifications above)
193 -+ */
194 -+ /* Swap in the dummy Vary object */
195 -+- if (!state->oe->mem_obj) {
196 -++ if (state->oe->mem_obj) {
197 -++ vary_id = state->oe->mem_obj->vary_id;
198 -++ if (vary_id.create_time == 0 && vary_id.serial == 0) {
199 -++ initVaryId(&vary_id);
200 -++ state->oe->mem_obj->vary_id = vary_id;
201 -++ }
202 -++ }
203 -++ else {
204 -++ /* Swap in the dummy Vary object. vary_id is unknown for now */
205 -+ storeCreateMemObject(state->oe, state->url);
206 -+ state->oe->mem_obj->method = method;
207 -+ }
208 -+@@ -764,10 +786,10 @@
209 -+ state->buf,
210 -+ storeAddVaryReadOld,
211 -+ state);
212 -+- return;
213 -+ } else {
214 -+ cbdataFree(state);
215 -+ }
216 -++ return vary_id;
217 -+ }
218 -+
219 -+ static MemPool *VaryData_pool = NULL;
220 -+@@ -810,9 +832,10 @@
221 -+ static void
222 -+ storeLocateVaryCallback(LocateVaryState * state)
223 -+ {
224 -++ int expired = FALSE;
225 -+ if (cbdataValid(state->callback_data)) {
226 -+ VaryData *data = state->data;
227 -+- if (data->key || data->etags.count) {
228 -++ if (!expired && (data->key || data->etags.count)) {
229 -+ state->callback(data, state->callback_data);
230 -+ state->data = NULL; /* now owned by the caller */
231 -+ } else {
232 -+@@ -989,6 +1012,7 @@
233 -+ StoreEntry *e2 = NULL;
234 -+ const cache_key *newkey;
235 -+ MemObject *mem = e->mem_obj;
236 -++ debug(20, 3) ("storeSetPublicKey: %s\n", storeKeyText(e->hash.key));
237 -+ if (e->hash.key && !EBIT_TEST(e->flags, KEY_PRIVATE)) {
238 -+ if (EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
239 -+ EBIT_CLR(e->flags, KEY_EARLY_PUBLIC);
240 -+@@ -1042,6 +1066,7 @@
241 -+ newkey = storeKeyPublicByRequest(mem->request);
242 -+ if (mem->vary_headers && !EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
243 -+ String vary = StringNull;
244 -++ vary_id_t vary_id;
245 -+ String varyhdr;
246 -+ varyhdr = httpHeaderGetList(&mem->reply->header, HDR_VARY);
247 -+ if (strBuf(varyhdr))
248 -+@@ -1054,8 +1079,28 @@
249 -+ strListAdd(&vary, strBuf(varyhdr), ',');
250 -+ stringClean(&varyhdr);
251 -+ #endif
252 -+- storeAddVary(mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
253 -+- stringClean(&vary);
254 -++ /* Create or update the vary object */
255 -++ vary_id = storeAddVary(mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
256 -++ if (vary_id.create_time) {
257 -++ mem->vary_id = vary_id;
258 -++ } else {
259 -++ /* Base vary object is not swapped in, so the vary_id is unknown.
260 -++ * Maybe we can cheat and use the vary_id from the request. If the
261 -++ * base object existed earlier in the request, it would have been
262 -++ * swapped in and stored at that time.
263 -++ */
264 -++ if (mem->request->vary_id.create_time) {
265 -++ mem->vary_id = mem->request->vary_id;
266 -++ } else {
267 -++ /* Nope, no luck. Store with zero vary_id, which will immediately
268 -++ * be treated as expired.
269 -++ * FIXME: make this work properly.
270 -++ */
271 -++ debug(20, 1) ("storeSetPublicKey: unable to determine vary_id for '%s'\n", mem->url);
272 -++ }
273 -++ }
274 -++
275 -++ stringClean(&vary);
276 -+ }
277 -+ } else {
278 -+ newkey = storeKeyPublic(storeLookupUrl(e), mem->method);
279 -+@@ -1829,6 +1874,8 @@
280 -+ debug(20, 1) ("MemObject->url: %p %s\n",
281 -+ mem->url,
282 -+ checkNullString(mem->url));
283 -++ debug(20, 1) ("MemObject->vary_id: %ld.%u\n",
284 -++ mem->vary_id.create_time, mem->vary_id.serial);
285 -+ }
286 -+
287 -+ void
288 -+@@ -2112,3 +2159,15 @@
289 -+ if (e->mem_obj)
290 -+ e->mem_obj->serverfd = -1;
291 -+ }
292 -++
293 -++/* Initialise the vary_id with a new unique value */
294 -++static void
295 -++initVaryId(vary_id_t * vary_id)
296 -++{
297 -++ static unsigned int serial = 0;
298 -++
299 -++ debug(20, 3)("initVaryId: Initialising vary_id to %ld.%u\n",
300 -++ squid_curtime, serial);
301 -++ vary_id->create_time = squid_curtime;
302 -++ vary_id->serial = serial++;
303 -++}
304 -+diff -urNad squid-2.7.6~/src/store_client.c squid-2.7.6/src/store_client.c
305 -+--- squid-2.7.6~/src/store_client.c 2009-02-12 20:02:24.000000000 +0000
306 -++++ squid-2.7.6/src/store_client.c 2009-02-12 20:13:01.000000000 +0000
307 -+@@ -441,6 +441,9 @@
308 -+ mem->vary_headers = xstrdup(t->value);
309 -+ }
310 -+ break;
311 -++ case STORE_META_VARY_ID:
312 -++ memcpy(&mem->vary_id, t->value, sizeof(vary_id_t));
313 -++ break;
314 -+ default:
315 -+ debug(20, 2) ("WARNING: got unused STORE_META type %d\n", t->type);
316 -+ break;
317 -+diff -urNad squid-2.7.6~/src/store_swapmeta.c squid-2.7.6/src/store_swapmeta.c
318 -+--- squid-2.7.6~/src/store_swapmeta.c 2009-02-12 20:02:24.000000000 +0000
319 -++++ squid-2.7.6/src/store_swapmeta.c 2009-02-12 20:13:01.000000000 +0000
320 -+@@ -86,6 +86,7 @@
321 -+ vary = e->mem_obj->vary_headers;
322 -+ if (vary)
323 -+ T = storeSwapTLVAdd(STORE_META_VARY_HEADERS, vary, strlen(vary) + 1, T);
324 -++ storeSwapTLVAdd(STORE_META_VARY_ID, &e->mem_obj->vary_id, sizeof(vary_id_t), T);
325 -+ if (e->mem_obj->store_url)
326 -+ T = storeSwapTLVAdd(STORE_META_STOREURL, e->mem_obj->store_url, strlen(e->mem_obj->store_url) + 1, T);
327 -+ return TLV;
328 -+diff -urNad squid-2.7.6~/src/structs.h squid-2.7.6/src/structs.h
329 -+--- squid-2.7.6~/src/structs.h 2009-02-12 20:02:24.000000000 +0000
330 -++++ squid-2.7.6/src/structs.h 2009-02-12 20:13:01.000000000 +0000
331 -+@@ -1732,6 +1732,11 @@
332 -+ void (*Done) (RemovalPurgeWalker * walker);
333 -+ };
334 -+
335 -++struct _vary_id_t {
336 -++ time_t create_time;
337 -++ unsigned int serial;
338 -++};
339 -++
340 -+ /* This structure can be freed while object is purged out from memory */
341 -+ struct _MemObject {
342 -+ method_t method;
343 -+@@ -1772,6 +1777,7 @@
344 -+ StoreEntry *old_entry;
345 -+ time_t refresh_timestamp;
346 -+ time_t stale_while_revalidate;
347 -++ vary_id_t vary_id;
348 -+ };
349 -+
350 -+ struct _StoreEntry {
351 -+@@ -1954,6 +1960,7 @@
352 -+ char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */
353 -+ String vary_encoding; /* Used when varying entities are detected. Changes how the store key is calculated. */
354 -+ VaryData *vary;
355 -++ vary_id_t vary_id; /* Vary ID of the parent vary object */
356 -+ Array *etags; /* possible known entity tags (Vary MISS) */
357 -+ char *etag; /* current entity tag, cache validation */
358 -+ unsigned int done_etag:1; /* We have done clientProcessETag on this, don't attempt it again */
359 -+diff -urNad squid-2.7.6~/src/typedefs.h squid-2.7.6/src/typedefs.h
360 -+--- squid-2.7.6~/src/typedefs.h 2009-02-12 20:02:24.000000000 +0000
361 -++++ squid-2.7.6/src/typedefs.h 2009-02-12 20:13:01.000000000 +0000
362 -+@@ -226,6 +226,7 @@
363 -+ typedef struct _RemovalPolicySettings RemovalPolicySettings;
364 -+ typedef struct _errormap errormap;
365 -+ typedef struct _PeerMonitor PeerMonitor;
366 -++typedef struct _vary_id_t vary_id_t;
367 -+
368 -+ typedef struct _http_version_t http_version_t;
369 -+
370 -diff -urNad squid-2.7.9~/errors/Makefile.am squid-2.7.9/errors/Makefile.am
371 -+++ squid-2.7.9/errors/Makefile.am 2011-04-11 20:17:45.000000000 +0000
372 -@@ -45,8 +45,7 @@
373 - Turkish \
374 - Ukrainian-1251 \
375 - Ukrainian-koi8-u \
376 -- Ukrainian-utf8 \
377 -- Wikimedia
378 -+ Ukrainian-utf8
379 -
380 - install-data-local:
381 - @for l in $(INSTALL_LANGUAGES); do \
382 -diff -urNad squid-2.7.9~/helpers/basic_auth/SMB/smb_auth.sh squid-2.7.9/helpers/basic_auth/SMB/smb_auth.sh
383 -+++ squid-2.7.9/helpers/basic_auth/SMB/smb_auth.sh 2011-04-11 20:17:45.000000000 +0000
384 -@@ -24,7 +24,7 @@
385 - read AUTHSHARE
386 - read AUTHFILE
387 - read SMBUSER
388 --read -r SMBPASS
389 -+read SMBPASS
390 -
391 - # Find domain controller
392 - echo "Domain name: $DOMAINNAME"
393 -@@ -47,7 +47,7 @@
394 - addropt=""
395 - fi
396 - echo "Query address options: $addropt"
397 --dcip=`$SAMBAPREFIX/bin/nmblookup $addropt "$PASSTHROUGH#1c" | awk '/^[0-9.]+\..+ / { print $1 ; exit }'`
398 -+dcip=`$SAMBAPREFIX/bin/nmblookup $addropt "$PASSTHROUGH#1c" | awk '/^[0-9.]+ / { print $1 ; exit }'`
399 - echo "Domain controller IP address: $dcip"
400 - [ -n "$dcip" ] || exit 1
401 -
402 -diff -urNad squid-2.7.9~/src/client_side.c squid-2.7.9/src/client_side.c
403 -+++ squid-2.7.9/src/client_side.c 2011-04-11 20:17:45.000000000 +0000
404 -@@ -2325,6 +2325,16 @@
 9+diff -urNad squid-2.7.6~/src/client_side.c squid-2.7.6/src/client_side.c
 10+--- squid-2.7.6~/src/client_side.c 2009-02-12 20:02:24.000000000 +0000
 11+@@ -2331,6 +2331,16 @@
40512 http->sc = NULL;
40613 clientProcessMiss(http);
40714 return;
40815 + case VARY_EXPIRED:
409 -+ /* Variant is expired. Delete it and process as a miss. */
410 -+ debug(33, 2) ("clientProcessHit: Variant expired, deleting\n");
411 -+ storeClientUnregister(http->sc, e, http);
412 -+ http->sc = NULL;
413 -+ storeRelease(e);
414 -+ storeUnlockObject(e);
415 -+ http->entry = NULL;
416 -+ clientProcessMiss(http);
417 -+ return;
 16++ /* Variant is expired. Delete it and process as a miss. */
 17++ debug(33, 2) ("clientProcessHit: Variant expired, deleting\n");
 18++ storeClientUnregister(http->sc, e, http);
 19++ http->sc = NULL;
 20++ storeRelease(e);
 21++ storeUnlockObject(e);
 22++ http->entry = NULL;
 23++ clientProcessMiss(http);
 24++ return;
41825 }
41926 if (r->method == METHOD_PURGE) {
42027 http->entry = NULL;
421 -@@ -5078,6 +5088,8 @@
 28+@@ -5086,6 +5096,8 @@
42229 */
42330 vary = httpMakeVaryMark(request, entry->mem_obj->reply);
42431 if (vary) {
@@ -430,23 +34,23 @@
43135 return VARY_OTHER;
43236 } else {
43337 /* Ouch.. we cannot handle this kind of variance */
434 -@@ -5095,6 +5107,13 @@
 38+@@ -5103,6 +5115,13 @@
43539 /* This request was merged before we knew the outcome. Don't trust the response */
43640 /* restart vary processing from the beginning */
43741 return VARY_RESTART;
43842 + } else if (request->vary_id.create_time != entry->mem_obj->vary_id.create_time ||
439 -+ request->vary_id.serial != entry->mem_obj->vary_id.serial) {
 43++ request->vary_id.serial != entry->mem_obj->vary_id.serial) {
44044 + /* vary_id mismatch, the variant must be expired */
44145 + debug(33, 3) ("varyEvaluateMatch: vary ID mismatch, parent is %ld.%u, child is %ld.%u\n",
442 -+ request->vary_id.create_time, request->vary_id.serial,
443 -+ entry->mem_obj->vary_id.create_time, entry->mem_obj->vary_id.serial);
 46++ request->vary_id.create_time, request->vary_id.serial,
 47++ entry->mem_obj->vary_id.create_time, entry->mem_obj->vary_id.serial);
44448 + return VARY_EXPIRED;
44549 } else {
44650 return VARY_MATCH;
44751 }
448 -diff -urNad squid-2.7.9~/src/comm_generic.c squid-2.7.9/src/comm_generic.c
449 -+++ squid-2.7.9/src/comm_generic.c 2011-04-11 20:17:45.000000000 +0000
 52+diff -urNad squid-2.7.6~/src/comm_generic.c squid-2.7.6/src/comm_generic.c
 53+--- squid-2.7.6~/src/comm_generic.c 2009-02-12 20:02:24.000000000 +0000
45054 @@ -360,7 +360,7 @@
45155 int rc;
45256 double start = current_dtime;
@@ -456,21 +60,9 @@
45761
45862 if (msec > MAX_POLL_TIME)
45963 msec = MAX_POLL_TIME;
460 -diff -urNad squid-2.7.9~/src/defines.h squid-2.7.9/src/defines.h
461 -+++ squid-2.7.9/src/defines.h 2011-04-11 20:17:45.000000000 +0000
462 -@@ -259,7 +259,7 @@
463 -
464 - /* were to look for errors if config path fails */
465 - #ifndef DEFAULT_SQUID_ERROR_DIR
466 --#define DEFAULT_SQUID_ERROR_DIR "/usr/share/squid/errors/Wikimedia"
467 -+#define DEFAULT_SQUID_ERROR_DIR "/usr/local/squid/etc/errors"
468 - #endif
469 -
470 - /* gb_type operations */
471 -diff -urNad squid-2.7.9~/src/enums.h squid-2.7.9/src/enums.h
472 -+++ squid-2.7.9/src/enums.h 2011-04-11 20:17:45.000000000 +0000
 64+diff -urNad squid-2.7.6~/src/enums.h squid-2.7.6/src/enums.h
 65+--- squid-2.7.6~/src/enums.h 2009-02-12 20:02:24.000000000 +0000
47366 @@ -661,6 +661,7 @@
47467 STORE_META_VARY_HEADERS, /* Stores Vary request headers */
47568 STORE_META_STD_LFS, /* standard metadata in lfs format */
@@ -489,9 +81,9 @@
49082 };
49183
49284 /* Windows Port */
493 -diff -urNad squid-2.7.9~/src/http.c squid-2.7.9/src/http.c
494 -+++ squid-2.7.9/src/http.c 2011-04-11 20:17:45.000000000 +0000
 85+diff -urNad squid-2.7.6~/src/http.c squid-2.7.6/src/http.c
 86+--- squid-2.7.6~/src/http.c 2009-02-12 20:13:01.000000000 +0000
49587 @@ -229,7 +229,7 @@
49688 const char *v;
49789 #if HTTP_VIOLATIONS
@@ -501,80 +93,10 @@
50294 * and then checks if the specified flag is set. The main purpose
50395 * of this is to simplify the refresh pattern lookup
50496 */
505 -@@ -1350,7 +1350,6 @@
506 - }
507 - }
508 - /* append Cache-Control, add max-age if not there already */
509 --#if 0
510 - {
511 - HttpHdrCc *cc = httpHeaderGetCc(hdr_in);
512 - if (!cc)
513 -@@ -1370,7 +1369,6 @@
514 - httpHeaderPutCc(hdr_out, cc);
515 - httpHdrCcDestroy(cc);
516 - }
517 --#endif
518 - /* maybe append Connection: keep-alive */
519 - if (flags.keepalive || request->flags.pinned) {
520 - if (flags.proxying) {
521 -diff -urNad squid-2.7.9~/src/main.c squid-2.7.9/src/main.c
522 -+++ squid-2.7.9/src/main.c 2011-04-11 20:17:45.000000000 +0000
523 -@@ -376,21 +376,6 @@
524 - asnFreeMemory();
525 - }
526 -
527 --#if USE_UNLINKD
528 --static int
529 --needUnlinkd(void)
530 --{
531 -- int i;
532 -- int r = 0;
533 -- for (i = 0; i < Config.cacheSwap.n_configured; i++) {
534 -- if (strcmp(Config.cacheSwap.swapDirs[i].type, "ufs") == 0 ||
535 -- strcmp(Config.cacheSwap.swapDirs[i].type, "diskd") == 0)
536 -- r++;
537 -- }
538 -- return r;
539 --}
540 --#endif
541 --
542 - static void
543 - mainReconfigure(void)
544 - {
545 -@@ -414,9 +399,6 @@
546 - storeurlShutdown();
547 - locationRewriteShutdown();
548 - authenticateShutdown();
549 --#if USE_UNLINKD
550 -- unlinkdClose();
551 --#endif
552 - externalAclShutdown();
553 - refreshCheckShutdown();
554 - storeDirSync(); /* Flush pending I/O ops */
555 -@@ -460,9 +442,6 @@
556 - #if DELAY_POOLS
557 - clientReassignDelaypools();
558 - #endif
559 --#if USE_UNLINKD
560 -- if (needUnlinkd()) unlinkdInit();
561 --#endif
562 - serverConnectionsOpen();
563 - neighbors_init();
564 - storeDirOpenSwapLogs();
565 -@@ -635,7 +614,7 @@
566 -
567 - if (!configured_once) {
568 - #if USE_UNLINKD
569 -- if (needUnlinkd()) unlinkdInit();
570 -+ unlinkdInit();
571 - #endif
572 - urlInitialize();
573 - cachemgrInit();
574 -diff -urNad squid-2.7.9~/src/protos.h squid-2.7.9/src/protos.h
575 -+++ squid-2.7.9/src/protos.h 2011-04-11 20:17:45.000000000 +0000
576 -@@ -1471,7 +1471,7 @@
 97+diff -urNad squid-2.7.6~/src/protos.h squid-2.7.6/src/protos.h
 98+--- squid-2.7.6~/src/protos.h 2009-02-12 20:02:24.000000000 +0000
 99+@@ -1468,7 +1468,7 @@
577100 /* ETag support */
578101 void storeLocateVaryDone(VaryData * data);
579102 void storeLocateVary(StoreEntry * e, int offset, const char *vary_data, String accept_encoding, STLVCB * callback, void *cbdata);
@@ -583,9 +105,9 @@
584106
585107 /* New HTTP message parsing support */
586108 extern void HttpMsgBufInit(HttpMsgBuf * hmsg, const char *buf, size_t size);
587 -diff -urNad squid-2.7.9~/src/store.c squid-2.7.9/src/store.c
588 -+++ squid-2.7.9/src/store.c 2011-04-11 20:26:04.000000000 +0000
 109+diff -urNad squid-2.7.6~/src/store.c squid-2.7.6/src/store.c
 110+--- squid-2.7.6~/src/store.c 2009-02-12 20:02:24.000000000 +0000
589111 @@ -87,6 +87,7 @@
590112 static void storeEntryDereferenced(StoreEntry *);
591113 static int getKeyCounter(void);
@@ -594,7 +116,7 @@
595117 static OBJH storeCheckCachableStats;
596118 static EVH storeLateRelease;
597119
598 -@@ -348,8 +349,9 @@
 120+@@ -347,8 +348,9 @@
599121 StoreEntry *
600122 storeGet(const cache_key * key)
601123 {
@@ -606,30 +128,31 @@
607129 }
608130
609131 StoreEntry *
610 -@@ -454,6 +456,11 @@
 132+@@ -452,6 +454,11 @@
611133 storeAppendPrintf(state->e, "ETag: %s\n", state->etag);
612134 storeAppendPrintf(state->e, "VaryData: %s\n", state->vary_headers);
613135 }
614136 + if (state->oe) {
615137 + debug(11, 3)("free_AddVaryState: copying vary ID %ld.%u to new entry\n",
616 -+ state->oe->mem_obj->vary_id.create_time, state->oe->mem_obj->vary_id.serial);
 138++ state->oe->mem_obj->vary_id.create_time, state->oe->mem_obj->vary_id.serial);
617139 + state->e->mem_obj->vary_id = state->oe->mem_obj->vary_id;
618140 + }
619141 storeTimestampsSet(state->e);
620142 storeComplete(state->e);
621143 storeTimestampsSet(state->e);
622 -@@ -566,6 +573,7 @@
 144+@@ -563,6 +570,7 @@
623145 debug(11, 3) ("storeAddVaryReadOld: %p seen_offset=%" PRINTF_OFF_T " buf_offset=%d size=%d\n", data, state->seen_offset, (int) state->buf_offset, (int) size);
624146 if (size <= 0) {
625147 debug(11, 2) ("storeAddVaryReadOld: DONE\n");
626 -+ /* Call back to the destructor free_AddVaryState */
 148++ /* Call back to the destructor free_AddVaryState */
627149 cbdataFree(state);
628150 return;
629151 }
630 -@@ -710,11 +718,13 @@
 152+@@ -706,12 +714,13 @@
 153+
631154 /*
632155 * Adds/updates a Vary record.
633 - * For updates only one of key or etag needs to be specified
 156+- * For updates only one of key or etag needs to be specified
634157 - * At leas one of key or etag must be specified, preferably both.
635158 + * At least one of key or etag must be specified, preferably both.
636159 + * Returns the vary ID if it can be determined immediately, zero otherwise
@@ -642,7 +165,7 @@
643166 AddVaryState *state;
644167 request_flags flags = null_request_flags;
645168 CBDATA_INIT_TYPE_FREECB(AddVaryState, free_AddVaryState);
646 -@@ -739,6 +749,11 @@
 169+@@ -734,6 +743,11 @@
647170 httpReplySetHeaders(state->e->mem_obj->reply, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000);
648171 httpHeaderPutStr(&state->e->mem_obj->reply->header, HDR_VARY, vary);
649172 storeSetPublicKey(state->e);
@@ -654,24 +177,24 @@
655178 storeBuffer(state->e);
656179 httpReplySwapOut(state->e->mem_obj->reply, state->e);
657180 if (state->oe) {
658 -@@ -757,7 +772,15 @@
 181+@@ -752,7 +766,15 @@
659182 * modifications above)
660183 */
661184 /* Swap in the dummy Vary object */
662185 - if (!state->oe->mem_obj) {
663186 + if (state->oe->mem_obj) {
664 -+ vary_id = state->oe->mem_obj->vary_id;
665 -+ if (vary_id.create_time == 0 && vary_id.serial == 0) {
666 -+ initVaryId(&vary_id);
667 -+ state->oe->mem_obj->vary_id = vary_id;
 187++ vary_id = state->oe->mem_obj->vary_id;
 188++ if (vary_id.create_time == 0 && vary_id.serial == 0) {
 189++ initVaryId(&vary_id);
 190++ state->oe->mem_obj->vary_id = vary_id;
668191 + }
669192 + }
670193 + else {
671 -+ /* Swap in the dummy Vary object. vary_id is unknown for now */
 194++ /* Swap in the dummy Vary object. vary_id is unknown for now */
672195 storeCreateMemObject(state->oe, state->url);
673196 state->oe->mem_obj->method = method;
674197 }
675 -@@ -769,10 +792,10 @@
 198+@@ -764,10 +786,10 @@
676199 state->buf,
677200 storeAddVaryReadOld,
678201 state);
@@ -683,7 +206,7 @@
684207 }
685208
686209 static MemPool *VaryData_pool = NULL;
687 -@@ -815,9 +838,10 @@
 210+@@ -810,9 +832,10 @@
688211 static void
689212 storeLocateVaryCallback(LocateVaryState * state)
690213 {
@@ -695,7 +218,7 @@
696219 state->callback(data, state->callback_data);
697220 state->data = NULL; /* now owned by the caller */
698221 } else {
699 -@@ -994,6 +1018,7 @@
 222+@@ -989,6 +1012,7 @@
700223 StoreEntry *e2 = NULL;
701224 const cache_key *newkey;
702225 MemObject *mem = e->mem_obj;
@@ -703,7 +226,7 @@
704227 if (e->hash.key && !EBIT_TEST(e->flags, KEY_PRIVATE)) {
705228 if (EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
706229 EBIT_CLR(e->flags, KEY_EARLY_PUBLIC);
707 -@@ -1047,6 +1072,7 @@
 230+@@ -1042,6 +1066,7 @@
708231 newkey = storeKeyPublicByRequest(mem->request);
709232 if (mem->vary_headers && !EBIT_TEST(e->flags, KEY_EARLY_PUBLIC)) {
710233 String vary = StringNull;
@@ -711,45 +234,47 @@
712235 String varyhdr;
713236 varyhdr = httpHeaderGetList(&mem->reply->header, HDR_VARY);
714237 if (strBuf(varyhdr))
715 -@@ -1059,7 +1085,27 @@
 238+@@ -1054,8 +1079,28 @@
716239 strListAdd(&vary, strBuf(varyhdr), ',');
717240 stringClean(&varyhdr);
718241 #endif
719242 - storeAddVary(mem->store_url, mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
720 -+ /* Create or update the vary object */
721 -+ vary_id = storeAddVary(mem->store_url, mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
722 -+ if (vary_id.create_time) {
723 -+ mem->vary_id = vary_id;
724 -+ } else {
725 -+ /* Base vary object is not swapped in, so the vary_id is unknown.
726 -+ * Maybe we can cheat and use the vary_id from the request. If the
727 -+ * base object existed earlier in the request, it would have been
728 -+ * swapped in and stored at that time.
729 -+ */
730 -+ if (mem->request->vary_id.create_time) {
731 -+ mem->vary_id = mem->request->vary_id;
732 -+ } else {
733 -+ /* Nope, no luck. Store with zero vary_id, which will immediately
734 -+ * be treated as expired.
735 -+ * FIXME: make this work properly.
736 -+ */
737 -+ debug(20, 1) ("storeSetPublicKey: unable to determine vary_id for '%s'\n", mem->url);
738 -+ }
739 -+ }
 243+- stringClean(&vary);
 244++ /* Create or update the vary object */
 245++ vary_id = storeAddVary(mem->store_url, mem->url, mem->method, newkey, httpHeaderGetStr(&mem->reply->header, HDR_ETAG), strBuf(vary), mem->vary_headers, mem->vary_encoding);
 246++ if (vary_id.create_time) {
 247++ mem->vary_id = vary_id;
 248++ } else {
 249++ /* Base vary object is not swapped in, so the vary_id is unknown.
 250++ * Maybe we can cheat and use the vary_id from the request. If the
 251++ * base object existed earlier in the request, it would have been
 252++ * swapped in and stored at that time.
 253++ */
 254++ if (mem->request->vary_id.create_time) {
 255++ mem->vary_id = mem->request->vary_id;
 256++ } else {
 257++ /* Nope, no luck. Store with zero vary_id, which will immediately
 258++ * be treated as expired.
 259++ * FIXME: make this work properly.
 260++ */
 261++ debug(20, 1) ("storeSetPublicKey: unable to determine vary_id for '%s'\n", mem->url);
 262++ }
 263++ }
740264 +
741 - stringClean(&vary);
 265++ stringClean(&vary);
742266 }
743267 } else {
744 -@@ -1834,6 +1880,8 @@
 268+ newkey = storeKeyPublic(storeLookupUrl(e), mem->method);
 269+@@ -1829,6 +1874,8 @@
745270 debug(20, 1) ("MemObject->url: %p %s\n",
746271 mem->url,
747272 checkNullString(mem->url));
748273 + debug(20, 1) ("MemObject->vary_id: %ld.%u\n",
749 -+ mem->vary_id.create_time, mem->vary_id.serial);
 274++ mem->vary_id.create_time, mem->vary_id.serial);
750275 }
751276
752277 void
753 -@@ -2117,3 +2165,15 @@
 278+@@ -2112,3 +2159,15 @@
754279 if (e->mem_obj)
755280 e->mem_obj->serverfd = -1;
756281 }
@@ -765,9 +290,9 @@
766291 + vary_id->create_time = squid_curtime;
767292 + vary_id->serial = serial++;
768293 +}
769 -diff -urNad squid-2.7.9~/src/store_client.c squid-2.7.9/src/store_client.c
770 -+++ squid-2.7.9/src/store_client.c 2011-04-11 20:17:45.000000000 +0000
 294+diff -urNad squid-2.7.6~/src/store_client.c squid-2.7.6/src/store_client.c
 295+--- squid-2.7.6~/src/store_client.c 2009-02-12 20:02:24.000000000 +0000
771296 @@ -441,6 +441,9 @@
772297 mem->vary_headers = xstrdup(t->value);
773298 }
@@ -778,9 +303,9 @@
779304 default:
780305 debug(20, 2) ("WARNING: got unused STORE_META type %d\n", t->type);
781306 break;
782 -diff -urNad squid-2.7.9~/src/store_swapmeta.c squid-2.7.9/src/store_swapmeta.c
783 -+++ squid-2.7.9/src/store_swapmeta.c 2011-04-11 20:17:45.000000000 +0000
 307+diff -urNad squid-2.7.6~/src/store_swapmeta.c squid-2.7.6/src/store_swapmeta.c
 308+--- squid-2.7.6~/src/store_swapmeta.c 2009-02-12 20:02:24.000000000 +0000
784309 @@ -86,6 +86,7 @@
785310 vary = e->mem_obj->vary_headers;
786311 if (vary)
@@ -789,9 +314,9 @@
790315 if (e->mem_obj->store_url)
791316 T = storeSwapTLVAdd(STORE_META_STOREURL, e->mem_obj->store_url, strlen(e->mem_obj->store_url) + 1, T);
792317 return TLV;
793 -diff -urNad squid-2.7.9~/src/structs.h squid-2.7.9/src/structs.h
794 -+++ squid-2.7.9/src/structs.h 2011-04-11 20:17:45.000000000 +0000
 318+diff -urNad squid-2.7.6~/src/structs.h squid-2.7.6/src/structs.h
 319+--- squid-2.7.6~/src/structs.h 2009-02-12 20:02:24.000000000 +0000
795320 @@ -1732,6 +1732,11 @@
796321 void (*Done) (RemovalPurgeWalker * walker);
797322 };
@@ -816,14 +341,14 @@
817342 char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */
818343 String vary_encoding; /* Used when varying entities are detected. Changes how the store key is calculated. */
819344 VaryData *vary;
820 -+ vary_id_t vary_id;
 345++ vary_id_t vary_id; /* Vary ID of the parent vary object */
821346 Array *etags; /* possible known entity tags (Vary MISS) */
822347 char *etag; /* current entity tag, cache validation */
823348 unsigned int done_etag:1; /* We have done clientProcessETag on this, don't attempt it again */
824 -diff -urNad squid-2.7.9~/src/typedefs.h squid-2.7.9/src/typedefs.h
825 -+++ squid-2.7.9/src/typedefs.h 2011-04-11 20:17:45.000000000 +0000
826 -@@ -214,6 +214,7 @@
 349+diff -urNad squid-2.7.6~/src/typedefs.h squid-2.7.6/src/typedefs.h
 350+--- squid-2.7.6~/src/typedefs.h 2009-02-12 20:02:24.000000000 +0000
 351+@@ -226,6 +226,7 @@
827352 typedef struct _RemovalPolicySettings RemovalPolicySettings;
828353 typedef struct _errormap errormap;
829354 typedef struct _PeerMonitor PeerMonitor;
@@ -831,15 +356,3 @@
832357
833358 typedef struct _http_version_t http_version_t;
834359
835 -diff -urNad squid-2.7.9~/src/url.c squid-2.7.9/src/url.c
836 -+++ squid-2.7.9/src/url.c 2011-04-11 20:17:45.000000000 +0000
837 -@@ -364,7 +364,7 @@
838 - debug(23, 1) ("urlParse: Illegal character in hostname '%s'\n", host);
839 - return NULL;
840 - }
841 -- if (Config.appendDomain && !strchr(host, '.')&& strcasecmp(host,"localhost") != 0)
842 -+ if (Config.appendDomain && !strchr(host, '.'))
843 - strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN - strlen(host) - 1);
844 - /* remove trailing dots from hostnames */
845 - while ((l = strlen(host)) > 0 && host[--l] == '.')

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r46354Updated Tim Starling's X-Vary-Options patch to Squid 2.7.5mark16:39, 27 January 2009

Status & tagging log