#1632 create_ssl_context ca reorder

This commit is contained in:
Flowseal
2026-11-23 07:36:05 +03:00
parent 4ba783c796
commit 2c1984f071
+9 -4
View File
@@ -151,11 +151,16 @@ def set_x25519(context: ssl.SSLContext) -> None:
def create_ssl_context(*, check_hostname: bool = True) -> ssl.SSLContext:
context = ssl.create_default_context()
bundle_dir = getattr(sys, '_MEIPASS', None)
cafile = (os.path.join(bundle_dir, 'certifi', 'cacert.pem')
if bundle_dir else certifi.where())
context = ssl.create_default_context(cafile=cafile)
context.load_default_certs()
try:
cafile = (os.path.join(bundle_dir, 'certifi', 'cacert.pem')
if bundle_dir else certifi.where())
context.load_verify_locations(cafile=cafile)
except Exception:
pass
set_x25519(context)
context.check_hostname = check_hostname
return context