From: Tim Starling Date: Tue, 1 Nov 2005 22:26:11 +0000 (+0000) Subject: Check for error response codes, don't proxy via localhost in command line mode X-Git-Tag: 1.6.0~1247 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=758d91f1280500b8633bc2ccc6317dbd734a7657;p=lhc%2Fweb%2Fwiklou.git Check for error response codes, don't proxy via localhost in command line mode --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 19cd63e12f..c0df2e92d4 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -28,6 +28,11 @@ function wfGetHTTP( $url, $timeout = 'default' ) { curl_exec( $c ); $text = ob_get_contents(); ob_end_clean(); + + # Don't return the text of error messages, return false on error + if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) { + $text = false; + } curl_close( $c ); } else { # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php @@ -43,7 +48,11 @@ function wfGetHTTP( $url, $timeout = 'default' ) { * Check if the URL can be served by localhost */ function wfIsLocalURL( $url ) { - global $wgConf; + global $wgCommandLineMode, $wgConf; + if ( $wgCommandLineMode ) { + return false; + } + // Extract host part if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) { $host = $matches[1];