From: MarkAHershberger Date: Wed, 27 Mar 2013 16:42:18 +0000 (-0400) Subject: Handle protocol-relative URLs in WebRequest::getRequestURL. X-Git-Tag: 1.31.0-rc.0~20203^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=5a266de0a466ec80d95d919058d8b608c24a4a36;p=lhc%2Fweb%2Fwiklou.git Handle protocol-relative URLs in WebRequest::getRequestURL. Multiple slashes at the start of the request url will look like a protocol-relative url, so strip the extra slashes. Bug: 46607 Change-Id: I34c3fc9d8f9467e83cd201cb099c2d26f3a39b36 --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 15da246c96..30a51b04f1 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -655,6 +655,9 @@ class WebRequest { $base = substr( $base, 0, $hash ); } if( $base[0] == '/' ) { + if( $base[1] == '/' ) { /* More than one slash will look like it is protocol relative */ + return preg_replace( '!//*!', '/', $base ); + } return $base; } else { // We may get paths with a host prepended; strip it.