From: Roan Kattouw Date: Fri, 19 Aug 2011 13:25:43 +0000 (+0000) Subject: Reverse a bad decision in r93820, which added a comment to WebRequest::getFullRequest... X-Git-Tag: 1.31.0-rc.0~28175 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=f174bb0ad0928b4e01e82089d09a3bfc3dcc8b83;p=lhc%2Fweb%2Fwiklou.git 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() --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 48472c9a96..90d5346c11 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -603,14 +603,14 @@ class WebRequest { * 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. - * - * NOTE: This will output a protocol-relative URL if $wgServer is protocol-relative + * + * If $wgServer is protocol-relative, this will return a fully + * qualified URL with the protocol that was used for this request. * * @return String */ public function getFullRequestURL() { - global $wgServer; - return $wgServer . $this->getRequestURL(); + return wfExpandUrl( $this->getRequestURL(), PROTO_CURRENT ); } /** diff --git a/includes/Wiki.php b/includes/Wiki.php index 1ba71a5f7a..71a79529ca 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -187,7 +187,7 @@ class MediaWiki { $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" .