Handle protocol-relative URLs in WebRequest::getRequestURL.
authorMarkAHershberger <mah@everybody.org>
Wed, 27 Mar 2013 16:42:18 +0000 (12:42 -0400)
committerParent5446 <tylerromeo@gmail.com>
Wed, 27 Mar 2013 17:55:58 +0000 (17:55 +0000)
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

includes/WebRequest.php

index 15da246..30a51b0 100644 (file)
@@ -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.