mirror of
https://github.com/python/cpython.git
synced 2025-11-09 14:06:30 +00:00
Update example of non-blocking SSL code for the new finer-grained exceptions
This commit is contained in:
parent
41032a69c1
commit
873bf262ad
1 changed files with 4 additions and 7 deletions
|
|
@ -1044,13 +1044,10 @@ to be aware of:
|
||||||
try:
|
try:
|
||||||
sock.do_handshake()
|
sock.do_handshake()
|
||||||
break
|
break
|
||||||
except ssl.SSLError as err:
|
except ssl.SSLWantReadError:
|
||||||
if err.args[0] == ssl.SSL_ERROR_WANT_READ:
|
select.select([sock], [], [])
|
||||||
select.select([sock], [], [])
|
except ssl.SSLWantWriteError:
|
||||||
elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:
|
select.select([], [sock], [])
|
||||||
select.select([], [sock], [])
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
.. _ssl-security:
|
.. _ssl-security:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue