r95016 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95015‎ | r95016 | r95017 >
Date:17:31, 19 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Expand some more URLs: for feeds, referers and the proxy script
Modified paths:
  • /trunk/phase3/includes/Feed.php (modified) (history)
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)
  • /trunk/phase3/includes/ProxyTools.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProxyTools.php
@@ -83,7 +83,7 @@
8484 if ( !$skip ) {
8585 $title = SpecialPage::getTitleFor( 'Blockme' );
8686 $iphash = md5( $ip . $wgProxyKey );
87 - $url = $title->getFullURL( 'ip='.$iphash );
 87+ $url = wfExpandUrl( $title->getFullURL( 'ip='.$iphash ), PROTO_HTTP );
8888
8989 foreach ( $wgProxyPorts as $port ) {
9090 $params = implode( ' ', array(
Index: trunk/phase3/includes/Feed.php
@@ -308,7 +308,7 @@
309309 ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
310310 <channel>
311311 <title><?php print $this->getTitle() ?></title>
312 - <link><?php print $this->getUrl() ?></link>
 312+ <link><?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?></link>
313313 <description><?php print $this->getDescription() ?></description>
314314 <language><?php print $this->getLanguage() ?></language>
315315 <generator>MediaWiki <?php print $wgVersion ?></generator>
@@ -324,12 +324,12 @@
325325 ?>
326326 <item>
327327 <title><?php print $item->getTitle() ?></title>
328 - <link><?php print $item->getUrl() ?></link>
 328+ <link><?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?></link>
329329 <guid<?php if( !$item->RSSIsPermalink ) print ' isPermaLink="false"' ?>><?php print $item->getUniqueId() ?></guid>
330330 <description><?php print $item->getDescription() ?></description>
331331 <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?>
332332 <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?>
333 - <?php if( $item->getComments() ) { ?><comments><?php print $item->getComments() ?></comments><?php }?>
 333+ <?php if( $item->getComments() ) { ?><comments><?php print wfExpandUrl( $item->getComments(), PROTO_CURRENT ) ?></comments><?php }?>
334334 </item>
335335 <?php
336336 }
@@ -368,8 +368,8 @@
369369 ?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>">
370370 <id><?php print $this->getFeedId() ?></id>
371371 <title><?php print $this->getTitle() ?></title>
372 - <link rel="self" type="application/atom+xml" href="<?php print $this->getSelfUrl() ?>"/>
373 - <link rel="alternate" type="text/html" href="<?php print $this->getUrl() ?>"/>
 372+ <link rel="self" type="application/atom+xml" href="<?php print wfExpandUrl( $this->getSelfUrl(), PROTO_CURRENT ) ?>"/>
 373+ <link rel="alternate" type="text/html" href="<?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?>"/>
374374 <updated><?php print $this->formatTime( wfTimestampNow() ) ?>Z</updated>
375375 <subtitle><?php print $this->getDescription() ?></subtitle>
376376 <generator>MediaWiki <?php print $wgVersion ?></generator>
@@ -410,7 +410,7 @@
411411 <entry>
412412 <id><?php print $item->getUniqueId() ?></id>
413413 <title><?php print $item->getTitle() ?></title>
414 - <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print $item->getUrl() ?>"/>
 414+ <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?>"/>
415415 <?php if( $item->getDate() ) { ?>
416416 <updated><?php print $this->formatTime( $item->getDate() ) ?>Z</updated>
417417 <?php } ?>
Index: trunk/phase3/includes/HttpFunctions.php
@@ -381,7 +381,7 @@
382382 }
383383
384384 if ( is_object( $wgTitle ) && !isset( $this->reqHeaders['Referer'] ) ) {
385 - $this->setReferer( $wgTitle->getFullURL() );
 385+ $this->setReferer( wfExpandUrl( $wgTitle->getFullURL(), PROTO_CURRENT ) );
386386 }
387387
388388 if ( !$this->noProxy ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r955051.17wmf1: Merge a truckload of HTTPS / prot rel URL fixes: r93847, r94990, r9...catrope19:32, 25 August 2011
r964851.18: MFT protocol-relative URL saga: r95014, r95016, r95017, r95627, r95651,...catrope20:14, 7 September 2011

Status & tagging log