From cbb7ec07a58e44ffa4f98328511869eee2d6cd43 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 12 Jan 2015 18:56:19 +0100 Subject: [PATCH] When called in offline queue, File::url was HTTP Despite having the site configured "always" for HTTPS, File generated thumbnails and such with HTTP urls. --- classes/File.php | 2 +- lib/statusnet.php | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/classes/File.php b/classes/File.php index 8eff7d6182..1edc89d5d7 100644 --- a/classes/File.php +++ b/classes/File.php @@ -303,7 +303,7 @@ class File extends Managed_DataObject } - if (StatusNet::isHTTPS()) { + if (StatusNet::useHTTPS()) { $sslserver = common_config('attachments', 'sslserver'); diff --git a/lib/statusnet.php b/lib/statusnet.php index a9b05388c3..844a15c339 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -423,11 +423,20 @@ class StatusNet static function isHTTPS() { // There are some exceptions to this; add them here! - if(empty($_SERVER['HTTPS'])) { + if (empty($_SERVER['HTTPS'])) { return false; - } else { - return $_SERVER['HTTPS'] !== 'off'; } + + // If it is _not_ "off", it is on, so "true". + return strtolower($_SERVER['HTTPS']) !== 'off'; + } + + /** + * Can we use HTTPS? Then do! Only return false if it's not configured ("never"). + */ + static function useHTTPS() + { + return self::isHTTPS() || common_config('site', 'ssl') != 'never'; } } -- 2.39.5