This commit is contained in:
2021-07-28 13:51:28 +08:00
parent 27a03777c3
commit 849a326d4b
+2 -4
View File
@@ -3,10 +3,8 @@
namespace Server; namespace Server;
use Exception; use Exception;
use HttpServer\Route\Node;
use HttpServer\Route\Router; use HttpServer\Route\Router;
use ReflectionException; use ReflectionException;
use Snowflake\Event;
use Snowflake\Exception\NotFindClassException; use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Swoole\Error; use Swoole\Error;
@@ -65,7 +63,7 @@ class HTTPServerListener extends Abstracts\Server
if (!(static::$_http instanceof Port)) { if (!(static::$_http instanceof Port)) {
trigger_error('Port is ' . $host . '::' . $port . ' must is tcp listener type.'); trigger_error('Port is ' . $host . '::' . $port . ' must is tcp listener type.');
} }
static::$_http->set($settings['settings'] ?? []); static::$_http->set(array_merge($settings['settings'] ?? [], ['enable_unsafe_event' => false]));
static::$_http->on('request', [$reflect, 'onRequest']); static::$_http->on('request', [$reflect, 'onRequest']);
static::$_http->on('connect', [$reflect, 'onConnect']); static::$_http->on('connect', [$reflect, 'onConnect']);
static::$_http->on('disconnect', [$reflect, 'onDisconnect']); static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
@@ -101,7 +99,7 @@ class HTTPServerListener extends Abstracts\Server
} catch (Error | Throwable $exception) { } catch (Error | Throwable $exception) {
$result = $this->router->exception($exception); $result = $this->router->exception($exception);
} finally { } finally {
if (!isset($sResponse)){ if (!isset($sResponse)) {
return; return;
} }
$sResponse->send($result); $sResponse->send($result);