/** @var string */ public static $method; /** @var int 0 if not keepalive */ public static $keepalive; /** * Complete request URL * * @param bool * @param bool * @param bool * @return string */ public static function url($include_query = true, $include_path = true, $include_host = true) { return (self::$secure ? 'https://' : 'http://') . ($include_host ? self::$host . ((self::$secure and self::$port == 443 or !self::$secure and self::$port == 80) ? '' : ':' . self::$port) . ($include_path ? self::$path . (($include_query and self::$query) ? '?' . self::$query : '') : '') : ''); } } # Initialized at load-time: Request::$secure = isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on'; Request::$http_version = isset($_SERVER['SERVER_PROTOCOL']) ? substr(strstr($_SERVER['SERVER_PROTOCOL'], '/'), 1) : '1.0'; Request::$host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''); if (($p = strpos(Request::$host, ':')) !== false) { Request::$port = intval(substr(Request::$host, $p + 1)); Request::$host = substr(Request::$host, 0, $p); } elseif (isset($_SERVER['SERVER_PORT'])) { Request::$port = intval($_SERVER['SERVER_PORT']); } Request::$query = @$_SERVER['QUERY_STRING']; Request::$path = Request::$query ? substr(@$_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) : rtrim(@$_SERVER['REQUEST_URI'], '?'); Request::$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; Request::$keepalive = isset($_SERVER['HTTP_KEEP_ALIVE']) ? intval($_SERVER['HTTP_KEEP_ALIVE']) : 0;