From 9fdb79cfd2ccc4556f2e32882289639e08e408a2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 30 Sep 2008 19:25:04 +0000 Subject: [PATCH] Curl sanity -- dump non-200 return codes and error numbers to debug log at least, rather than just silently failing. --- includes/HttpFunctions.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 ); -- 2.20.1