Skip to content

Commit eadff52

Browse files
authored
fix issue 404
1 parent 9003b53 commit eadff52

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Queue/Driver/CMQClient.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,23 @@ public function __construct($host, $secretId, $secretKey, $version = 'SDK_PHP_1.
2020
$this->version = $version;
2121
$this->method = $method;
2222
$this->sign_method = 'HmacSHA1';
23-
$this->http = new CMQHttp($this->host);
23+
$this->http = new CMQHttp($host);
2424
}
2525

2626
protected function process_host($host)
2727
{
28-
if (strpos($host, 'http://') === 0 || strpos($host, 'https://') === 0) {
29-
$this->host = rtrim($host, '/');
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);
3032
} else {
3133
throw new CMQClientParameterException('Only support http(s) prototol. Invalid endpoint:'.$host);
3234
}
35+
if ($_host[strlen($_host) - 1] == '/') {
36+
$this->host = substr($_host, 0, strlen($_host) - 1);
37+
} else {
38+
$this->host = $_host;
39+
}
3340
}
3441

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

0 commit comments

Comments
 (0)