From f174bb0ad0928b4e01e82089d09a3bfc3dcc8b83 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 19 Aug 2011 13:25:43 +0000 Subject: [PATCH] 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() --- includes/WebRequest.php | 8 ++++---- includes/Wiki.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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" . -- 2.20.1