http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94996
Revision: 94996
Author: catrope
Date: 2011-08-19 13:25:43 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Reverse a bad decision in r93820, which added a comment to
WebRequest::getFullRequestURL() saying it would return protocol-relative URLs
if $wgServer is protocol-relative. This behavior makes no sense, though, and
most callers expect fully qualified URLs. So make it return a fully qualified
URL and update the one caller that expected the return value would be
compatible with getFullURL()
Modified Paths:
--------------
trunk/phase3/includes/WebRequest.php
trunk/phase3/includes/Wiki.php
Modified: trunk/phase3/includes/WebRequest.php
===================================================================
--- trunk/phase3/includes/WebRequest.php 2011-08-19 11:23:17 UTC (rev
94995)
+++ trunk/phase3/includes/WebRequest.php 2011-08-19 13:25:43 UTC (rev
94996)
@@ -603,14 +603,14 @@
* Return the request URI with the canonical service and hostname, path,
* and query string. This will be suitable for use as an absolute link
* in HTML or other output.
+ *
+ * If $wgServer is protocol-relative, this will return a fully
+ * qualified URL with the protocol that was used for this request.
*
- * NOTE: This will output a protocol-relative URL if $wgServer is
protocol-relative
- *
* @return String
*/
public function getFullRequestURL() {
- global $wgServer;
- return $wgServer . $this->getRequestURL();
+ return wfExpandUrl( $this->getRequestURL(), PROTO_CURRENT );
}
/**
Modified: trunk/phase3/includes/Wiki.php
===================================================================
--- trunk/phase3/includes/Wiki.php 2011-08-19 11:23:17 UTC (rev 94995)
+++ trunk/phase3/includes/Wiki.php 2011-08-19 13:25:43 UTC (rev 94996)
@@ -187,7 +187,7 @@
$title = SpecialPage::getTitleFor(
$name, $subpage );
}
}
- $targetUrl = $title->getFullURL();
+ $targetUrl = wfExpandUrl( $title->getFullURL(),
PROTO_CURRENT );
// Redirect to canonical url, make it a 301 to allow
caching
if ( $targetUrl == $request->getFullRequestURL() ) {
$message = "Redirect loop detected!\n\n" .
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs