Added logic for setting Vary header in AjaxCachePolicy
authorDaniel Kinzler <daniel@users.mediawiki.org>
Tue, 15 Aug 2006 20:47:16 +0000 (20:47 +0000)
committerDaniel Kinzler <daniel@users.mediawiki.org>
Tue, 15 Aug 2006 20:47:16 +0000 (20:47 +0000)
includes/AjaxFunctions.php

index 4387a60..a1a4009 100644 (file)
@@ -72,15 +72,21 @@ function code2utf($num){
 
 class AjaxCachePolicy {
        var $policy;
+       var $vary;
 
-       function AjaxCachePolicy( $policy = null ) {
+       function AjaxCachePolicy( $policy = null, $vary = null ) {
                $this->policy = $policy;
+               $this->vary = $vary;
        }
 
        function setPolicy( $policy ) {
                $this->policy = $policy;
        }
 
+       function setVary( $vary ) {
+               $this->vary = $vary;
+       }
+
        function writeHeader() {
                header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                if ( is_null( $this->policy ) ) {
@@ -93,6 +99,10 @@ class AjaxCachePolicy {
                        header ("Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->policy ) . " GMT");
                        header ("Cache-Control: s-max-age={$this->policy},public,max-age={$this->policy}");
                }
+               
+               if ( $this->vary ) {
+                       header ( "Vary: " . $this->vary );
+               }
        }
 }