]>
Commit | Line | Data |
---|---|---|
657376c6 | 1 | Index: squid/src/client_side.c |
2 | diff -c squid/src/client_side.c:1.561.2.71 squid/src/client_side.c:1.561.2.72 | |
3 | *** squid/src/client_side.c:1.561.2.71 Sun Feb 20 12:07:45 2005 | |
4 | --- squid/src/client_side.c Wed Mar 2 19:18:29 2005 | |
5 | *************** | |
6 | *** 572,577 **** | |
7 | --- 572,578 ---- | |
8 | } | |
9 | } else { | |
10 | /* the client can handle this reply, whatever it is */ | |
11 | + http->flags.hit = 0; | |
12 | http->log_type = LOG_TCP_REFRESH_MISS; | |
13 | if (HTTP_NOT_MODIFIED == mem->reply->sline.status) { | |
14 | httpReplyUpdateOnNotModified(http->old_entry->mem_obj->reply, | |
15 | *************** | |
16 | *** 1265,1271 **** | |
17 | HttpHeader *hdr = rep ? &rep->header : 0; | |
18 | const char *range_err = NULL; | |
19 | request_t *request = http->request; | |
20 | - int is_hit = isTcpHit(http->log_type); | |
21 | assert(request->range); | |
22 | /* check if we still want to do ranges */ | |
23 | if (!rep) | |
24 | --- 1266,1271 ---- | |
25 | *************** | |
26 | *** 1286,1292 **** | |
27 | range_err = "too complex range header"; | |
28 | else if (!request->flags.cachable) /* from we_do_ranges in http.c */ | |
29 | range_err = "non-cachable request"; | |
30 | ! else if (!is_hit && httpHdrRangeOffsetLimit(http->request->range)) | |
31 | range_err = "range outside range_offset_limit"; | |
32 | /* get rid of our range specs on error */ | |
33 | if (range_err) { | |
34 | --- 1286,1292 ---- | |
35 | range_err = "too complex range header"; | |
36 | else if (!request->flags.cachable) /* from we_do_ranges in http.c */ | |
37 | range_err = "non-cachable request"; | |
38 | ! else if (!http->flags.hit && httpHdrRangeOffsetLimit(http->request->range)) | |
39 | range_err = "range outside range_offset_limit"; | |
40 | /* get rid of our range specs on error */ | |
41 | if (range_err) { | |
42 | *************** | |
43 | *** 1343,1349 **** | |
44 | clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep) | |
45 | { | |
46 | HttpHeader *hdr = &rep->header; | |
47 | - int is_hit = isTcpHit(http->log_type); | |
48 | request_t *request = http->request; | |
49 | #if DONT_FILTER_THESE | |
50 | /* but you might want to if you run Squid as an HTTP accelerator */ | |
51 | --- 1343,1348 ---- | |
52 | *************** | |
53 | *** 1354,1360 **** | |
54 | /* here: Keep-Alive is a field-name, not a connection directive! */ | |
55 | httpHeaderDelByName(hdr, "Keep-Alive"); | |
56 | /* remove Set-Cookie if a hit */ | |
57 | ! if (is_hit) | |
58 | httpHeaderDelById(hdr, HDR_SET_COOKIE); | |
59 | /* handle Connection header */ | |
60 | if (httpHeaderHas(hdr, HDR_CONNECTION)) { | |
61 | --- 1353,1359 ---- | |
62 | /* here: Keep-Alive is a field-name, not a connection directive! */ | |
63 | httpHeaderDelByName(hdr, "Keep-Alive"); | |
64 | /* remove Set-Cookie if a hit */ | |
65 | ! if (http->flags.hit) | |
66 | httpHeaderDelById(hdr, HDR_SET_COOKIE); | |
67 | /* handle Connection header */ | |
68 | if (httpHeaderHas(hdr, HDR_CONNECTION)) { | |
69 | *************** | |
70 | *** 1383,1389 **** | |
71 | /* | |
72 | * Add a estimated Age header on cache hits. | |
73 | */ | |
74 | ! if (is_hit) { | |
75 | /* | |
76 | * Remove any existing Age header sent by upstream caches | |
77 | * (note that the existing header is passed along unmodified | |
78 | --- 1382,1388 ---- | |
79 | /* | |
80 | * Add a estimated Age header on cache hits. | |
81 | */ | |
82 | ! if (http->flags.hit) { | |
83 | /* | |
84 | * Remove any existing Age header sent by upstream caches | |
85 | * (note that the existing header is passed along unmodified | |
86 | *************** | |
87 | *** 1431,1437 **** | |
88 | authenticateFixHeader(rep, request->auth_user_request, request, http->flags.accel, 0); | |
89 | /* Append X-Cache */ | |
90 | httpHeaderPutStrf(hdr, HDR_X_CACHE, "%s from %s", | |
91 | ! is_hit ? "HIT" : "MISS", getMyHostname()); | |
92 | #if USE_CACHE_DIGESTS | |
93 | /* Append X-Cache-Lookup: -- temporary hack, to be removed @?@ @?@ */ | |
94 | httpHeaderPutStrf(hdr, HDR_X_CACHE_LOOKUP, "%s from %s:%d", | |
95 | --- 1430,1436 ---- | |
96 | authenticateFixHeader(rep, request->auth_user_request, request, http->flags.accel, 0); | |
97 | /* Append X-Cache */ | |
98 | httpHeaderPutStrf(hdr, HDR_X_CACHE, "%s from %s", | |
99 | ! http->flags.hit ? "HIT" : "MISS", getMyHostname()); | |
100 | #if USE_CACHE_DIGESTS | |
101 | /* Append X-Cache-Lookup: -- temporary hack, to be removed @?@ @?@ */ | |
102 | httpHeaderPutStrf(hdr, HDR_X_CACHE_LOOKUP, "%s from %s:%d", | |
103 | *************** | |
104 | *** 1505,1510 **** | |
105 | --- 1504,1510 ---- | |
106 | MemObject *mem; | |
107 | request_t *r = http->request; | |
108 | debug(33, 3) ("clientCacheHit: %s, %d bytes\n", http->uri, (int) size); | |
109 | + http->flags.hit = 0; | |
110 | if (http->entry == NULL) { | |
111 | memFree(buf, MEM_CLIENT_SOCK_BUF); | |
112 | debug(33, 3) ("clientCacheHit: request aborted\n"); | |
113 | *************** | |
114 | *** 1592,1597 **** | |
115 | --- 1592,1598 ---- | |
116 | clientPurgeRequest(http); | |
117 | return; | |
118 | } | |
119 | + http->flags.hit = 1; | |
120 | if (checkNegativeHit(e)) { | |
121 | http->log_type = LOG_TCP_NEGATIVE_HIT; | |
122 | clientSendMoreData(data, buf, size); | |
123 | *************** | |
124 | *** 2276,2281 **** | |
125 | --- 2277,2283 ---- | |
126 | char *url = http->uri; | |
127 | request_t *r = http->request; | |
128 | ErrorState *err = NULL; | |
129 | + http->flags.hit = 0; | |
130 | debug(33, 4) ("clientProcessOnlyIfCachedMiss: '%s %s'\n", | |
131 | RequestMethodStr[r->method], url); | |
132 | http->al.http.code = HTTP_GATEWAY_TIMEOUT; | |
133 | Index: squid/src/structs.h | |
134 | diff -c squid/src/structs.h:1.408.2.37 squid/src/structs.h:1.408.2.38 | |
135 | *** squid/src/structs.h:1.408.2.37 Tue Feb 22 17:06:35 2005 | |
136 | --- squid/src/structs.h Wed Mar 2 19:18:29 2005 | |
137 | *************** | |
138 | *** 1099,1104 **** | |
139 | --- 1099,1105 ---- | |
140 | unsigned int internal:1; | |
141 | unsigned int done_copying:1; | |
142 | unsigned int purging:1; | |
143 | + unsigned int hit:1; | |
144 | } flags; | |
145 | struct { | |
146 | http_status status; |