From: Brion Vibber Date: Tue, 30 Sep 2008 19:25:04 +0000 (+0000) Subject: Curl sanity -- dump non-200 return codes and error numbers to debug log at least... X-Git-Tag: 1.31.0-rc.0~44982 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=9fdb79cfd2ccc4556f2e32882289639e08e408a2;p=lhc%2Fweb%2Fwiklou.git Curl sanity -- dump non-200 return codes and error numbers to debug log at least, rather than just silently failing. --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 4efcd9d621..a31bd9e1a9 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -82,11 +82,16 @@ class Http { ob_end_clean(); # Don't return the text of error messages, return false on error - if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) { + $retcode = curl_getinfo( $c, CURLINFO_HTTP_CODE ); + if ( $retcode != 200 ) { + wfDebug( __METHOD__ . ": HTTP return code $retcode\n" ); $text = false; } # Don't return truncated output - if ( curl_errno( $c ) != CURLE_OK ) { + $errno = curl_errno( $c ); + if ( $errno != CURLE_OK ) { + $errstr = curl_error( $c ); + wfDebug( __METHOD__ . ": CURL error code $errno: $errstr\n" ); $text = false; } curl_close( $c );