From: Kevin Israel Date: Mon, 9 Dec 2013 16:29:28 +0000 (-0500) Subject: Restore compatibility with curl < 7.16.2 X-Git-Tag: 1.31.0-rc.0~17696^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=33bc02fad1b73a06e402ea0d19d951b60ca30256;p=lhc%2Fweb%2Fwiklou.git 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 --- 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" );