diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-04-29 08:03:28 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-04-29 08:03:28 (GMT) |
commit | b4bebdafe354f68a9b952772da109cccd73f6577 (patch) | |
tree | 939614adab3160c1c9d54ba6975b326a2cdd31b9 /Doc/library/ssl.rst | |
parent | 727a463aa624931a89c796bfa4fe5711e2c403ff (diff) | |
download | cpython-b4bebdafe354f68a9b952772da109cccd73f6577.zip cpython-b4bebdafe354f68a9b952772da109cccd73f6577.tar.gz cpython-b4bebdafe354f68a9b952772da109cccd73f6577.tar.bz2 |
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.
Diffstat (limited to 'Doc/library/ssl.rst')
-rw-r--r-- | Doc/library/ssl.rst | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 79cbbdc..8c1484b 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1604,8 +1604,25 @@ the sockets in non-blocking mode and use an event loop). Notes on non-blocking sockets ----------------------------- -When working with non-blocking sockets, there are several things you need -to be aware of: +SSL sockets behave slightly different than regular sockets in +non-blocking mode. When working with non-blocking sockets, there are +thus several things you need to be aware of: + +- Most :class:`SSLSocket` methods will raise either + :exc:`SSLWantWriteError` or :exc:`SSLWantReadError` instead of + :exc:`BlockingIOError` if an I/O operation would + block. :exc:`SSLWantReadError` will be raised if a read operation on + the underlying socket is necessary, and :exc:`SSLWantWriteError` for + a write operation on the underlying socket. Note that attempts to + *write* to an SSL socket may require *reading* from the underlying + socket first, and attempts to *read* from the SSL socket may require + a prior *write* to the underlying socket. + + .. versionchanged:: 3.5 + + In earlier Python versions, the :meth:`!SSLSocket.send` method + returned zero instead of raising :exc:`SSLWantWriteError` or + :exc:`SSLWantReadError`. - Calling :func:`~select.select` tells you that the OS-level socket can be read from (or written to), but it does not imply that there is sufficient |