Skip to content

Commit 9003b53

Browse files
authored
fix issue 404
1 parent 64b109a commit 9003b53

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/Queue/Driver/CMQClient.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,11 @@ public function __construct($host, $secretId, $secretKey, $version = 'SDK_PHP_1.
2525

2626
protected function process_host($host)
2727
{
28-
if (strpos($host, 'http://') === 0) {
29-
$_host = substr($host, 7, strlen($host) - 7);
30-
} elseif (strpos($host, 'https://') === 0) {
31-
$_host = substr($host, 8, strlen($host) - 8);
28+
if (strpos($host, 'http://') === 0 || strpos($host, 'https://') === 0) {
29+
$this->host = rtrim($host, '/');
3230
} else {
3331
throw new CMQClientParameterException('Only support http(s) prototol. Invalid endpoint:'.$host);
3432
}
35-
if ($_host[strlen($_host) - 1] == '/') {
36-
$this->host = substr($_host, 0, strlen($_host) - 1);
37-
} else {
38-
$this->host = $_host;
39-
}
4033
}
4134

4235
public function set_sign_method($sign_method = 'sha1')

0 commit comments

Comments
 (0)