Swoole\Http\Request->isCompleted

Version: Swoole: 4.6.0+

Declaration

<?php
Swoole\Http\Request->isCompleted()

Parameters

Return

bool

Description

Check if a HTTP request packet is completed when the server is parsing the HTTP request with $request->parse($data) API.

Example

<?php
use Swoole\Http\Request;

$data = "GET /something?hello=world&test=2123 HTTP/1.1\r\n";
$data .= "Host: 127.0.0.1\r\n";
$data .= "Connection: keep-alive\r\n";
$data .= "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36\r\n";
$data .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\n";
$data .= "Accept-Encoding: gzip, deflate, br\r\n";

$request = Request::create(['parse_cookie' => false]);
var_dump($request);

var_dump($request->isCompleted());
var_dump($request->parse($data));

var_dump($request->parse("\r\n"));
var_dump($request->isCompleted());

var_dump($request);
var_dump($request->cookie);