* Fix WebRequest::getRequestURL() to strip off the host bits squid prepends
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 5 Nov 2005 10:53:21 +0000 (10:53 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 5 Nov 2005 10:53:21 +0000 (10:53 +0000)
Corrects self-link in Atom 1.0 feeds.

RELEASE-NOTES
includes/WebRequest.php

index d569a51..8dd1d55 100644 (file)
@@ -208,6 +208,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * (bug 3666) Don't spew PHP warnings in prefs on unrecognized site language
 * (bug 2392) Fix Atom items content type, upgrade to Atom 1.0
 * Allow $wgFeedCacheTimeout of 0 to disable feed caching
+* Fix WebRequest::getRequestURL() to strip off the host bits squid prepends
 
 === Caveats ===
 
index 2407718..400392f 100644 (file)
@@ -281,7 +281,13 @@ class WebRequest {
         * @return string
         */
        function getRequestURL() {
-               return $_SERVER['REQUEST_URI'];
+               $base = $_SERVER['REQUEST_URI'];
+               if( $base{0} == '/' ) {
+                       return $base;
+               } else {
+                       // We may get paths with a host prepended; strip it.
+                       return preg_replace( '!^[^:]+://[^/]+/!', '/', $base );
+               }
        }
        
        /**