This commit is contained in:
2021-12-24 14:13:34 +08:00
parent 4856e76e6f
commit f5ae86c3d2
+10 -3
View File
@@ -116,16 +116,23 @@ class AsyncClient extends ClientAbstracts
$this->client->send(implode("\r\n", $array) . "\r\n\r\n" . $content);
$revice = $this->client->recv();
var_dump($revice);
[$header, $body] = explode("\r\n\r\n", $revice);
$header = explode("\r\n", $header);
$status = array_shift($header);
$this->setBody($body);
$this->setStatusCode(intval(explode(' ', $status)[1]));
$this->setResponseHeader($header);
if ($this->getResponseHeader('Transfer-Encoding') == 'chunked') {
$explode = explode("\r\n\r\n", str_replace("0\r\n\r\n", '', $body));
$string = [];
foreach ($explode as $value) {
$string[] = explode("\r\n", $value)[1];
}
$body = implode($string);
}
$this->setBody($body);
}