mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #20951: SSLSocket.send() now raises either SSLWantReadError or SSLWantWriteError on a non-blocking socket if the operation would block. Previously, it would return 0.
Patch by Nikolaus Rath.
This commit is contained in:
parent
727a463aa6
commit
b4bebdafe3
4 changed files with 54 additions and 13 deletions
12
Lib/ssl.py
12
Lib/ssl.py
|
|
@ -664,17 +664,7 @@ class SSLSocket(socket):
|
|||
raise ValueError(
|
||||
"non-zero flags not allowed in calls to send() on %s" %
|
||||
self.__class__)
|
||||
try:
|
||||
v = self._sslobj.write(data)
|
||||
except SSLError as x:
|
||||
if x.args[0] == SSL_ERROR_WANT_READ:
|
||||
return 0
|
||||
elif x.args[0] == SSL_ERROR_WANT_WRITE:
|
||||
return 0
|
||||
else:
|
||||
raise
|
||||
else:
|
||||
return v
|
||||
return self._sslobj.write(data)
|
||||
else:
|
||||
return socket.send(self, data, flags)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue