You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Geoffrey Young <gy...@laserlink.net> on 2001/04/10 16:00:10 UTC

FW: no_cache & pragma/cache-control headers : confusion

whoops - I CC'd the wrong address the first time...

> -----Original Message-----
> From: Andrew Ho [mailto:andrew@tellme.com]
> Sent: Thursday, April 05, 2001 4:19 AM
> To: mod_perl List
> Subject: Re: no_cache & pragma/cache-control headers : confusion
> 
> 
> 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.

the below patch seems to fix this 

--Geoff

Index: Apache.xs
===================================================================
RCS file: /home/cvspublic/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.119
diff -u -r1.119 Apache.xs
--- Apache.xs   2000/12/29 17:10:08     1.119
+++ Apache.xs   2001/04/10 13:52:56
@@ -1890,6 +1890,10 @@
        ap_table_setn(r->headers_out, "Pragma", "no-cache");
        ap_table_setn(r->headers_out, "Cache-control", "no-cache");
     }
+    else {
+       ap_table_unset(r->headers_out, "Pragma");
+       ap_table_unset(r->headers_out, "Cache-control");
+    }
 
     OUTPUT:
     RETVAL

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: FW: no_cache & pragma/cache-control headers : confusion

Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 10 Apr 2001, Geoffrey Young wrote:

> +    else {
> +       ap_table_unset(r->headers_out, "Pragma");
> +       ap_table_unset(r->headers_out, "Cache-control");
> +    }

thanks, applied.  but changed to 'else if (items > 1)', so '$r->no_cache'
without a set value does not trigger the unsetting.

also wondering, can the `Pragma' header used for anything other than
'no-cache' ?  don't want to wipe out something we shouldn't be.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org