protected function parseUrl(
        /*# string */ $httpMethod,
        /*# string */ $url
    ) {
        $this->server = $_SERVER;
        $server = &$this->server;

        // set http method
        if ($httpMethod) {
            $server['REQUEST_METHOD'] = $httpMethod;
        } elseif (!isset($server['REQUEST_METHOD'])) {
            $server['REQUEST_METHOD'] = 'GET';
        }

        // parse url
        if (empty($url)) {
            $this->request = $_REQUEST;
        } else {
            $parts = (array) parse_url($url);

            // scheme
            if (isset($parts['scheme'])) {
                $scheme = strtolower($parts['scheme']);
                $server['HTTPS'] = 'https' === $scheme ? $scheme : '';
            }

            // host
            if (isset($parts['host'])) {
                $server['HTTP_HOST'] = $parts['host'];
            }

            // port
            if (isset($parts['port'])) {
                $server['SERVER_PORT'] = $parts['port'];
            }

            // fix query
            $this->fixUrlQuery($parts);

            // fix path
            $this->fixUrlPath($parts);
        }

        // normalize
        $server['PATH_INFO'] = '/' . trim($server['PATH_INFO'], '/');

        return $this;
    }