PHPDaemon\Servers\WebSocket\Connection::httpReadFirstline PHP Method

httpReadFirstline() protected method

Read first line of HTTP request
protected httpReadFirstline ( ) : boolean | null
return boolean | null Success
    protected function httpReadFirstline()
    {
        if (($l = $this->readline()) === null) {
            return null;
        }
        $e = explode(' ', $l);
        $u = isset($e[1]) ? parse_url($e[1]) : false;
        if ($u === false) {
            $this->badRequest();
            return false;
        }
        if (!isset($u['path'])) {
            $u['path'] = null;
        }
        if (isset($u['host'])) {
            $this->server['HTTP_HOST'] = $u['host'];
        }
        $srv =& $this->server;
        $srv['REQUEST_METHOD'] = $e[0];
        $srv['REQUEST_TIME'] = time();
        $srv['REQUEST_TIME_FLOAT'] = microtime(true);
        $srv['REQUEST_URI'] = $u['path'] . (isset($u['query']) ? '?' . $u['query'] : '');
        $srv['DOCUMENT_URI'] = $u['path'];
        $srv['PHP_SELF'] = $u['path'];
        $srv['QUERY_STRING'] = isset($u['query']) ? $u['query'] : null;
        $srv['SCRIPT_NAME'] = $srv['DOCUMENT_URI'] = isset($u['path']) ? $u['path'] : '/';
        $srv['SERVER_PROTOCOL'] = isset($e[2]) ? $e[2] : 'HTTP/1.1';
        $srv['REMOTE_ADDR'] = $this->addr;
        $srv['REMOTE_PORT'] = $this->port;
        return true;
    }