From 33bc02fad1b73a06e402ea0d19d951b60ca30256 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Mon, 9 Dec 2013 11:29:28 -0500 Subject: [PATCH] Restore compatibility with curl < 7.16.2 Follows-up 58f71c7e9eca, which assumed that the CURLOPT_CONNECTTIMEOUT_MS constant was defined. Bug: 58178 Change-Id: Id31a3ec56e4c7cac7d3edb2653c87be467d1a471 --- includes/HttpFunctions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index da08aa251a..6fcb7cea00 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -730,7 +730,12 @@ class CurlHttpRequest extends MWHttpRequest { $this->curlOptions[CURLOPT_PROXY] = $this->proxy; $this->curlOptions[CURLOPT_TIMEOUT] = $this->timeout; - $this->curlOptions[CURLOPT_CONNECTTIMEOUT_MS] = $this->connectTimeout * 1000; + + // Only supported in curl >= 7.16.2 + if ( defined( 'CURLOPT_CONNECTTIMEOUT_MS' ) ) { + $this->curlOptions[CURLOPT_CONNECTTIMEOUT_MS] = $this->connectTimeout * 1000; + } + $this->curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; $this->curlOptions[CURLOPT_WRITEFUNCTION] = $this->callback; $this->curlOptions[CURLOPT_HEADERFUNCTION] = array( $this, "readHeader" ); -- 2.20.1