This commit is contained in:
2021-12-24 14:29:48 +08:00
parent ca7a4494d8
commit 6ffe1af6d2
+16 -2
View File
@@ -116,6 +116,16 @@ class AsyncClient extends ClientAbstracts
$this->client->send(implode("\r\n", $array) . "\r\n\r\n" . $content);
$revice = $this->client->recv();
if (!str_ends_with($revice, "\r\n\r\n")) {
while (true) {
$next = $this->client->recv();
$revice .= $next;
if (str_ends_with($next, "\r\n\r\n")) {
break;
}
}
}
[$header, $body] = explode("\r\n\r\n", $revice);
$header = explode("\r\n", $header);
@@ -124,8 +134,12 @@ class AsyncClient extends ClientAbstracts
$this->setStatusCode(intval(explode(' ', $status)[1]));
$this->parseResponseHeaders($header);
$this->setBody($body);
}
private function chunked()
{
var_dump($body);
}
@@ -139,7 +153,7 @@ class AsyncClient extends ClientAbstracts
foreach ($headers as $header) {
[$key, $value] = explode(': ', $header);
$array[$key] = $value;
$array[$key] = trim($value);
}
$this->setResponseHeader($array);
}