This commit is contained in:
2020-11-14 03:14:44 +08:00
parent 016885ba16
commit 837fc72a10
+10 -4
View File
@@ -337,7 +337,9 @@ class HttpClient
if (empty($string)) {
return false;
}
if (!$this->use_swoole) {
return $this->host . '/' . ltrim($string, '/');
}
if ($this->isHttp($string)) {
$string = str_replace('http://', '', $string);
$hostAndUrls = explode('/', $string);
@@ -398,10 +400,14 @@ class HttpClient
return $this->curl($url, $data);
}
$url = $this->matchHost(ltrim($url, '/'));
if (!empty($this->port)) {
$this->host .= ':' . $this->port;
// if (!empty($this->port)) {
// $this->host .= ':' . $this->port;
// }
if ($this->isSSL) {
return $this->curl('https://' . $url, $data);
} else {
return $this->curl('http://' . $url, $data);
}
return $this->curl('http://' . $this->host . '/' . $url, $data);
}
/**