]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
When called in offline queue, File::url was HTTP
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 12 Jan 2015 17:56:19 +0000 (18:56 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 12 Jan 2015 18:19:41 +0000 (19:19 +0100)
Despite having the site configured "always" for HTTPS, File generated
thumbnails and such with HTTP urls.

classes/File.php
lib/statusnet.php

index 8eff7d61823986655a42f65bdbe1b7377894914b..1edc89d5d7be503d30f3a1e03bcacc5453fa58ea 100644 (file)
@@ -303,7 +303,7 @@ class File extends Managed_DataObject
 
         }
 
-        if (StatusNet::isHTTPS()) {
+        if (StatusNet::useHTTPS()) {
 
             $sslserver = common_config('attachments', 'sslserver');
 
index a9b05388c393f6e0e6a4a51c55c96407a2a08845..844a15c339d10cc8ab363ef296c366ccba1c5963 100644 (file)
@@ -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';
     }
 }