Mercurial > hg
comparison mercurial/sslutil.py @ 44873:47b3c8383cc1
sslutil: set `_canloaddefaultcerts` to `True` if `ssl.SSLContext` is present
The `load_default_certs()` method was already present when `ssl.SSLContext`
was backported to Python 2.7 (https://hg.python.org/cpython/rev/221a1f9155e2).
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 30 May 2020 03:46:59 +0200 |
parents | cbc5755df6bf |
children | 7c19eb372438 |
comparison
equal
deleted
inserted
replaced
44872:aa790f7c967a | 44873:47b3c8383cc1 |
---|---|
56 try: | 56 try: |
57 # ssl.SSLContext was added in 2.7.9 and presence indicates modern | 57 # ssl.SSLContext was added in 2.7.9 and presence indicates modern |
58 # SSL/TLS features are available. | 58 # SSL/TLS features are available. |
59 SSLContext = ssl.SSLContext | 59 SSLContext = ssl.SSLContext |
60 modernssl = True | 60 modernssl = True |
61 _canloaddefaultcerts = util.safehasattr(SSLContext, b'load_default_certs') | 61 _canloaddefaultcerts = True |
62 except AttributeError: | 62 except AttributeError: |
63 modernssl = False | 63 modernssl = False |
64 _canloaddefaultcerts = False | 64 _canloaddefaultcerts = False |
65 | 65 |
66 # We implement SSLContext using the interface from the standard library. | 66 # We implement SSLContext using the interface from the standard library. |