#debug = false
[downloader]
-# Pakfire can use a HTTP proxy for all downloads.
-# Authentication can be used like this:
-# http://foo:bar@192.168.180.1:800
+# Pakfire can use a proxy for HTTP, HTTPS and FTP
# If no proxy setting is configured, Pakfire will
# use the environment settings.
-#http_proxy = http://192.168.180.1:800
+#proxy = http://192.168.180.1:800
-# You can throttle the download bandwidth with this
-# parameter. Unit: bytes per second.
-#bandwidth_throttle = 10240
-
-# Offline mode.
-# You may disable any kind of download action.
-# Howevery, pakfire won't be fully functionable.
-#offline = False
+# Verify SSL certificates?
+#verify = true
[signatures]
# Sets the mode of the signature verification.
from .ui import progressbar
+from .config import config
from .constants import *
from . import errors
# Create an SSL context to HTTPS connections
self.ssl_context = ssl.create_default_context()
+ # Configure upstream proxies
+ proxy = config.get("downloader", "proxy")
+ if proxy:
+ for protocol in ("http", "https", "ftp"):
+ self.set_proxy(protocol, proxy)
+
+ # Should we verify SSL certificates?
+ verify = config.get_bool("downloader", "verify", True)
+ if not verify:
+ self.disable_certificate_verification()
+
def set_proxy(self, protocol, host):
"""
Sets a proxy that will be used to send this request
"""
self.proxies[protocol] = host
- def disable_certificate_validation(self):
+ def disable_certificate_verification(self):
# Disable checking hostname
self.ssl_context.check_hostname = False