httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [PATCH] mod_disk cached fixed
Date Wed, 04 Aug 2004 17:20:13 GMT

> Brian Akins wrote...
> Serving cached content:
> - lookup uri in cache (via md5?).
> - check varies - a list of headers to vary on
> - caculate new key (md5) based on uri and clients value of these headers
> - lookup new uri in cache
> - continue as normal

Don't forget that you can't just 'MD5' a header from one response and
compare it to an 'MD5' value for same header field from another response.

A "Vary:" check does not mean 'has to be exactly the same as the other one'.

It just has to be 'semantically' different.

You can have a header value that is formatted differently from another
and it is still, essentially, the SAME as another and does NOT VARY.

That includes different amounts of whitespace and a different
'ordering' of the 'values'. As long as the 'values' are the SAME
with regards to another header, then the header fields do

The only way to do it right is to be able to parse each and every
header (correctly) according o BNC and and compare them 
that way. Syntax or whitespace differences don't automatically
mean a header 'Varies' at all.

> The thing that sucks is if you vary on User-Agent.  You wind up with a 
> ton of entries per uri.  

Yep. That's how 'Muli-Variants' works. There might be very good
reasons why every 'Varying' User-Agent needs a different 'Variant'
of the same response.

> I cheated in another modules by "varying" on an 
> environmental variable.  Kind of like this:
> BrowserMatch ".*MSIE [1-3]|MSIE [1-5].*Mac.*|^Mozilla/[1-4].*Nav" no-gzip
> and just "vary" on no-gzip (1 or 0), but this may be hard to do just 
> using headers...

It's not hard to do at all... question would be whether it's ever
the 'right' thing to do.

The actual compressed content for different 'User-Agents' might
actually 'Vary:' as well so no one single compressed version of
a response should be used to satisfy all non-no-gzip requests
if there is actually a 'Vary: User-Agent' rule involved.

It's pretty hard to 'cheat' on 'Vary:'

That's why it remains one of the least-supported features of HTTP.

It's kind of an 'all or nothing' deal whereby if you can't do it ALL
correctly... then might as well do what most products do and
treat ANY 'Vary:' header as if it was 'Vary: *'  ( Vary: STAR )
and don't even bother trying to cache it.

Kevin Kiley

View raw message