http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95001

Revision: 95001
Author:   catrope
Date:     2011-08-19 14:41:35 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Make $wgVaryOnXFPForAPI apply to RSS/Atom feeds too, because they too use 
PROT_CURRENT. Make PROT_CURRENT usage explicit there too

Modified Paths:
--------------
    trunk/phase3/includes/DefaultSettings.php
    trunk/phase3/includes/Feed.php

Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php   2011-08-19 14:39:37 UTC (rev 
95000)
+++ trunk/phase3/includes/DefaultSettings.php   2011-08-19 14:41:35 UTC (rev 
95001)
@@ -1753,9 +1753,9 @@
 $wgUseXVO = false;
 
 /** Add X-Forwarded-Proto to the Vary and X-Vary-Options headers for API
- * requests. Use this if you have an SSL termination setup and want to split
- * the cache between HTTP and HTTPS for API requests. This does not affect
- * 'regular' requests.
+ * requests and RSS/Atom feeds. Use this if you have an SSL termination setup
+ * and need to split the cache between HTTP and HTTPS for API and feed requests
+ * in order to prevent cache pollution. This does not affect 'normal' requests.
  */
 $wgVaryOnXFPForAPI = false;
 

Modified: trunk/phase3/includes/Feed.php
===================================================================
--- trunk/phase3/includes/Feed.php      2011-08-19 14:39:37 UTC (rev 95000)
+++ trunk/phase3/includes/Feed.php      2011-08-19 14:41:35 UTC (rev 95001)
@@ -239,12 +239,15 @@
         * but can also be called separately.
         */
        public function httpHeaders() {
-               global $wgOut;
+               global $wgOut, $wgVaryOnXFPForAPI;
 
                # We take over from $wgOut, excepting its cache header info
                $wgOut->disable();
                $mimetype = $this->contentType();
                header( "Content-type: $mimetype; charset=UTF-8" );
+               if ( $wgVaryOnXFPForAPI ) {
+                       $wgOut->addVaryHeader( 'X-Forwarded-Proto' );
+               }
                $wgOut->sendCacheControl();
 
        }
@@ -273,7 +276,7 @@
                $this->httpHeaders();
                echo '<?xml version="1.0"?>' . "\n";
                echo '<?xml-stylesheet type="text/css" href="' .
-                       htmlspecialchars( wfExpandUrl( 
"$wgStylePath/common/feed.css?$wgStyleVersion" ) ) .
+                       htmlspecialchars( wfExpandUrl( 
"$wgStylePath/common/feed.css?$wgStyleVersion", PROTO_CURRENT ) ) .
                        '"?' . ">\n";
        }
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to