diff --git a/S3.php b/S3.php index 0b1564b2..b7ecc8a0 100644 --- a/S3.php +++ b/S3.php @@ -172,6 +172,15 @@ class S3 */ private static $__signingKeyResource = false; + /** + * curl timeout + * + * @var int + * @access public + * @static + */ + public static $curlTimeout = 60; + /** * Constructor - if you're not using the class statically @@ -336,6 +345,16 @@ public static function freeSigningKey() openssl_free_key(self::$__signingKeyResource); } + /** + * Sets the curl timeout from the default of 60 seconds (use 0 for no timeout) + * + * @return void + */ + public static function setTimeout($timeout) + { + self::$curlTimeout = $timeout; + } + /** * Internal error handler @@ -2178,6 +2197,7 @@ public function getResponse() curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback')); curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '__responseHeaderCallback')); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($curl, CURLOPT_TIMEOUT, S3::$curlTimeout); // Request types switch ($this->verb)