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 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.

I'm not sure either.  Expires and Cache-Control have somewhat similar
function (section 14.9.3 discusses what happens when both are
present) so I thought it odd that one would be removed and not the
other.

Like Expires, Cache-Control does describe what to do with the content
in a response, so would seem reasonable to consider it a content
header.  On there other hand, I believe it's possible to include
Expires and Cache-Control on a 304 response that contains no content.

I'm not sure why Cache-Control isn't listed in 7.1 Entity Header
Fields, as Cache-Control can override Expires as noted in 14.21.

So, ya, I'm not sure.

> Does the current behaviour create a problem in your application?

Not really a problem.  I have a response that includes Last-Modified,
Content-Length, Cache-Control max-age, and Expires. In some cases that
content is further processed and becomes non-cacheable.  So I need to
remove all headers except Last-Modified (and even leaving
last-modified is questionable).

So I was trying to use remove_content_headers for a different
purpose, I suppose.


-- 
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.