httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [PATCH]: mod_cache: don't store headers that will never be used
Date Sun, 29 Jul 2007 19:12:09 GMT
On 7/29/07, Graham Leggett <minfrin@sharp.fm> wrote:
> Niklas Edmundsson wrote:
>
> > The solution is to NOT rewrite the on-disk headers when the following
> > conditions are true:
> > - The body is NOT stale (ie. HTTP_NOT_MODIFIED when revalidating)
> > - The on-disk header hasn't expired.
> > - The request has max-age=0
> >
> > This is perfectly OK with RFC2616 10.3.5 and does NOT break anything.
>
>  From 10.3.5: "If a cache uses a received 304 response to update a cache
> entry, the cache MUST update the entry to reflect any new field values
> given in the response." This sinks this, unless I am misunderstanding
> something.

I think his point is that the headers will NEVER be used, so it
doesn't matter whether or not you store them in the cache. There is no
point in storing the headers just based on the technicality that the
spec says to do so if they will never be used for anything. (Or, in
other words, even if you are violating the literal spec, you are only
doing so with respect to the internal state of the cache -- something
that is never visible to the outside world and hence can't really
matter for spec conformance.)

What needs to be validated is if, in fact, the headers with NEVER be
used. Is there any configuration directive or client request that
could make mod_cache use headers from the cache when max-age=0? I
don't think so.

>
> I suspect there is a more robust way of solving this:
>
> In order to determine whether the entity was cached in the first place,
> the cache would have had to read the headers in from disk.
>
> Fast forward to after the 304 response was received, we have the headers
>   as received from the backend.
>
> Compare these two sets of headers, and if they are equal, there is no
> need to rewrite them to disk.

Nah, I bet there are many times where the two sets of headers will
differ (based on Date alone, for example, or Expires, which will get
updated to match the max-age=0) but you still don't care about the new
headers because they won't be used for future requests.

Joshua.

Mime
View raw message