r41440 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41439‎ | r41440 | r41441 >
Date:19:25, 30 September 2008
Author:brion
Status:old
Tags:
Comment:
Curl sanity -- dump non-200 return codes and error numbers to debug log at least, rather than just silently failing.
Modified paths:
  • /trunk/phase3/includes/HttpFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HttpFunctions.php
@@ -82,11 +82,16 @@
8383 ob_end_clean();
8484
8585 # Don't return the text of error messages, return false on error
86 - if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
 86+ $retcode = curl_getinfo( $c, CURLINFO_HTTP_CODE );
 87+ if ( $retcode != 200 ) {
 88+ wfDebug( __METHOD__ . ": HTTP return code $retcode\n" );
8789 $text = false;
8890 }
8991 # Don't return truncated output
90 - if ( curl_errno( $c ) != CURLE_OK ) {
 92+ $errno = curl_errno( $c );
 93+ if ( $errno != CURLE_OK ) {
 94+ $errstr = curl_error( $c );
 95+ wfDebug( __METHOD__ . ": CURL error code $errno: $errstr\n" );
9196 $text = false;
9297 }
9398 curl_close( $c );

Status & tagging log