Re: Why isn't Cache-Control removed with remove_content_headers?

Bill Moseley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
On Wed, Jan 25, 2006 at 06:04:38AM -0800, Bill Moseley wrote:
> On Wed, Jan 25, 2006 at 01:49:16AM -0800, Gisle Aas wrote:
> > Bill Moseley <[email protected]> writes:
> > 
> > > I've been setting both Cache-Control max-age and Expires.  But I
> > > noticed that remove_content_headers() only removes the
> > > @entity_headers which only includes Expires.
> > > 
> > > Should remove_content_headers remove both?
> > 
> > I'm not sure.  RFC 2616 section 4.5 starts out saying "There are a few
> > header fields which have general applicability for both request and
> > response messages, but which do not apply to the entity being
> > transferred." and Cache-Control is one of these.  This implies that
> > remove_content_headers shouldn't touch it.

Another twist on this.

I test If-Modified-Since and on 304 responses call remove_content_headers().
That removes the Expires headers but leaves the cache-control max-age
header.

I noticed that in the web logs that firefox was making If-Modified-Since
requests on every page load for documents that should have been
cached.


In Firefox, it seems, if an Expires header is not returned in the 304
response then it continues to use its old Expires header (which is
obviously expired already).  Opera, IE, and Safari seem to go ahead
and use the cache-control max-age setting to reset when to expire the
page.

rfc2616 says for 304 responses:

    "The response MUST include the following header fields:"
    ...

      - Expires, Cache-Control, and/or Vary, if the field-value might
        differ from that sent in any previous response for the same
        variant

Since the original 200 response included an Expires header, and since
the Expires headers should now be updated (the old date has past), it
would seem to be required in the 304 response.  Agreed?

I'm not clear which behavior is correct when the Expires header is
missing.  Without a cache-control max-age header it would seem to be
smart to continue to make the requests using If-Modified-Since since
the cache timeout has, well, expired.  But if the response includes a
max-age setting, I'm not clear if the client should update when to
expire the page.


-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.