This commit is contained in:
as2252258@163.com
2021-07-26 12:48:31 +08:00
parent 60382f2b97
commit 95c9e878a5
2 changed files with 626 additions and 624 deletions
File diff suppressed because it is too large Load Diff
+4 -9
View File
@@ -106,16 +106,11 @@ class HTTPServerListener extends Abstracts\Server
public function onRequest(Request $request, Response $response)
{
try {
if (ApplicationStore::getStore()->getStatus() == 'exit') {
$response->status(401);
$response->end();
return;
if (HRequest::create($request, $response)->is('favicon.ico')) {
$this->router->status404();
} else {
$this->router->dispatch();
}
$request = HRequest::create($request, $response);
if ($request->is('favicon.ico')) {
throw new Exception('Not found.', 404);
}
$this->router->dispatch();
} catch (ExitException | Error | Throwable $exception) {
$response->setHeader('Content-Type', 'text/html; charset=utf-8');
$response->status($exception->getCode() == 0 ? 500 : $exception->getCode());