Show More
@@ -13,8 +13,16 b' from mercurial.i18n import _' | |||||
13 | try: |
|
13 | try: | |
14 | # avoid using deprecated/broken FakeSocket in python 2.6 |
|
14 | # avoid using deprecated/broken FakeSocket in python 2.6 | |
15 | import ssl |
|
15 | import ssl | |
16 | ssl_wrap_socket = ssl.wrap_socket |
|
|||
17 | CERT_REQUIRED = ssl.CERT_REQUIRED |
|
16 | CERT_REQUIRED = ssl.CERT_REQUIRED | |
|
17 | def ssl_wrap_socket(sock, keyfile, certfile, | |||
|
18 | cert_reqs=ssl.CERT_NONE, ca_certs=None): | |||
|
19 | sslsocket = ssl.wrap_socket(sock, keyfile, certfile, | |||
|
20 | cert_reqs=cert_reqs, ca_certs=ca_certs) | |||
|
21 | # check if wrap_socket failed silently because socket had been closed | |||
|
22 | # - see http://bugs.python.org/issue13721 | |||
|
23 | if not sslsocket.cipher(): | |||
|
24 | raise util.Abort(_('ssl connection failed')) | |||
|
25 | return sslsocket | |||
18 | except ImportError: |
|
26 | except ImportError: | |
19 | CERT_REQUIRED = 2 |
|
27 | CERT_REQUIRED = 2 | |
20 |
|
28 |
General Comments 0
You need to be logged in to leave comments.
Login now