mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-31 15:28:50 +00:00
Merge pull request #31 from mitmproxy/fix_dhparam_gen
create dhparam file if it doesn't exist, fix mitmproxy/mitmproxy#235
This commit is contained in:
commit
a3107474f9
@ -123,6 +123,13 @@ class CertStore:
|
||||
|
||||
@classmethod
|
||||
def load_dhparam(klass, path):
|
||||
|
||||
# netlib<=0.10 doesn't generate a dhparam file.
|
||||
# Create it now if neccessary.
|
||||
if not os.path.exists(path):
|
||||
with open(path, "wb") as f:
|
||||
f.write(DEFAULT_DHPARAM)
|
||||
|
||||
bio = OpenSSL.SSL._lib.BIO_new_file(path, b"r")
|
||||
if bio != OpenSSL.SSL._ffi.NULL:
|
||||
bio = OpenSSL.SSL._ffi.gc(bio, OpenSSL.SSL._lib.BIO_free)
|
||||
|
Loading…
Reference in New Issue
Block a user