##// END OF EJS Templates
sslutil: store OP_NO_SSL* constants in module scope...
Gregory Szorc -
r28648:7fc787e5 default
parent child Browse files
Show More
@@ -29,6 +29,13 b' from . import ('
29
29
30 hassni = getattr(ssl, 'HAS_SNI', False)
30 hassni = getattr(ssl, 'HAS_SNI', False)
31
31
32 try:
33 OP_NO_SSLv2 = ssl.OP_NO_SSLv2
34 OP_NO_SSLv3 = ssl.OP_NO_SSLv3
35 except AttributeError:
36 OP_NO_SSLv2 = 0x1000000
37 OP_NO_SSLv3 = 0x2000000
38
32 _canloaddefaultcerts = False
39 _canloaddefaultcerts = False
33 try:
40 try:
34 # ssl.SSLContext was added in 2.7.9 and presence indicates modern
41 # ssl.SSLContext was added in 2.7.9 and presence indicates modern
@@ -48,7 +55,7 b' try:'
48 # maintainers for us, but that breaks too many things to
55 # maintainers for us, but that breaks too many things to
49 # do it in a hurry.
56 # do it in a hurry.
50 sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
57 sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
51 sslcontext.options |= ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3
58 sslcontext.options |= OP_NO_SSLv2 | OP_NO_SSLv3
52 if certfile is not None:
59 if certfile is not None:
53 def password():
60 def password():
54 f = keyfile or certfile
61 f = keyfile or certfile
General Comments 0
You need to be logged in to leave comments. Login now