diff options
| author | 2016-03-11 22:57:20 +0100 | |
|---|---|---|
| committer | 2016-03-11 22:57:20 +0100 | |
| commit | 8dcc0fd65a36adedb12e5d54bafb39e7e553d38b (patch) | |
| tree | bf47fd99928a6782a309cdd1171516029d4f9611 /lib/Minz/Request.php | |
| parent | 919c9c83013ea310f01c309f00dea3f8afa9033e (diff) | |
| parent | 8f4c61a4154641ac22e6d541b6994add3c4803cb (diff) | |
Merge pull request #1119 from FreshRSS/dev1.3.1-beta
Merge dev in 1.3.1-beta
Diffstat (limited to 'lib/Minz/Request.php')
| -rw-r--r-- | lib/Minz/Request.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index effb9943c..81457df9e 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -85,6 +85,17 @@ class Minz_Request { } /** + * Return true if the request is over HTTPS, false otherwise (HTTP) + */ + public static function isHttps() { + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { + return strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https'; + } else { + return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; + } + } + + /** * Try to guess the base URL from $_SERVER information * * @return the base url (e.g. http://example.com/) @@ -92,11 +103,7 @@ class Minz_Request { public static function guessBaseUrl() { $url = 'http'; - if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { - $https = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https'; - } else { - $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'; - } + $https = self::isHttps(); if (!empty($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST']; |
