|
@@ -10,6 +10,9 @@ from UM.Version import Version
|
|
|
import urllib.request
|
|
|
from urllib.error import URLError
|
|
|
from typing import Dict, Optional
|
|
|
+import ssl
|
|
|
+
|
|
|
+import certifi
|
|
|
|
|
|
from .FirmwareUpdateCheckerLookup import FirmwareUpdateCheckerLookup, getSettingsKeyForMachine
|
|
|
from .FirmwareUpdateCheckerMessage import FirmwareUpdateCheckerMessage
|
|
@@ -39,8 +42,12 @@ class FirmwareUpdateCheckerJob(Job):
|
|
|
result = self.STRING_ZERO_VERSION
|
|
|
|
|
|
try:
|
|
|
+ # CURA-6698 Create an SSL context and use certifi CA certificates for verification.
|
|
|
+ context = ssl.SSLContext(protocol = ssl.PROTOCOL_TLSv1_2)
|
|
|
+ context.load_verify_locations(cafile = certifi.where())
|
|
|
+
|
|
|
request = urllib.request.Request(url, headers = self._headers)
|
|
|
- response = urllib.request.urlopen(request)
|
|
|
+ response = urllib.request.urlopen(request, context = context)
|
|
|
result = response.read().decode("utf-8")
|
|
|
except URLError:
|
|
|
Logger.log("w", "Could not reach '{0}', if this URL is old, consider removal.".format(url))
|