r95001 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95000‎ | r95001 | r95002 >
Date:14:41, 19 August 2011
Author:catrope
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/includes/Feed.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Feed.php
@@ -239,12 +239,15 @@
240240 * but can also be called separately.
241241 */
242242 public function httpHeaders() {
243 - global $wgOut;
 243+ global $wgOut, $wgVaryOnXFPForAPI;
244244
245245 # We take over from $wgOut, excepting its cache header info
246246 $wgOut->disable();
247247 $mimetype = $this->contentType();
248248 header( "Content-type: $mimetype; charset=UTF-8" );
 249+ if ( $wgVaryOnXFPForAPI ) {
 250+ $wgOut->addVaryHeader( 'X-Forwarded-Proto' );
 251+ }
249252 $wgOut->sendCacheControl();
250253
251254 }
@@ -273,7 +276,7 @@
274277 $this->httpHeaders();
275278 echo '<?xml version="1.0"?>' . "\n";
276279 echo '<?xml-stylesheet type="text/css" href="' .
277 - htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion" ) ) .
 280+ htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion", PROTO_CURRENT ) ) .
278281 '"?' . ">\n";
279282 }
280283 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1753,9 +1753,9 @@
17541754 $wgUseXVO = false;
17551755
17561756 /** Add X-Forwarded-Proto to the Vary and X-Vary-Options headers for API
1757 - * requests. Use this if you have an SSL termination setup and want to split
1758 - * the cache between HTTP and HTTPS for API requests. This does not affect
1759 - * 'regular' requests.
 1757+ * requests and RSS/Atom feeds. Use this if you have an SSL termination setup
 1758+ * and need to split the cache between HTTP and HTTPS for API and feed requests
 1759+ * in order to prevent cache pollution. This does not affect 'normal' requests.
17601760 */
17611761 $wgVaryOnXFPForAPI = false;
17621762

Follow-up revisions

RevisionCommit summaryAuthorDate
r955051.17wmf1: Merge a truckload of HTTPS / prot rel URL fixes: r93847, r94990, r9...catrope19:32, 25 August 2011
r964751.18: MFT r94737, r94990, r95000, r95001, r95002, r95006, r95007, r95010, r95...catrope19:37, 7 September 2011

Status & tagging log