You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Patrick <pa...@patoche.org> on 2001/04/04 11:47:24 UTC
no_cache & pragma/cache-control headers : confusion
Dear all,
There is some kind of confusion in my head, and the Eagle book seems
to me even more confusing. Any help appreciated.
First, I always thought that no_cache() does everything regarding
headers, and that you have just to turn it on or off.
However I discovered yesterday that, at least in my setup, even with
no_cache(0) I have
Pragma: no-cache
Cache-control: no-cache
which seems counter-intuitive to me.
I've checked the Eagle : it says that no_cache() only adds an Expires
field.
Ok. But then from where does the Pragma header come ?
About ->headers_out() it is specifically said : In addition, the
Pragma: no-cache idiom, used to tell browsers not to cache the
document, should be set indirectly using the no_cache() method.
So, that seems confusing to me, since the no_cache() methods seem not
to deal with Pragma headers.
Who sets Pragma/Cache-control headers and why are they like that by
default ?
How to override that (with headers_out ?) ?
TIA.
--
Patrick.
``C'est un monde qui n'a pas les moyens de ne plus avoir mal.''
Re: no_cache & pragma/cache-control headers : confusion
Posted by Andrew Ho <an...@tellme.com>.
Hello,
KO>From the code in Apache.xs, it seems like setting $r->no_cache(0) will
KO>unset the flag, but not remove the headers.
Well, the Expires header is also removed. But it's still broken; you can
verify this buggy behavior with this simple script:
use Apache ();
my $r = Apache->request;
$r->no_cache(1);
$r->no_cache(0);
$r->send_http_header;
With mod_perls 1.24_01 and 1.25 on Apaches 1.3.14 and 1.3.19, this call
leaves me with Pragma and Cache-Control headers. Sadly, the nice (but
broken as per above) no_cache() behavior of sending those two headers is
also undocumented in the mod_perl guide to begin with.
Humbly,
Andrew
----------------------------------------------------------------------
Andrew Ho http://www.tellme.com/ andrew@tellme.com
Engineer info@tellme.com Voice 650-930-9062
Tellme Networks, Inc. 1-800-555-TELL Fax 650-930-9101
----------------------------------------------------------------------
RE: no_cache & pragma/cache-control headers : confusion
Posted by Kyle Oppenheim <ky...@tellme.com>.
Apache (as in httpd) will set the 'Expires' header to the same value as the
'Date' header when no_cache is flagged in the request_rec. When your Perl
handler sets $r->no_cache(1), mod_perl (in Apache.xs) is setting the
'Pragma: no-cache' and 'Cache-control: no-cache' headers in addition to
setting the no_cache flag in the request_rec. From the code in Apache.xs,
it seems like setting $r->no_cache(0) will unset the flag, but not remove
the headers.
--
Kyle Oppenheim
Tellme Networks, Inc.
http://www.tellme.com
-----Original Message-----
From: modperl-return-15538-kyleo=tellme.com@apache.org
[mailto:modperl-return-15538-kyleo=tellme.com@apache.org]On Behalf Of
Patrick
Sent: Wednesday, April 04, 2001 2:47 AM
To: modperl@apache.org
Subject: no_cache & pragma/cache-control headers : confusion
Dear all,
There is some kind of confusion in my head, and the Eagle book seems
to me even more confusing. Any help appreciated.
First, I always thought that no_cache() does everything regarding
headers, and that you have just to turn it on or off.
However I discovered yesterday that, at least in my setup, even with
no_cache(0) I have
Pragma: no-cache
Cache-control: no-cache
which seems counter-intuitive to me.
I've checked the Eagle : it says that no_cache() only adds an Expires
field.
Ok. But then from where does the Pragma header come ?
About ->headers_out() it is specifically said : In addition, the
Pragma: no-cache idiom, used to tell browsers not to cache the
document, should be set indirectly using the no_cache() method.
So, that seems confusing to me, since the no_cache() methods seem not
to deal with Pragma headers.
Who sets Pragma/Cache-control headers and why are they like that by
default ?
How to override that (with headers_out ?) ?
TIA.
--
Patrick.
``C'est un monde qui n'a pas les moyens de ne plus avoir mal.''