Aerys\Server::onParseError PHP Method

onParseError() private method

private onParseError ( Client $client, array $parseResult, string $error )
$client Client
$parseResult array
$error string
    private function onParseError(Client $client, array $parseResult, string $error)
    {
        $this->clearKeepAliveTimeout($client);
        if ($client->bodyPromisors) {
            $client->writeBuffer .= "\n\n{$error}";
            $client->shouldClose = true;
            $this->writeResponse($client, true);
            return;
        }
        $ireq = $this->initializeRequest($client, $parseResult);
        $client->pendingResponses++;
        $this->tryApplication($ireq, static function (Request $request, Response $response) use($parseResult, $error) {
            if ($error === HttpDriver::BAD_VERSION) {
                $status = HTTP_STATUS["HTTP_VERSION_NOT_SUPPORTED"];
                $error = "Unsupported version {$parseResult['protocol']}";
            } else {
                $status = HTTP_STATUS["BAD_REQUEST"];
            }
            $body = makeGenericBody($status, ["msg" => $error]);
            $response->setStatus($status);
            $response->setHeader("Connection", "close");
            $response->end($body);
        }, []);
    }