From: serassio <> Date: Sun, 27 Feb 2005 23:36:06 +0000 (+0000) Subject: Bug #1210: 403 replies and many other server generated errors should not X-Git-Tag: SQUID_3_0_PRE4~866 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5894ad28d7ab114335fa55ed107ae38e3cc464d0;p=thirdparty%2Fsquid.git Bug #1210: 403 replies and many other server generated errors should not be retried. (RFC2616) Retrying these is a slight violation to the RFC, even if it may be useful in certain complex hierarchy cases to work around misconfigured or malfunctioning peers. This patch adds a new squid.conf directive "retry_on_error" to revert back to the old mode of aggressively retry requests on errors. Forward port of 2.5 patch. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 9f994933b8..adb65c1e43 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.375 2005/02/19 16:03:33 hno Exp $ +# $Id: cf.data.pre,v 1.376 2005/02/27 16:36:06 serassio Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -3775,6 +3775,17 @@ DOC_START takes place if Squid fails to get a satisfying response. DOC_END +NAME: retry_on_error +TYPE: onoff +LOC: Config.retry.onerror +DEFAULT: off +DOC_START + If set to on Squid will automatically retry requests when + receiving an error response. This is mainly useful if you + are in a complex cache hierarchy to work around access + control errors. +DOC_END + NAME: snmp_port TYPE: ushort LOC: Config.Port.snmp diff --git a/src/forward.cc b/src/forward.cc index 7b8063dbff..d2916bee25 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.124 2004/12/20 16:30:35 robertc Exp $ + * $Id: forward.cc,v 1.125 2005/02/27 16:36:07 serassio Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -1111,18 +1111,19 @@ fwdReforwardableStatus(http_status s) { switch (s) { + case HTTP_BAD_GATEWAY: + + case HTTP_GATEWAY_TIMEOUT: + return 1; + case HTTP_FORBIDDEN: case HTTP_INTERNAL_SERVER_ERROR: case HTTP_NOT_IMPLEMENTED: - case HTTP_BAD_GATEWAY: - case HTTP_SERVICE_UNAVAILABLE: - - case HTTP_GATEWAY_TIMEOUT: - return 1; + return Config.retry.onerror; default: return 0; diff --git a/src/structs.h b/src/structs.h index 652f050c52..b48af134b1 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.508 2005/02/09 13:01:40 serassio Exp $ + * $Id: structs.h,v 1.509 2005/02/27 16:36:07 serassio Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -643,6 +643,7 @@ struct _SquidConfig struct { int maxtries; + int onerror; } retry;