From e71a17cbce921dc35d99ca516e7a38636bd916a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 11 Jan 2022 15:11:18 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=94=B9=E5=90=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fdf58326 --- AsyncClient.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/AsyncClient.php b/AsyncClient.php index b7f23b8..07e1b70 100644 --- a/AsyncClient.php +++ b/AsyncClient.php @@ -108,21 +108,14 @@ class AsyncClient extends ClientAbstracts private function execute(string $path, string $content) { $array = []; - $array[] = strtoupper($this->getMethod()) . ' ' . $path . ' HTTP/1.0'; + $array[] = strtoupper($this->getMethod()) . ' ' . $path . ' HTTP/1.1'; if (!empty($this->getHeader())) { foreach ($this->getHeader() as $key => $value) { $array[] = sprintf('%s: %s', $key, $value); } } $this->client->send(implode("\r\n", $array) . "\r\n\r\n" . $content); - $receive = ''; - while (true) { - $_tmp = $this->client->recv(); - if (empty($_tmp)) { - break; - } - $receive .= $_tmp; - } + $receive = $this->waite(); Kiri::getDi()->get(Logger::class)->debug($receive); @@ -137,6 +130,23 @@ class AsyncClient extends ClientAbstracts } + /** + * @return string + */ + private function waite(): string + { + $receive = ''; + while (true) { + $_tmp = $this->client->recv(); + if (empty($_tmp)) { + break; + } + $receive .= $_tmp; + } + return $receive; + } + + private function chunked() {