From 8b789e48486858a8b84b46c41824deeddb155435 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 30 Sep 2008 19:58:56 +0000 Subject: [PATCH] Add some more debugging goodies to this. $lastCurlErrno and $lastHttpResponse are static members saved with the last returned status codes. --- includes/HttpFunctions.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index a31bd9e1a9..b20e3fd880 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -12,6 +12,9 @@ */ class Http { + public static $lastCurlErrno = 0; + public static $lastHttpResponse = 0; + /** * Simple wrapper for Http::request( 'GET' ) * @see Http::request() @@ -82,16 +85,16 @@ class Http { ob_end_clean(); # Don't return the text of error messages, return false on error - $retcode = curl_getinfo( $c, CURLINFO_HTTP_CODE ); - if ( $retcode != 200 ) { - wfDebug( __METHOD__ . ": HTTP return code $retcode\n" ); + self::$lastHttpResponse = curl_getinfo( $c, CURLINFO_HTTP_CODE ); + if ( self::$lastHttpResponse != 200 ) { + wfDebug( __METHOD__ . ": HTTP return code " . self::$lastHttpResponse . "\n" ); $text = false; } # Don't return truncated output - $errno = curl_errno( $c ); - if ( $errno != CURLE_OK ) { + self::$lastCurlErrno = curl_errno( $c ); + if ( self::$lastCurlErrno != CURLE_OK ) { $errstr = curl_error( $c ); - wfDebug( __METHOD__ . ": CURL error code $errno: $errstr\n" ); + wfDebug( __METHOD__ . ": CURL error code " . self::$lastCurlErrno . ": $errstr\n" ); $text = false; } curl_close( $c ); -- 2.20.1