From: Brion Vibber Date: Sat, 5 Nov 2005 10:53:21 +0000 (+0000) Subject: * Fix WebRequest::getRequestURL() to strip off the host bits squid prepends X-Git-Tag: 1.6.0~1213 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=874fa5ddbf4c0001f5560316f04f11b865e1028e;p=lhc%2Fweb%2Fwiklou.git * Fix WebRequest::getRequestURL() to strip off the host bits squid prepends Corrects self-link in Atom 1.0 feeds. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d569a51463..8dd1d55f01 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 24077180a7..400392fe69 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -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 ); + } } /**