Skip to content

Commit 400c206

Browse files
committed
Merge branch 'master' of github.com:qiniu/php-sdk into config_uphost
2 parents 5d64aa5 + c695f00 commit 400c206

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/Qiniu/Http/Client.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,14 @@ private static function sendRequest($request)
8383
CURLOPT_HEADER => true,
8484
CURLOPT_NOBODY => false,
8585
CURLOPT_CUSTOMREQUEST => $request->method,
86-
CURLOPT_FOLLOWLOCATION => 1,
8786
CURLOPT_URL => $request->url
8887
);
88+
89+
// Handle open_basedir & safe mode
90+
if (!ini_get('safe_mode') && !ini_get('open_basedir'))
91+
{
92+
$options[CURLOPT_FOLLOWLOCATION] = true;
93+
}
8994

9095
if (!empty($request->headers)) {
9196
$headers = array();

src/Qiniu/Storage/BucketManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function changeMime($bucket, $key, $mime)
208208
* ]
209209
* @link http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html
210210
*/
211-
public function fetch($url, $bucket, $key)
211+
public function fetch($url, $bucket, $key = null)
212212
{
213213

214214
$resource = \Qiniu\base64_urlSafeEncode($url);

tests/Qiniu/Tests/BucketTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ public function testFetch()
131131
);
132132
$this->assertArrayHasKey('key', $ret);
133133
$this->assertNull($error);
134+
135+
list($ret, $error) = $this->bucketManager->fetch(
136+
'http://developer.qiniu.com/docs/v6/sdk/php-sdk.html',
137+
$this->bucketName
138+
);
139+
$this->assertArrayHasKey('key', $ret);
140+
$this->assertNull($error);
134141
}
135142

136143
public function testBatchCopy()

0 commit comments

Comments
 (0)