Expand some more URLs: for feeds, referers and the proxy script
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 17:31:40 +0000 (17:31 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 17:31:40 +0000 (17:31 +0000)
includes/Feed.php
includes/HttpFunctions.php
includes/ProxyTools.php

index 6f49931..3e0c913 100644 (file)
@@ -308,7 +308,7 @@ class RSSFeed extends ChannelFeed {
                ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
        <channel>
                <title><?php print $this->getTitle() ?></title>
-               <link><?php print $this->getUrl() ?></link>
+               <link><?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?></link>
                <description><?php print $this->getDescription() ?></description>
                <language><?php print $this->getLanguage() ?></language>
                <generator>MediaWiki <?php print $wgVersion ?></generator>
@@ -324,12 +324,12 @@ class RSSFeed extends ChannelFeed {
        ?>
                <item>
                        <title><?php print $item->getTitle() ?></title>
-                       <link><?php print $item->getUrl() ?></link>
+                       <link><?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?></link>
                        <guid<?php if( !$item->RSSIsPermalink ) print ' isPermaLink="false"' ?>><?php print $item->getUniqueId() ?></guid>
                        <description><?php print $item->getDescription() ?></description>
                        <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?>
                        <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?>
-                       <?php if( $item->getComments() ) { ?><comments><?php print $item->getComments() ?></comments><?php }?>
+                       <?php if( $item->getComments() ) { ?><comments><?php print wfExpandUrl( $item->getComments(), PROTO_CURRENT ) ?></comments><?php }?>
                </item>
 <?php
        }
@@ -368,8 +368,8 @@ class AtomFeed extends ChannelFeed {
                ?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>">
                <id><?php print $this->getFeedId() ?></id>
                <title><?php print $this->getTitle() ?></title>
-               <link rel="self" type="application/atom+xml" href="<?php print $this->getSelfUrl() ?>"/>
-               <link rel="alternate" type="text/html" href="<?php print $this->getUrl() ?>"/>
+               <link rel="self" type="application/atom+xml" href="<?php print wfExpandUrl( $this->getSelfUrl(), PROTO_CURRENT ) ?>"/>
+               <link rel="alternate" type="text/html" href="<?php print wfExpandUrl( $this->getUrl(), PROTO_CURRENT ) ?>"/>
                <updated><?php print $this->formatTime( wfTimestampNow() ) ?>Z</updated>
                <subtitle><?php print $this->getDescription() ?></subtitle>
                <generator>MediaWiki <?php print $wgVersion ?></generator>
@@ -410,7 +410,7 @@ class AtomFeed extends ChannelFeed {
        <entry>
                <id><?php print $item->getUniqueId() ?></id>
                <title><?php print $item->getTitle() ?></title>
-               <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print $item->getUrl() ?>"/>
+               <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?>"/>
                <?php if( $item->getDate() ) { ?>
                <updated><?php print $this->formatTime( $item->getDate() ) ?>Z</updated>
                <?php } ?>
index 638788b..33c2916 100644 (file)
@@ -381,7 +381,7 @@ class MWHttpRequest {
                }
 
                if ( is_object( $wgTitle ) && !isset( $this->reqHeaders['Referer'] ) ) {
-                       $this->setReferer( $wgTitle->getFullURL() );
+                       $this->setReferer( wfExpandUrl( $wgTitle->getFullURL(), PROTO_CURRENT ) );
                }
 
                if ( !$this->noProxy ) {
index f0c0c69..bc01a6e 100644 (file)
@@ -83,7 +83,7 @@ function wfProxyCheck() {
        if ( !$skip ) {
                $title = SpecialPage::getTitleFor( 'Blockme' );
                $iphash = md5( $ip . $wgProxyKey );
-               $url = $title->getFullURL( 'ip='.$iphash );
+               $url = wfExpandUrl( $title->getFullURL( 'ip='.$iphash ), PROTO_HTTP );
 
                foreach ( $wgProxyPorts as $port ) {
                        $params = implode( ' ', array(