mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-10-21 02:58:45 +00:00
fixes #1422
This commit is contained in:
1 parent
3fa281625f
commit
a232472cbe
2 files changed
+11
-5
No files matched your search
+6
-1
@@ -3,7 +3,9 @@ import urllib.request
|
||||
import http.client
|
||||
import ssl
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import certifi
|
||||
|
||||
@@ -141,7 +143,10 @@ class _PinnedHTTPSHandler(urllib.request.HTTPSHandler):
|
||||
|
||||
|
||||
def create_ssl_context(*, check_hostname: bool = True) -> ssl.SSLContext:
|
||||
context = ssl.create_default_context(cafile=certifi.where())
|
||||
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()
|
||||
context.check_hostname = check_hostname
|
||||
return context
|
||||
|
||||
Reference in new issue
Block a user