From 86c76a7587b3840a810a6347a0541d5972141cf3 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 11 Dec 2021 16:44:33 +0800 Subject: [PATCH] 1 --- src/AsyncClient.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AsyncClient.php b/src/AsyncClient.php index 45ee4c4..72a40a6 100644 --- a/src/AsyncClient.php +++ b/src/AsyncClient.php @@ -82,12 +82,12 @@ class AsyncClient extends ClientAbstracts private function generate_client($data, $host, $isHttps, $path): void { $this->client = new SwowClient(SWOOLE_TCP, FALSE); - if ($isHttps || $this->isSSL()) { - $this->client->enableSSL(); - } if (!$this->client->connect($host, $this->getPort())) { throw new Exception('链接失败'); } + if ($isHttps || $this->isSSL()) { + $this->client->enableSSL(); + } $this->client->set($this->settings()); if (!empty($this->getAgent())) { $this->withAddedHeader('User-Agent', $this->getAgent());