Index: includes/GlobalFunctions.php =================================================================== --- includes/GlobalFunctions.php (revision 19274) +++ includes/GlobalFunctions.php (working copy) @@ -230,7 +230,7 @@ $forward .= ' anon'; $log = sprintf( "%s\t%04.3f\t%s\n", gmdate( 'YmdHis' ), $elapsed, - urldecode( $_SERVER['REQUEST_URI'] . $forward ) ); + urldecode( $wgRequest->getRequestURL() . $forward ) ); if ( '' != $wgDebugLogFile && ( $wgRequest->getVal('action') != 'raw' || $wgDebugRawPage ) ) { error_log( $log . $prof, 3, $wgDebugLogFile ); } Index: includes/WebRequest.php =================================================================== --- includes/WebRequest.php (revision 19274) +++ includes/WebRequest.php (working copy) @@ -314,7 +314,20 @@ * @return string */ function getRequestURL() { - $base = $_SERVER['REQUEST_URI']; + if( isset( $_SERVER['REQUEST_URI'] ) ) { + $base = $_SERVER['REQUEST_URI']; + } elseif( isset( $_SERVER['SCRIPT_NAME'] ) ) { + // Probably IIS; doesn't set REQUEST_URI + $base = $_SERVER['SCRIPT_NAME']; + if( isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] != '' ) { + $base .= '?' . $_SERVER['QUERY_STRING']; + } + } else { + // This shouldn't happen! + throw new MWException( "Web server doesn't provide either " . + "REQUEST_URI or SCRIPT_NAME. Report details of your " . + "web server configuration to http://bugzilla.wikimedia.org/" ); + } if( $base{0} == '/' ) { return $base; } else { Index: includes/Wiki.php =================================================================== --- includes/Wiki.php (revision 19274) +++ includes/Wiki.php (working copy) @@ -118,7 +118,7 @@ * Initialize the object to be known as $wgArticle for special cases */ function initializeSpecialCases ( &$title, &$output, $request ) { - + global $wgRequest; wfProfileIn( 'MediaWiki::initializeSpecialCases' ); $search = $this->getVal('Search'); @@ -151,8 +151,7 @@ $targetUrl = $title->getFullURL(); // Redirect to canonical url, make it a 301 to allow caching global $wgServer, $wgUsePathInfo; - if( isset( $_SERVER['REQUEST_URI'] ) && - $targetUrl == $wgServer . $_SERVER['REQUEST_URI'] ) { + if( $targetUrl == $wgRequest->getFullRequestURL() ) { $message = "Redirect loop detected!\n\n" . "This means the wiki got confused about what page was " . "requested; this sometimes happens when moving a wiki " . Index: includes/Skin.php =================================================================== --- includes/Skin.php (revision 19274) +++ includes/Skin.php (working copy) @@ -782,13 +782,6 @@ function printableLink() { global $wgOut, $wgFeedClasses, $wgRequest; - $baseurl = $_SERVER['REQUEST_URI']; - if( strpos( '?', $baseurl ) == false ) { - $baseurl .= '?'; - } else { - $baseurl .= '&'; - } - $baseurl = htmlspecialchars( $baseurl ); $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' ); $s = "" . wfMsg( 'printableversion' ) . ''; Index: includes/Exception.php =================================================================== --- includes/Exception.php (revision 19274) +++ includes/Exception.php (working copy) @@ -54,10 +54,11 @@ } function getLogMessage() { + global $wgRequest; $file = $this->getFile(); $line = $this->getLine(); $message = $this->getMessage(); - return "{$_SERVER['REQUEST_URI']} Exception from line $line of $file: $message"; + return $wgRequest->getRequestURL() . " Exception from line $line of $file: $message"; } function reportHTML() {