From 94cfa1809652416e68c62b04a8296b79683771c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 18 Nov 2020 14:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Client/ClientAbstracts.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/HttpServer/Client/ClientAbstracts.php b/HttpServer/Client/ClientAbstracts.php index 3bd164ca..9a21447f 100644 --- a/HttpServer/Client/ClientAbstracts.php +++ b/HttpServer/Client/ClientAbstracts.php @@ -8,7 +8,6 @@ use Closure; use Exception; use Snowflake\Abstracts\Component; use Snowflake\Core\Help; -use Swoole\Coroutine; use Swoole\Coroutine\System; @@ -182,12 +181,12 @@ abstract class ClientAbstracts extends Component implements IClient */ public function setHost(string $host): void { - $this->host = $host; -// if (!preg_match('/(\d{1,3}\.){4}/', $host . '.')) { -// $this->addHeader('Host', $host); -// $this->host = System::gethostbyname($host); -// } else { -// } + if (!preg_match('/(\d{1,3}\.){4}/', $host . '.')) { + $this->addHeader('Host', $host); + $this->host = System::gethostbyname($host); + } else { + $this->host = $host; + } } /** @@ -723,7 +722,7 @@ abstract class ClientAbstracts extends Component implements IClient } if (isIp($domain)) { $this->host = $domain; - } else if ($this->use_swoole) { + } else { $this->host = System::gethostbyname($domain) ?? $domain; }