From d3b35bea9235fea3ce79f24fb9d4ef907d07a42f Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Tue, 17 Oct 2017 08:59:36 +0200 Subject: [PATCH] * [FIX] Fixes #762. Wrong port replacement when https protocol is forced. Thanks to @lroellin for the feedback. --- inc/SP/Util/HttpUtil.class.php | 8 +++++--- inc/SP/Util/Util.class.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/SP/Util/HttpUtil.class.php b/inc/SP/Util/HttpUtil.class.php index fd5557b3..4750fa24 100644 --- a/inc/SP/Util/HttpUtil.class.php +++ b/inc/SP/Util/HttpUtil.class.php @@ -39,10 +39,12 @@ class HttpUtil public static function checkHttps() { if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) { - $port = ((int)$_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; - $host = str_replace('http', 'https', self::getHttpHost()); + $serverPort = (int)$_SERVER['SERVER_PORT']; - header('Location: ' . $host . $port . $_SERVER['REQUEST_URI']); + $httpPort = $serverPort !== 443 && $serverPort !== 80 ? $serverPort : ''; + $httpHost = str_replace('http', 'https', self::getHttpHost()); + + header('Location: ' . $httpHost . ':' . $httpPort . $_SERVER['REQUEST_URI']); } } diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index e57b0db8..e0d4b473 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -386,7 +386,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17101301; + $build = 17101701; $version = [2, 1, 15]; if ($normalized === true) {