]> git.ipfire.org Git - ipfire.org.git/commitdiff
mirrors: Use HTTPS when the mirror server supports it
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Oct 2017 14:05:05 +0000 (15:05 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Oct 2017 14:05:05 +0000 (15:05 +0100)
Fixes #11530

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
webapp/backend/mirrors.py

index 9869dc0cad9c812516a13b9bfa3d6a3f39813665..042c0b6177072b8001bc1dea4fcf61d6431b6041 100644 (file)
@@ -312,7 +312,7 @@ class Mirror(Object):
                return ret
 
        def generate_url(self):
-               url = "http://%s" % self.hostname
+               url = "%s://%s" % ("https" if self.supports_https else "http", self.hostname)
                if not self.path.startswith("/"):
                        url += "/"
                url += "%s" % self.path
@@ -328,6 +328,10 @@ class Mirror(Object):
        def path(self):
                return self._info.path
 
+        @property
+        def supports_https(self):
+                return self._info.supports_https
+
        @property
        def address(self):
                for addr in self.addresses4: