改名
This commit is contained in:
@@ -49,17 +49,11 @@ class Request extends HttpService
|
|||||||
#[Inject(HttpHeaders::class)]
|
#[Inject(HttpHeaders::class)]
|
||||||
public ?HttpHeaders $headers = null;
|
public ?HttpHeaders $headers = null;
|
||||||
|
|
||||||
|
|
||||||
public bool $isCli = FALSE;
|
public bool $isCli = FALSE;
|
||||||
|
|
||||||
public float $startTime;
|
public float $startTime;
|
||||||
|
|
||||||
public ?array $clientInfo;
|
|
||||||
|
|
||||||
|
|
||||||
private string $_method = '';
|
|
||||||
|
|
||||||
private string $_uri = '';
|
|
||||||
|
|
||||||
public int $statusCode = 200;
|
public int $statusCode = 200;
|
||||||
|
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
@@ -80,28 +74,15 @@ class Request extends HttpService
|
|||||||
private ?AuthIdentity $_grant = null;
|
private ?AuthIdentity $_grant = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $fd
|
|
||||||
*/
|
|
||||||
public function setFd($fd)
|
|
||||||
{
|
|
||||||
$this->fd = $fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|null
|
* @return array|null
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getConnectInfo(): array|null
|
public function getConnectInfo(): array|null
|
||||||
{
|
{
|
||||||
if (empty($this->fd)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$server = ServerManager::getContext()->getServer();
|
$server = ServerManager::getContext()->getServer();
|
||||||
|
|
||||||
$request = Context::getContext(\Swoole\Http\Request::class);
|
return $server->getClientInfo($this->getClientId());
|
||||||
|
|
||||||
return $server->getClientInfo($request->fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +93,7 @@ class Request extends HttpService
|
|||||||
{
|
{
|
||||||
$request = Context::getContext(\Swoole\Http\Request::class);
|
$request = Context::getContext(\Swoole\Http\Request::class);
|
||||||
|
|
||||||
return $request->fd;
|
return $request->fd ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -421,7 +402,7 @@ class Request extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function isNotFound(): bool
|
public function isNotFound(): bool
|
||||||
{
|
{
|
||||||
return Json::to(404, 'Page ' . $this->_uri . ' not found.');
|
return Json::to(404, 'Page ' . $this->headers->getRequestUri() . ' not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user