Skip to content

Commit ca816d6

Browse files
authored
feature-ip-port (#94)
1 parent 919fbb9 commit ca816d6

File tree

4 files changed

+48
-13
lines changed

4 files changed

+48
-13
lines changed

src/Qcloud/Cos/BucketStyleListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function onCommandAfterPrepare(Event $event) {
7373
{
7474
$bucket = $bucket.'-'.$this->appId;
7575
}
76-
$request->setPath(urldecode($request->getPath()));
76+
// $request->setPath(urldecode($request->getPath()));
7777
$request->getParams()->set('bucket', $bucket)->set('key', $key);
7878

7979
$realHost = $bucket. '.' . $request->getHost();

src/Qcloud/Cos/Client.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ public function doesObjectExist($bucket, $key, array $options = array())
235235
}
236236
}
237237
public static function encodeKey($key) {
238-
return $key;
238+
// return $key;
239239
return str_replace('%2F', '/', rawurlencode($key));
240240
}
241241

242242
public static function explodeKey($key) {
243243
// Remove a leading slash if one is found
244-
//return explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key);
245-
return $key;
246-
return ltrim($key, "/");
244+
return explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key);
245+
// return $key;
246+
// return ltrim($key, "/");
247247
}
248248
}

src/Qcloud/Cos/Service.php

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public static function getService() {
4343
'required' => true,
4444
'type' => 'string',
4545
'location' => 'uri',
46-
'minLength' => 1),
46+
'minLength' => 1,
47+
'filters' => array(
48+
'Qcloud\\Cos\\Client::explodeKey')),
4749
'UploadId' => array(
4850
'required' => true,
4951
'type' => 'string',
@@ -133,7 +135,9 @@ public static function getService() {
133135
'required' => true,
134136
'type' => 'string',
135137
'location' => 'uri',
136-
'minLength' => 1),
138+
'minLength' => 1,
139+
'filters' => array(
140+
'Qcloud\\Cos\\Client::explodeKey')),
137141
'Parts' => array(
138142
'type' => 'array',
139143
'location' => 'xml',
@@ -235,6 +239,8 @@ public static function getService() {
235239
'type' => 'string',
236240
'location' => 'uri',
237241
'minLength' => 1,
242+
'filters' => array(
243+
'Qcloud\\Cos\\Client::explodeKey')
238244
),
239245
'Metadata' => array(
240246
'type' => 'object',
@@ -409,6 +415,8 @@ public static function getService() {
409415
'type' => 'string',
410416
'location' => 'uri',
411417
'minLength' => 1,
418+
'filters' => array(
419+
'Qcloud\\Cos\\Client::explodeKey')
412420
),
413421
'Metadata' => array(
414422
'type' => 'object',
@@ -590,7 +598,9 @@ public static function getService() {
590598
'required' => true,
591599
'type' => 'string',
592600
'location' => 'uri',
593-
'minLength' => 1),
601+
'minLength' => 1,
602+
'filters' => array(
603+
'Qcloud\\Cos\\Client::explodeKey')),
594604
'MFA' => array(
595605
'type' => 'string',
596606
'location' => 'header',
@@ -670,6 +680,8 @@ public static function getService() {
670680
'required' => true,
671681
'type' => 'string',
672682
'minLength' => 1,
683+
'filters' => array(
684+
'Qcloud\\Cos\\Client::explodeKey')
673685
),
674686
'VersionId' => array(
675687
'type' => 'string',
@@ -800,7 +812,9 @@ public static function getService() {
800812
'required' => true,
801813
'type' => 'string',
802814
'location' => 'uri',
803-
'minLength' => 1),
815+
'minLength' => 1,
816+
'filters' => array(
817+
'Qcloud\\Cos\\Client::explodeKey')),
804818
'Range' => array(
805819
'type' => 'string',
806820
'location' => 'header'),
@@ -880,6 +894,8 @@ public static function getService() {
880894
'type' => 'string',
881895
'location' => 'uri',
882896
'minLength' => 1,
897+
'filters' => array(
898+
'Qcloud\\Cos\\Client::explodeKey')
883899
),
884900
'VersionId' => array(
885901
'type' => 'string',
@@ -1171,7 +1187,9 @@ public static function getService() {
11711187
'required' => true,
11721188
'type' => 'string',
11731189
'location' => 'uri',
1174-
'minLength' => 1),
1190+
'minLength' => 1,
1191+
'filters' => array(
1192+
'Qcloud\\Cos\\Client::explodeKey')),
11751193
'PartNumber' => array(
11761194
'required' => true,
11771195
'type' => 'numeric',
@@ -1264,7 +1282,9 @@ public static function getService() {
12641282
'required' => true,
12651283
'type' => 'string',
12661284
'location' => 'uri',
1267-
'minLength' => 1),
1285+
'minLength' => 1,
1286+
'filters' => array(
1287+
'Qcloud\\Cos\\Client::explodeKey')),
12681288
'Metadata' => array(
12691289
'type' => 'object',
12701290
'location' => 'header',
@@ -1444,6 +1464,8 @@ public static function getService() {
14441464
'type' => 'string',
14451465
'location' => 'uri',
14461466
'minLength' => 1,
1467+
'filters' => array(
1468+
'Qcloud\\Cos\\Client::explodeKey')
14471469
),
14481470
'RequestPayer' => array(
14491471
'type' => 'string',
@@ -1833,6 +1855,8 @@ public static function getService() {
18331855
'Key' => array(
18341856
'type' => 'string'
18351857
),
1858+
'filters' => array(
1859+
'Qcloud\\Cos\\Client::explodeKey'),
18361860
'Value' => array(
18371861
'type' => 'string'
18381862
),
@@ -2103,6 +2127,8 @@ public static function getService() {
21032127
),
21042128
),
21052129
),
2130+
'filters' => array(
2131+
'Qcloud\\Cos\\Client::explodeKey')
21062132
),
21072133
),
21082134
),
@@ -2132,6 +2158,8 @@ public static function getService() {
21322158
'type' => 'string',
21332159
'location' => 'uri',
21342160
'minLength' => 1,
2161+
'filters' => array(
2162+
'Qcloud\\Cos\\Client::explodeKey')
21352163
),
21362164
'VersionId' => array(
21372165
'type' => 'string',
@@ -2197,7 +2225,9 @@ public static function getService() {
21972225
'required' => true,
21982226
'type' => 'string',
21992227
'location' => 'uri',
2200-
'minLength' => 1),
2228+
'minLength' => 1,
2229+
'filters' => array(
2230+
'Qcloud\\Cos\\Client::explodeKey')),
22012231
'MaxParts' => array(
22022232
'type' => 'numeric',
22032233
'location' => 'query',
@@ -2456,6 +2486,8 @@ public static function getService() {
24562486
'type' => 'string',
24572487
'location' => 'uri',
24582488
'minLength' => 1,
2489+
'filters' => array(
2490+
'Qcloud\\Cos\\Client::explodeKey')
24592491
),
24602492
'Range' => array(
24612493
'type' => 'string',
@@ -2599,6 +2631,8 @@ public static function getService() {
25992631
'type' => 'string',
26002632
'location' => 'uri',
26012633
'minLength' => 1,
2634+
'filters' => array(
2635+
'Qcloud\\Cos\\Client::explodeKey')
26022636
),
26032637
'PartNumber' => array(
26042638
'required' => true,
@@ -2685,7 +2719,7 @@ public static function getService() {
26852719
),
26862720
'Key' => array(
26872721
'type' => 'string',
2688-
'location' => 'xml',
2722+
'location' => 'xml'
26892723
),
26902724
'Expiration' => array(
26912725
'type' => 'string',

src/Qcloud/Cos/Signature.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public function __construct($accessKey, $secretKey) {
1111
public function __destruct() {
1212
}
1313
public function signRequest(RequestInterface $request) {
14+
1415
$signTime = (string)(time() - 60) . ';' . (string)(time() + 3600);
1516
$httpString = strtolower($request->getMethod()) . "\n" . urldecode($request->getPath()) .
1617
"\n\nhost=" . $request->getHost() . "\n";

0 commit comments

Comments
 (0)