From ad8b20723b5ae3b3c41a6ac64a0584669eefbd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 18 Aug 2023 16:37:18 +0800 Subject: [PATCH] qqq --- ClientAbstracts.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ClientAbstracts.php b/ClientAbstracts.php index f37fba5..7dbd55f 100644 --- a/ClientAbstracts.php +++ b/ClientAbstracts.php @@ -5,6 +5,7 @@ namespace Kiri; use Closure; +use Kiri\Di\Context; use Swoole\Coroutine; use Swoole\Coroutine\System; @@ -330,6 +331,10 @@ abstract class ClientAbstracts implements IClient protected function withHost(string $host): static { $this->host = $host; + if (Context::inCoroutine() && !preg_match('/(\d{1,3}\.){3}\d{1,3}/', $host)) { + $this->host = System::gethostbyname($host); + $this->withAddedHeader('Host', $host); + } return $this; }