From cefe7ae010ba1e820ba8f8cf6832f255655b2977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 11 Jan 2022 15:35:14 +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 | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/AsyncClient.php b/AsyncClient.php index c324474..11e03a8 100644 --- a/AsyncClient.php +++ b/AsyncClient.php @@ -108,26 +108,25 @@ class AsyncClient extends ClientAbstracts { $array = $this->_parseHeaders($path); - if ($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; + $this->client->send(implode("\r\n", $array) . "\r\n\r\n" . $content); + $receive = ''; + while (true) { + $tmp = $this->client->recv(); + if (empty($tmp)) { + break; } - - Kiri::getDi()->get(Logger::class)->debug($receive); - [$header, $body] = explode("\r\n\r\n", $receive); - - $header = explode("\r\n", $header); - $status = array_shift($header); - - $this->setStatusCode(intval(explode(' ', $status)[1])); - $this->parseResponseHeaders($header); - $this->setBody($body); + $receive .= $tmp; } + + Kiri::getDi()->get(Logger::class)->debug($receive); + [$header, $body] = explode("\r\n\r\n", $receive); + + $header = explode("\r\n", $header); + $status = array_shift($header); + + $this->setStatusCode(intval(explode(' ', $status)[1])); + $this->parseResponseHeaders($header); + $this->setBody($body); }