Skip to content

Commit 4ee5524

Browse files
authored
fix host bug (#11)
1 parent 5773404 commit 4ee5524

File tree

5 files changed

+8
-55
lines changed

5 files changed

+8
-55
lines changed

cos-autoloader.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@
248248
'Qcloud\Cos\Exception\ServiceResponseException' => 'src/Qcloud/Cos/Exception/ServiceResponseException.php',
249249
'Qcloud\Cos\ExceptionListener' => 'src/Qcloud/Cos/ExceptionListener.php',
250250
'Qcloud\Cos\ExceptionParser' => 'src/Qcloud/Cos/ExceptionParser.php',
251-
'Qcloud\Cos\GetServiceListener' => 'src/Qcloud/Cos/GetServiceListener.php',
252251
'Qcloud\Cos\MultipartUpload' => 'src/Qcloud/Cos/MultipartUpload.php',
253252
'Qcloud\Cos\Service' => 'src/Qcloud/Cos/Service.php',
254253
'Qcloud\Cos\Signature' => 'src/Qcloud/Cos/Signature.php',
@@ -278,4 +277,4 @@
278277
if (isset($mapping[$class])) {
279278
require $mapping[$class];
280279
}
281-
}, true);
280+
}, true);

src/Qcloud/Cos/BucketStyleListener.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public function onCommandAfterPrepare(Event $event) {
2828
$command = $event['command'];
2929
$bucket = $command['Bucket'];
3030
$request = $command->getRequest();
31-
31+
if ($command->getName() == 'ListBuckets')
32+
{
33+
$request->setHost('service.cos.myqcloud.com');
34+
return ;
35+
}
3236
if ($key = $command['Key']) {
3337
// Modify the command Key to account for the {/Key*} explosion into an array
3438
if (is_array($key)) {

src/Qcloud/Cos/Client.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function __construct($config) {
5252
$this->setUserAgent('cos-php-sdk-v5/' . Client::VERSION, true);
5353

5454
$this->addSubscriber(new ExceptionListener());
55-
$this->addSubscriber(new GetServiceListener());
5655
$this->addSubscriber(new TokenListener($this->token));
5756
$this->addSubscriber(new SignatureListener($this->secretId, $this->secretKey));
5857
$this->addSubscriber(new BucketStyleListener($this->appId));

src/Qcloud/Cos/GetServiceListener.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/Qcloud/Cos/Service.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static function getService() {
1313
'operations' => array(
1414
'ListBuckets' => array(
1515
'httpMethod' => 'GET',
16-
'uri' => '/ASDWQdsawqefdQWESDFFSDFSADCXSVSDQWERTREGERTYTHDF',
16+
'uri' => '/',
1717
'class' => 'Qcloud\\Cos\\Command',
1818
'responseClass' => 'ListBucketsOutput',
1919
'responseType' => 'model',
@@ -517,7 +517,7 @@ public static function getService() {
517517
'RequestPayer' => array(
518518
'type' => 'string',
519519
'location' => 'header',
520-
'sentAs' => 'x-amz-request-payer',
520+
'sentAs' => 'x-cos-request-payer',
521521
),
522522
'command.expects' => array(
523523
'static' => true,

0 commit comments

Comments
 (0)