<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
protected static $singleton;
/**
- * @var int
+ * @var int|NULL seconds; or NULL to use system default
*/
- protected $timeout;
+ protected $connectionTimeout;
public static function singleton() {
if (!self::$singleton) {
return self::$singleton;
}
- public function __construct($timeout = 10) {
- $this->timeout = $timeout;
+ public function __construct($connectionTimeout = NULL) {
+ $this->connectionTimeout = $connectionTimeout;
}
/**
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
+ if ($this->connectionTimeout !== NULL) {
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectionTimeout);
+ }
if (preg_match('/^https:/', $remoteFile) && $caConfig->isEnableSSL()) {
curl_setopt_array($ch, $caConfig->toCurlOptions());
}