From: Chad Horohoe Date: Tue, 16 Apr 2013 23:07:12 +0000 (-0400) Subject: Support HTTP timeout detection in curl backend X-Git-Tag: 1.31.0-rc.0~19985 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=479363ce928640b658ca7af22f9a8afd43abb532;p=lhc%2Fweb%2Fwiklou.git Support HTTP timeout detection in curl backend We already do this for the pure-PHP backend, and it's easy to catch this single error and pass a more specific message Change-Id: I8a81dd90b691c35c51a19f8790f06578dd067613 --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index acf9baa4cc..489a83aacf 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -774,7 +774,10 @@ class CurlHttpRequest extends MWHttpRequest { wfRestoreWarnings(); } - if ( false === curl_exec( $curlHandle ) ) { + $curlRes = curl_exec( $curlHandle ); + if ( curl_errno( $curlHandle ) == CURLE_OPERATION_TIMEOUTED ) { + $this->status->fatal( 'http-timed-out', $this->url ); + } elseif ( $curlRes === false ) { $this->status->fatal( 'http-curl-error', curl_error( $curlHandle ) ); } else { $this->headerList = explode( "\r\n", $this->headerText );