[squid-dev] Questionable default 'range_offset_limit ' option

Amos Jeffries squid3 at treenet.co.nz
Fri Mar 19 11:41:27 UTC 2021


On 19/03/21 6:13 pm, Joshua Rogers wrote:
> Hi there,
> 
> 
> According to http://www.squid-cache.org/Doc/config/range_offset_limit/ 
> <http://www.squid-cache.org/Doc/config/range_offset_limit/>, 
> 'range_offset_limit' is by default 'none'.
> 

This directive is an access control like http_access, but instead of 
doing an allow/deny action is sets a limit (or not) on any matching 
transactions.

The 'none' value prevents this directive setting a limit. For example; 
to apply a 5KB limit on Internet visitors, a 10KB limit on LAN clients, 
and no limit on localhost traffic would look like this:

   range_offset_limit none localhost
   range_offset_limit 10 KB localnet
   range_offset_limit 5 KB
(there is an implicit 'all' if you don't specify any ACLs to match)


So the default for this directive - if you don't configure any 
range_offset_limit lines at all. Is not to set/force a limit.



> However in HttpRequest.cc, it says it is by default 0:
> rangeOffsetLimit = 0; // default value for rangeOffsetLimit
> 

HttpRequest::rangeOffsetLimit is the limit actually being use on one 
specific transaction.

The default here is 0 bytes. Meaning disabled. Only the bytes requested 
by the client will be fetched. "range_offset_limit none" means that this 
non-limit will stay unchanged.


> and then in HttpHdrRange.cc:
>      if (limit == 0)
>          /* 0 == disabled */
>          return true;
> 
>      if (-1 == limit)
>          /* 'none' == forced */
>          return false;
> 
> 
> So is 'none' -1, or 0 in this case?:)
> 

"none" has different values depending on what type of thing it is the 
value of.


Amos


More information about the squid-dev mailing list