Trap the SSL npn protocols attribute error on Python 3.10 (#151)
only set npn if it exists
This commit is contained in:
parent
add8f4852c
commit
d89bc052f9
|
@ -752,10 +752,8 @@ class Channel:
|
|||
ctx.options |= (_ssl.OP_NO_TLSv1 | _ssl.OP_NO_TLSv1_1)
|
||||
ctx.set_ciphers('ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20')
|
||||
ctx.set_alpn_protocols(['h2'])
|
||||
try:
|
||||
if _ssl.HAS_NPN:
|
||||
ctx.set_npn_protocols(['h2'])
|
||||
except NotImplementedError:
|
||||
pass
|
||||
|
||||
return ctx
|
||||
|
||||
|
|
Loading…
Reference in New Issue