On 21 Apr 2006, at 01:48, Henrik Nordstrom wrote:
> tor 2006-04-20 klockan 18:27 +1200 skrev Doug Dixon:
>
>> I've dug in the code and interpreted the if statement as follows: If
>> there are no occurrences of reload-into-ims or ignore-reload in any
>> refresh_patterns, and reload_into_ims is off, then flags.nocache_hack
>> will be false.
>
> Also the request will never get here if it's a reload request.
>
>> But doesn't this code mean that if I've got a reload-into-ims or
>> ignore-reload in at least one of my refresh_patterns, but the request
>> currently being analysed by this method does NOT have either of these
>> flags, (i.e. skips the first two else statements) that it will always
>> be force-reloaded?
>
> No, the request only gets this flag set if there if it is a client
> forced reload. See where the flag is set in client_side_request.cc.
>
> if (no_cache) {
> #if HTTP_VIOLATIONS
>
> if (Config.onoff.reload_into_ims)
> request->flags.nocache_hack = 1;
> else if (refresh_nocache_hack)
> request->flags.nocache_hack = 1;
> else
> #endif
>
> request->flags.nocache = 1;
> }
>
>
> where no_cache is true only if it's a "reload" request (no-cache and a
> few other optional hacks.. see the code above the fragment above for
> full details..).
>
> Regards
> Henrik
Thanks for your reply Henrik.
Yep, you're quite right :)
I guess what confused me is that refresh_nocache_hack in
client_side_request.cc is a global derived from the configuration
file - nothing to do with the request - and will be set if there are
_any_ refresh_patterns with ignore-reload or reload-into-ims (or if
reload_into_ims is on).
This global setting is then also set on the request if it's a reload
request.
So the meaning of request->flags.nocache_hack is really: "(a) this is
a reload request, and (b) the configuration file either has at least
one refresh_pattern with ignore-reload or reload-into-ims, or it has
reload_into_ims on."
Suppose you have the following refresh_patterns:
refresh_pattern dontmatchme 0 20% 4320 ignore-reload
refresh_pattern . 0 20% 4320
And Squid gets a "Cache-Control: nocache" request for http://
localhost:3128/index.html. The nocache_hack flag will be true for
this request, just because of the existence of another refresh_pattern.
Now I know the refresh.cc snippet quoted in my last email (sort of)
corrects this in the final else clause by setting the nocache flag,
but I think there may still be a problem if anything (specifically
client_side_reply.cc) relies on nocache_hack meaning anything apart
from "this is a reload request", since that's the only thing it
guarantees.
Apologies if this is too obscure and not a real problem... I'm really
just trying to understand the code :)
Thanks
Doug
PS. One tiny bug I've stumbled upon: refresh_nocache_hack isn't reset
on reconfigure. So if you remove refresh_pattern flags and then
reconfigure, refresh_nocache_hack is still true. Is something this
small worth raising a bugzilla for?
Received on Fri Apr 21 2006 - 04:10:00 MDT
This archive was generated by hypermail pre-2.1.9 : Mon May 01 2006 - 12:00:03 MDT