1 Index: squid/src/cache_manager.c
2 diff -c squid/src/cache_manager.c:1.26 squid/src/cache_manager.c:1.26.2.1
3 *** squid/src/cache_manager.c:1.26 Fri Feb 23 13:59:50 2001
4 --- squid/src/cache_manager.c Thu Sep 1 16:14:45 2005
8 if ((mgr = cachemgrParseUrl(storeUrl(entry))) == NULL) {
9 err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND);
10 err->url = xstrdup(storeUrl(entry));
11 + err->request = requestLink(request);
12 errorAppendEntry(entry, err);
13 entry->expires = squid_curtime;
15 Index: squid/src/forward.c
16 diff -c squid/src/forward.c:1.82.2.15 squid/src/forward.c:1.82.2.16
17 *** squid/src/forward.c:1.82.2.15 Fri Mar 25 19:50:53 2005
18 --- squid/src/forward.c Thu Sep 1 16:14:45 2005
22 err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE);
23 err->dnsserver_msg = xstrdup(dns_error_message);
24 - err->request = requestLink(request);
25 fwdFail(fwdState, err);
26 comm_close(server_fd);
27 } else if (status != COMM_OK) {
31 err->host = xstrdup(request->host);
32 err->port = request->port;
34 - err->request = requestLink(request);
35 fwdFail(fwdState, err);
37 peerConnectFailed(fs->peer);
41 assert(fd == fwdState->server_fd);
42 if (entry->mem_obj->inmem_hi == 0) {
43 err = errorCon(ERR_CONNECT_FAIL, HTTP_GATEWAY_TIMEOUT);
44 - err->request = requestLink(fwdState->request);
45 err->xerrno = ETIMEDOUT;
46 fwdFail(fwdState, err);
51 debug(50, 4) ("fwdConnectStart: %s\n", xstrerror());
52 err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
54 - err->request = requestLink(fwdState->request);
55 fwdFail(fwdState, err);
56 fwdStateFree(fwdState);
62 debug(17, 3) ("fwdStartFail: %s\n", storeUrl(fwdState->entry));
63 err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE);
64 - err->request = requestLink(fwdState->request);
66 fwdFail(fwdState, err);
67 fwdStateFree(fwdState);
71 debug(17, 1) ("fwdDispatch: Cannot retrieve '%s'\n",
73 err = errorCon(ERR_UNSUP_REQ, HTTP_BAD_REQUEST);
74 - err->request = requestLink(request);
75 fwdFail(fwdState, err);
77 * Force a persistent connection to be closed because
82 fwdFail(FwdState * fwdState, ErrorState * errorState)
84 - assert(EBIT_TEST(fwdState->entry->flags, ENTRY_FWD_HDR_WAIT));
85 debug(17, 3) ("fwdFail: %s \"%s\"\n\t%s\n",
86 err_type_str[errorState->type],
87 httpStatusString(errorState->http_status),
93 errorStateFree(fwdState->err);
94 fwdState->err = errorState;
95 + if (!errorState->request)
96 + errorState->request = requestLink(fwdState->request);
100 Index: squid/src/ftp.c
101 diff -c squid/src/ftp.c:1.316.2.28 squid/src/ftp.c:1.316.2.29
102 *** squid/src/ftp.c:1.316.2.28 Wed Jun 22 04:42:34 2005
103 --- squid/src/ftp.c Thu Sep 1 16:14:45 2005
107 err = errorCon(ERR_FTP_FAILURE, HTTP_BAD_GATEWAY);
109 - err->request = requestLink(ftpState->request);
110 err->ftp.server_msg = ftpState->ctrl.message;
111 ftpState->ctrl.message = NULL;
112 if (ftpState->old_request)
114 Index: squid/src/gopher.c
115 diff -c squid/src/gopher.c:1.162.2.8 squid/src/gopher.c:1.162.2.9
116 *** squid/src/gopher.c:1.162.2.8 Tue Jan 11 23:04:01 2005
117 --- squid/src/gopher.c Thu Sep 1 16:14:45 2005
120 GopherStateData *gopherState = data;
121 StoreEntry *entry = gopherState->entry;
122 debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
123 ! if (entry->store_status == STORE_PENDING) {
124 ! if (entry->mem_obj->inmem_hi == 0) {
125 ! fwdFail(gopherState->fwdState,
126 ! errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT));
133 GopherStateData *gopherState = data;
134 StoreEntry *entry = gopherState->entry;
135 debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
136 ! fwdFail(gopherState->fwdState,
137 ! errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT));
143 debug(50, 1) ("gopherReadReply: error reading: %s\n", xstrerror());
144 if (ignoreErrno(errno)) {
145 commSetSelect(fd, COMM_SELECT_READ, gopherReadReply, data, 0);
146 ! } else if (entry->mem_obj->inmem_hi == 0) {
148 err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
150 ! err->url = xstrdup(storeUrl(entry));
151 ! errorAppendEntry(entry, err);
156 } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
158 ! err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE);
159 ! err->xerrno = errno;
160 ! err->url = xstrdup(gopherState->request);
161 ! errorAppendEntry(entry, err);
163 } else if (len == 0) {
164 /* Connection closed; retrieval done. */
166 debug(50, 1) ("gopherReadReply: error reading: %s\n", xstrerror());
167 if (ignoreErrno(errno)) {
168 commSetSelect(fd, COMM_SELECT_READ, gopherReadReply, data, 0);
171 err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
173 ! fwdFail(gopherState->fwdState, err);
176 } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
177 ! fwdFail(gopherState->fwdState, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE));
179 } else if (len == 0) {
180 /* Connection closed; retrieval done. */
186 ! err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
188 err->host = xstrdup(gopherState->req->host);
189 err->port = gopherState->req->port;
190 err->url = xstrdup(storeUrl(entry));
191 ! errorAppendEntry(entry, err);
194 memFree(buf, MEM_4K_BUF); /* Allocated by gopherSendRequest. */
199 ! err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY);
201 err->host = xstrdup(gopherState->req->host);
202 err->port = gopherState->req->port;
203 err->url = xstrdup(storeUrl(entry));
204 ! fwdFail(gopherState->fwdState, err);
207 memFree(buf, MEM_4K_BUF); /* Allocated by gopherSendRequest. */
211 gopher_request_parse(fwdState->request,
212 &gopherState->type_id, gopherState->request);
213 - #if OLD_PARSE_ERROR_CODE
216 - err = errorCon(ERR_INVALID_URL, HTTP_BAD_REQUEST);
217 - err->url = xstrdup(storeUrl(entry));
218 - errorAppendEntry(entry, err);
219 - gopherStateFree(-1, gopherState);
223 comm_add_close_handler(fd, gopherStateFree, gopherState);
224 if (((gopherState->type_id == GOPHER_INDEX) || (gopherState->type_id == GOPHER_CSO))
225 && (strchr(gopherState->request, '?') == NULL)) {
227 Index: squid/src/http.c
228 diff -c squid/src/http.c:1.384.2.30 squid/src/http.c:1.384.2.31
229 *** squid/src/http.c:1.384.2.30 Fri Mar 25 19:50:53 2005
230 --- squid/src/http.c Thu Sep 1 16:14:45 2005
233 StoreEntry *entry = httpState->entry;
234 debug(11, 4) ("httpTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
235 if (entry->store_status == STORE_PENDING) {
236 ! if (entry->mem_obj->inmem_hi == 0) {
237 ! fwdFail(httpState->fwd,
238 ! errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT));
244 StoreEntry *entry = httpState->entry;
245 debug(11, 4) ("httpTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
246 if (entry->store_status == STORE_PENDING) {
247 ! fwdFail(httpState->fwd,
248 ! errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT));
255 if (ignoreErrno(errno)) {
256 commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
257 ! } else if (entry->mem_obj->inmem_hi == 0) {
259 err = errorCon(ERR_READ_ERROR, HTTP_BAD_GATEWAY);
260 - err->request = requestLink((request_t *) request);
262 fwdFail(httpState->fwd, err);
267 } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
269 ! err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_BAD_GATEWAY);
270 ! err->xerrno = errno;
271 ! err->request = requestLink((request_t *) request);
272 ! fwdFail(httpState->fwd, err);
275 } else if (len == 0) {
278 if (ignoreErrno(errno)) {
279 commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
282 err = errorCon(ERR_READ_ERROR, HTTP_BAD_GATEWAY);
284 fwdFail(httpState->fwd, err);
287 } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
288 ! fwdFail(httpState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_BAD_GATEWAY));
291 } else if (len == 0) {
295 httpProcessReplyHeader(httpState, buf, len);
296 if (entry->mem_obj->reply->sline.status == HTTP_HEADER_TOO_LARGE) {
298 storeEntryReset(entry);
299 ! err = errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY);
300 ! err->request = requestLink((request_t *) request);
301 ! fwdFail(httpState->fwd, err);
302 httpState->fwd->flags.dont_retry = 1;
303 } else if (entry->mem_obj->reply->sline.status == HTTP_INVALID_HEADER && !(entry->mem_obj->reply->sline.version.major == 0 && entry->mem_obj->reply->sline.version.minor == 9)) {
305 storeEntryReset(entry);
306 ! err = errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY);
307 ! err->request = requestLink((request_t *) request);
308 ! fwdFail(httpState->fwd, err);
309 httpState->fwd->flags.dont_retry = 1;
311 fwdComplete(httpState->fwd);
314 httpProcessReplyHeader(httpState, buf, len);
315 if (entry->mem_obj->reply->sline.status == HTTP_HEADER_TOO_LARGE) {
316 storeEntryReset(entry);
317 ! fwdFail(httpState->fwd, errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY));
318 httpState->fwd->flags.dont_retry = 1;
319 } else if (entry->mem_obj->reply->sline.status == HTTP_INVALID_HEADER && !(entry->mem_obj->reply->sline.version.major == 0 && entry->mem_obj->reply->sline.version.minor == 9)) {
320 storeEntryReset(entry);
321 ! fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY));
322 httpState->fwd->flags.dont_retry = 1;
324 fwdComplete(httpState->fwd);
327 if (httpState->reply_hdr_state == 2) {
328 http_status s = entry->mem_obj->reply->sline.status;
329 if (s == HTTP_HEADER_TOO_LARGE) {
331 debug(11, 1) ("WARNING: %s:%d: HTTP header too large\n", __FILE__, __LINE__);
332 storeEntryReset(entry);
333 ! err = errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY);
334 ! err->request = requestLink((request_t *) request);
335 ! fwdFail(httpState->fwd, err);
336 httpState->fwd->flags.dont_retry = 1;
340 if (s == HTTP_INVALID_HEADER && !(entry->mem_obj->reply->sline.version.major == 0 && entry->mem_obj->reply->sline.version.minor == 9)) {
342 storeEntryReset(entry);
343 ! err = errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY);
344 ! err->request = requestLink((request_t *) request);
345 ! fwdFail(httpState->fwd, err);
346 httpState->fwd->flags.dont_retry = 1;
350 if (httpState->reply_hdr_state == 2) {
351 http_status s = entry->mem_obj->reply->sline.status;
352 if (s == HTTP_HEADER_TOO_LARGE) {
353 debug(11, 1) ("WARNING: %s:%d: HTTP header too large\n", __FILE__, __LINE__);
354 storeEntryReset(entry);
355 ! fwdFail(httpState->fwd, errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY));
356 httpState->fwd->flags.dont_retry = 1;
360 if (s == HTTP_INVALID_HEADER && !(entry->mem_obj->reply->sline.version.major == 0 && entry->mem_obj->reply->sline.version.minor == 9)) {
361 storeEntryReset(entry);
362 ! fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY));
363 httpState->fwd->flags.dont_retry = 1;
369 HttpStateData *httpState = data;
370 StoreEntry *entry = httpState->entry;
372 debug(11, 5) ("httpSendComplete: FD %d: size %d: errflag %d.\n",
373 fd, (int) size, errflag);
374 #if URL_CHECKSUM_DEBUG
378 if (errflag == COMM_ERR_CLOSING)
381 ! if (entry->mem_obj->inmem_hi == 0) {
382 ! err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY);
383 ! err->xerrno = errno;
384 ! err->request = requestLink(httpState->orig_request);
385 ! errorAppendEntry(entry, err);
391 if (errflag == COMM_ERR_CLOSING)
395 ! err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY);
396 ! err->xerrno = errno;
397 ! fwdFail(httpState->fwd, err);
404 HttpStateData *httpState = data;
405 StoreEntry *entry = httpState->entry;
407 debug(11, 5) ("httpSendRequestEntry: FD %d: size %d: errflag %d.\n",
408 fd, (int) size, errflag);
413 if (errflag == COMM_ERR_CLOSING)
416 ! if (entry->mem_obj->inmem_hi == 0) {
417 ! err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY);
418 ! err->xerrno = errno;
419 ! err->request = requestLink(httpState->orig_request);
420 ! errorAppendEntry(entry, err);
426 if (errflag == COMM_ERR_CLOSING)
430 ! err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY);
431 ! err->xerrno = errno;
432 ! fwdFail(httpState->fwd, err);
436 Index: squid/src/urn.c
437 diff -c squid/src/urn.c:1.68.2.3 squid/src/urn.c:1.68.2.4
438 *** squid/src/urn.c:1.68.2.3 Sun Sep 1 06:38:04 2002
439 --- squid/src/urn.c Thu Sep 1 16:14:45 2005
443 debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres);
444 err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND);
445 err->url = xstrdup(urlres);
446 + err->request = requestLink(r);
447 errorAppendEntry(e, err);
450 Index: squid/src/wais.c
451 diff -c squid/src/wais.c:1.138 squid/src/wais.c:1.138.2.1
452 *** squid/src/wais.c:1.138 Wed Oct 24 02:19:09 2001
453 --- squid/src/wais.c Thu Sep 1 16:14:45 2005
456 StoreEntry *entry = waisState->entry;
457 debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
458 if (entry->store_status == STORE_PENDING) {
459 ! if (entry->mem_obj->inmem_hi == 0) {
460 ! fwdFail(waisState->fwd,
461 ! errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT));
467 StoreEntry *entry = waisState->entry;
468 debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, storeUrl(entry));
469 if (entry->store_status == STORE_PENDING) {
470 ! fwdFail(waisState->fwd,
471 ! errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT));
477 waisReadReply, waisState, 0);
480 - EBIT_CLR(entry->flags, ENTRY_CACHABLE);
481 - storeReleaseRequest(entry);
482 err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
484 ! err->request = requestLink(waisState->request);
485 ! errorAppendEntry(entry, err);
488 } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
490 ! err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE);
491 ! err->xerrno = errno;
492 ! err->request = requestLink(waisState->request);
493 ! errorAppendEntry(entry, err);
495 } else if (len == 0) {
496 /* Connection closed; retrieval done. */
498 waisReadReply, waisState, 0);
501 err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
503 ! fwdFail(waisState->fwd, err);
506 } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
507 ! fwdFail(waisState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE));
509 } else if (len == 0) {
510 /* Connection closed; retrieval done. */
514 err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE);
516 ! err->request = requestLink(waisState->request);
517 ! errorAppendEntry(entry, err);
520 /* Schedule read reply. */
523 err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE);
525 ! fwdFail(waisState->fwd, err);
528 /* Schedule read reply. */
529 Index: squid/src/whois.c
530 diff -c squid/src/whois.c:1.16 squid/src/whois.c:1.16.2.1
531 *** squid/src/whois.c:1.16 Fri Apr 13 18:03:24 2001
532 --- squid/src/whois.c Thu Sep 1 16:14:45 2005
536 if (ignoreErrno(errno)) {
537 commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read);
538 ! } else if (mem->inmem_hi == 0) {
540 err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
542 fwdFail(p->fwd, err);
551 if (ignoreErrno(errno)) {
552 commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read);
555 err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
557 fwdFail(p->fwd, err);