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
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,
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 */
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 */
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 */
44 clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep)
46 HttpHeader *hdr = &rep->header;
47 - int is_hit = isTcpHit(http->log_type);
48 request_t *request = http->request;
50 /* but you might want to if you run Squid as an HTTP accelerator */
54 /* here: Keep-Alive is a field-name, not a connection directive! */
55 httpHeaderDelByName(hdr, "Keep-Alive");
56 /* remove Set-Cookie if a hit */
58 httpHeaderDelById(hdr, HDR_SET_COOKIE);
59 /* handle Connection header */
60 if (httpHeaderHas(hdr, HDR_CONNECTION)) {
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)) {
72 * Add a estimated Age header on cache hits.
76 * Remove any existing Age header sent by upstream caches
77 * (note that the existing header is passed along unmodified
80 * Add a estimated Age header on cache hits.
82 ! if (http->flags.hit) {
84 * Remove any existing Age header sent by upstream caches
85 * (note that the existing header is passed along unmodified
88 authenticateFixHeader(rep, request->auth_user_request, request, http->flags.accel, 0);
90 httpHeaderPutStrf(hdr, HDR_X_CACHE, "%s from %s",
91 ! is_hit ? "HIT" : "MISS", getMyHostname());
93 /* Append X-Cache-Lookup: -- temporary hack, to be removed @?@ @?@ */
94 httpHeaderPutStrf(hdr, HDR_X_CACHE_LOOKUP, "%s from %s:%d",
96 authenticateFixHeader(rep, request->auth_user_request, request, http->flags.accel, 0);
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",
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");
116 clientPurgeRequest(http);
119 + http->flags.hit = 1;
120 if (checkNegativeHit(e)) {
121 http->log_type = LOG_TCP_NEGATIVE_HIT;
122 clientSendMoreData(data, buf, size);
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
140 unsigned int internal:1;
141 unsigned int done_copying:1;
142 unsigned int purging:1;
143 + unsigned int hit:1;