From 479363ce928640b658ca7af22f9a8afd43abb532 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 16 Apr 2013 19:07:12 -0400 Subject: [PATCH] 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 --- includes/HttpFunctions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 ); -- 2.20.1