From: Brion Vibber Date: Sat, 31 Jan 2004 10:29:31 +0000 (+0000) Subject: Some cleanup to header output; use a forced expires header again to force some older... X-Git-Tag: 1.3.0beta1~1052 X-Git-Url: http://git.cyclocoop.org/geomaker.php?a=commitdiff_plain;h=581415895d52908d867a1d87aab9b36edd4398c7;p=lhc%2Fweb%2Fwiklou.git Some cleanup to header output; use a forced expires header again to force some older browsers (?); use private caching; separate out the local squid case from the general case --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 03c50c9bd4..4a5376a91a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -248,18 +248,27 @@ class OutputPage { } function sendCacheControl() { + global $wgUseSquid; + # FIXME: This header may cause trouble with some versions of Internet Explorer header( "Vary: Accept-Encoding, Cookie" ); if( $this->mLastModified != "" ) { - wfDebug( "** private caching; {$this->mLastModified} **\n", false ); - if (isset($_COOKIE[ini_get("session.name")] )){ - header( "Cache-Control: no-cache, must-revalidate, max-age=0" ); - } else { - header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" ); - } + if( $wgUseSquid && ! isset( $_COOKIE[ini_get( "session.name") ] ) ) { + # We'll purge the proxy cache for anons explicitly, but require end user agents + # to revalidate against the proxy on each visit. + wfDebug( "** local proxy caching; {$this->mLastModified} **\n", false ); + header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" ); + } else { + # We do want clients to cache if they can, but they *must* check for updates + # on revisiting the page. + wfDebug( "** private caching; {$this->mLastModified} **\n", false ); + header( "Expires: -1" ); + header( "Cache-Control: private, must-revalidate, max-age=0" ); + } header( "Last-modified: {$this->mLastModified}" ); } else { wfDebug( "** no caching **\n", false ); - header( "Cache-Control: no-cache" ); # Experimental - see below + header( "Expires: -1" ); + header( "Cache-Control: no-cache" ); header( "Pragma: no-cache" ); header( "Last-modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); }