Skip to content

Commit 48e62fe

Browse files
committed
Merge branch 'develop'
2 parents 66f67ce + 903e7e3 commit 48e62fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

upyun.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class UpYun {
6464
private $_bucket_name;
6565
private $_username;
6666
private $_password;
67+
private $_timeout = 30;
6768

6869
/**
6970
* @deprecated
@@ -90,10 +91,11 @@ class UpYun {
9091
*
9192
* @return object
9293
*/
93-
public function __construct($bucketname, $username, $password, $endpoint = NULL) {/*{{{*/
94+
public function __construct($bucketname, $username, $password, $endpoint = NULL, $timeout = 30) {/*{{{*/
9495
$this->_bucketname = $bucketname;
9596
$this->_username = $username;
9697
$this->_password = md5($password);
98+
$this->_timeout = $timeout;
9799

98100
$this->endpoint = is_null($endpoint) ? self::ED_AUTO : $endpoint;
99101
}/*}}}*/
@@ -284,7 +286,7 @@ protected function _do_request($method, $path, $headers = NULL, $body= NULL, $fi
284286
array_push($_headers, "Date: {$date}");
285287

286288
curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers);
287-
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
289+
curl_setopt($ch, CURLOPT_TIMEOUT, $this->_timeout);
288290
curl_setopt($ch, CURLOPT_HEADER, 1);
289291
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
290292
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

0 commit comments

Comments
 (0)