src/Http/Server.php
function onMessage(TcpConnection $connection, $data) {
        $this->_router->connection = $this->_connection = $connection;
        $this->_router->requestData = $data;
        $this->_router->retMsg = '';
        $connection->forward = false;
        $path = explode('/', substr(explode('?', $_SERVER['REQUEST_URI'], 2)[0], 1));
        if (empty($path[0]) && count($path) == 1)
            $path = [];
        if (!$this->_router->locate($path, $_SERVER['REQUEST_METHOD']))
            $this->_router->retMsg = View::http(404, 'Not found.');
        if (ENABLE_SESSION)
            Http::sessionWriteClose();
        if (($connection->forward ?? false) == true)
            return;
        $connection->send($this->_router->retMsg ?? '');
    }
function onMessage(TcpConnection $connection, $data) {
        $this->_router->connection = $this->_connection = $connection;
        $this->_router->requestData = $data;
        $this->_router->retMsg = '';
        $connection->forward = false;
        $path = explode('/', substr(explode('?', $_SERVER['REQUEST_URI'], 2)[0], 1));
        if (empty($path[0]) && count($path) == 1)
            $path = [];
        if (!$this->_router->locate($path, $_SERVER['REQUEST_METHOD']))
            $this->_router->retMsg = View::http(404, 'Not found.');
        if (ENABLE_SESSION)
            Http::sessionWriteClose();
        if (($connection->forward ?? false) == true)
            return;
        $connection->send($this->_router->retMsg ?? '');
    }
function onMessage ( TcpConnection $ connection , $ data ) { $ this -> _router -> connection = $ this -> _connection = $ connection ; $ this -> _router -> requestData = $ data ; $ this -> _router -> retMsg = '' ; $ connection -> forward = false ; $ path = explode ( '/' , substr ( explode ( '?' , $ _SERVER [ 'REQUEST_URI' ] , 2 ) [ 0 ] , 1 ) ) ; if ( empty ( $ path [ 0 ] ) && count ( $ path ) == 1 ) $ path = [ ] ; if ( ! $ this -> _router -> locate ( $ path , $ _SERVER [ 'REQUEST_METHOD' ] ) ) $ this -> _router -> retMsg = View :: http ( 404 , 'Not found.' ) ; if ( ENABLE_SESSION ) Http :: sessionWriteClose ( ) ; if ( ( $ connection -> forward ?? false ) == true ) return ; $ connection -> send ( $ this -> _router -> retMsg ?? '' ) ; }
{@inheritdoc}
{