Curl sanity -- dump non-200 return codes and error numbers to debug log at least...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 30 Sep 2008 19:25:04 +0000 (19:25 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 30 Sep 2008 19:25:04 +0000 (19:25 +0000)
includes/HttpFunctions.php

index 4efcd9d..a31bd9e 100644 (file)
@@ -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 );