mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-11-23 16:06:32 +03:00
#1632 create_ssl_context ca reorder
This commit is contained in:
+9
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user