Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down