From: hno <> Date: Wed, 3 May 2000 02:24:44 +0000 (+0000) Subject: hno squid-2.3.DEVEL3.internal_range_limit-2.patch X-Git-Tag: SQUID_3_0_PRE1~2010 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=288c06ce35d5c9de6ec0f0c6e5b495ab60c01956;p=thirdparty%2Fsquid.git hno squid-2.3.DEVEL3.internal_range_limit-2.patch Squid-2.3.DEVEL3: Range request could cause bandwidth spikes Range requests to servers/objects not supporting range requests could cause bandwidth spikes and/or negative hit ratio. --- diff --git a/ChangeLog b/ChangeLog index 6bc0136dbe..421f6770b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,9 @@ Changes to Squid-2.4.DEVEL3 (): - PURGE now also purges the DNS cache - HEAD on FTP objects no longer retreives the whole object - More cleanups of the dstdomain ACL type + - Squid no longer tries to do Range internally if it is not supported + by the origin server. Doing so could cause bandwidth spikes and/or + negative hit ratio. Changes to Squid-2.4.DEVEL2 (): diff --git a/src/client_side.cc b/src/client_side.cc index 56bf036de9..11f1641cdd 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.477 2000/05/02 20:18:21 hno Exp $ + * $Id: client_side.cc,v 1.478 2000/05/02 20:24:44 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1076,7 +1076,9 @@ clientBuildRangeHeader(clientHttpRequest * http, HttpReply * rep) { HttpHeader *hdr = rep ? &rep->header : 0; const char *range_err = NULL; - assert(http->request->range); + request_t *request = http->request; + int is_hit = isTcpHit(http->log_type); + assert(request->range); /* check if we still want to do ranges */ if (!rep) range_err = "no [parse-able] reply"; @@ -1094,6 +1096,11 @@ clientBuildRangeHeader(clientHttpRequest * http, HttpReply * rep) range_err = "canonization failed"; else if (httpHdrRangeIsComplex(http->request->range)) range_err = "too complex range header"; + else if (!request->flags.cachable) /* from we_do_ranges in http.c */ + range_err = "non-cachable request"; + else if (!is_hit && Config.rangeOffsetLimit < httpHdrRangeFirstOffset(request->range) + && Config.rangeOffsetLimit != -1) /* from we_do_ranges in http.c */ + range_err = "range outside range_offset_limit"; /* get rid of our range specs on error */ if (range_err) { debug(33, 3) ("clientBuildRangeHeader: will not do ranges: %s.\n", range_err);