From 837fc72a10d74e3ccff494f474f549df6e9bc682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ms=C2=B7xl?= Date: Sat, 14 Nov 2020 03:14:44 +0800 Subject: [PATCH] 3 --- wchat/common/HttpClient.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index 2fca7b9..26f3c9d 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -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); } /**