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

Revision: 94990
Author:   catrope
Date:     2011-08-19 08:56:39 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Followup r94754: move protocol expansion from getIRCLine() to inside 
getInternalUrl(); these internal URLs should always be fully qualified. 
Effectively this means that if $wgServer is protocol-relative and 
$wgInternalServer either isn't set or is also protocol relative (but it really 
shouldn't be the latter!), we'll add http:// to URLs used for Squid purging and 
in IRC lines. If people want those to be https:// instead, they can set 
$wgInternalServer accordingly.

We should really, really break the connection between internal URLs used for 
Squid purges and URLs used for IRC, and use the latter in e-mails as well. This 
was briefly discussed in the CR comments on r44412 and I'll be working on that 
today.

Modified Paths:
--------------
    trunk/phase3/includes/RecentChange.php
    trunk/phase3/includes/Title.php

Modified: trunk/phase3/includes/RecentChange.php
===================================================================
--- trunk/phase3/includes/RecentChange.php      2011-08-19 07:35:11 UTC (rev 
94989)
+++ trunk/phase3/includes/RecentChange.php      2011-08-19 08:56:39 UTC (rev 
94990)
@@ -707,9 +707,7 @@
                        // XXX: *HACK^2* the preg_replace() undoes much of what 
getInternalURL() does, but we 
                        // XXX: need to call it so that URL paths on the 
Wikimedia secure server can be fixed
                        // XXX: by a custom GetInternalURL hook --vyznev 
2008-12-10
-                       // XXX: Also, getInternalUrl() may return a 
protocol-relative URL.
-                       // XXX: In that case, expand it to an HTTP URL, even if 
this is an HTTPS request --catrope 2011-08-17
-                       $url = preg_replace( '/title=[^&]*&/', '', wfExpandUrl( 
$titleObj->getInternalURL( $url ), PROTO_HTTP ) );
+                       $url = preg_replace( '/title=[^&]*&/', '', 
$titleObj->getInternalURL( $url ) );
                }
 
                if( isset( $this->mExtra['oldSize'] ) && isset( 
$this->mExtra['newSize'] ) ) {

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     2011-08-19 07:35:11 UTC (rev 94989)
+++ trunk/phase3/includes/Title.php     2011-08-19 08:56:39 UTC (rev 94990)
@@ -992,6 +992,10 @@
         * Get the URL form for an internal link.
         * - Used in various Squid-related code, in case we have a different
         * internal hostname for the server from the exposed one.
+        * 
+        * This uses $wgInternalServer to qualify the path, or $wgServer
+        * if $wgInternalServer is not set. If the server variable used is
+        * protocol-relative, the URL will be expanded to http://
         *
         * @param $query String an optional query string
         * @param $variant String language variant of url (for sr, zh..)
@@ -1000,7 +1004,7 @@
        public function getInternalURL( $query = '', $variant = false ) {
                global $wgInternalServer, $wgServer;
                $server = $wgInternalServer !== false ? $wgInternalServer : 
$wgServer;
-               $url = $server . $this->getLocalURL( $query, $variant );
+               $url = wfExpandUrl( $server . $this->getLocalURL( $query, 
$variant ), PROTO_HTTP );
                wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query ) );
                return $url;
        }


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

Reply via email to