Issue 22252: ssl blocking IO errors should inherit BlockingIOError (original) (raw)

Created on 2014-08-22 17:31 by h.venev, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg225687 - (view) Author: Hristo Venev (h.venev) * Date: 2014-08-22 17:31
ssl.SSLWantReadError and ssl.SSLWantWriteError should inherit io.BlockingIOError. Generic code that works with non-blocking sockets will stop working with SSLSockets. Does anybody have any idea if SSLSocket.read() will need to write to the underlying socket or SSLSocket.write() need to read from it? AFAIK they don't. Assuming that ssl.SSLWantReadErorr and ssl.SSLWantWriteError perfectly map to io.BlockingIOError (except during handshake).
msg225718 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-08-23 00:32
> ssl.SSLWantReadError and ssl.SSLWantWriteError should inherit io.BlockingIOError. > Generic code that works with non-blocking sockets will stop working with SSLSockets. I'll have to think about that, but in any case non-blocking SSL code needs to be subtler than normal non-blocking code, because of this: > Does anybody have any idea if SSLSocket.read() will need to write to the underlying socket or SSLSocket.write() need to read from it? AFAIK they don't. Yet the documentation clearly tells you they can: https://docs.python.org/3/library/ssl.html#notes-on-non-blocking-sockets
msg225734 - (view) Author: Hristo Venev (h.venev) * Date: 2014-08-23 07:02
My questions are: When will SSLSocket.recv() raise SSLWantWriteError? When will SSLSocket.send() raise SSLWantReadError? According to my very basic knowledge abou the protocol, this will never happen.
msg225743 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-08-23 12:46
Le 23/08/2014 03:02, Hristo Venev a écrit : > When will SSLSocket.recv() raise SSLWantWriteError? > When will SSLSocket.send() raise SSLWantReadError? > > According to my very basic knowledge abou the protocol, this will never happen. According to the OpenSSL docs: """As at any time a re-negotiation is possible, a call to SSL_write() can also cause read operations!""" """As at any time a re-negotiation is possible, a call to SSL_read() can also cause write operations!"""
msg275203 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-08 23:00
I agree with Antoine, let's not subclass io.BlockingIOError.
History
Date User Action Args
2022-04-11 14:58:07 admin set github: 66448
2016-09-08 23:00:04 christian.heimes set status: open -> closedresolution: wont fixmessages: +
2015-03-08 05:49:24 martin.panter set nosy: + martin.pantertitle: ssl blocking IO errors -> ssl blocking IO errors should inherit BlockingIOError
2014-08-23 12:46:53 pitrou set messages: +
2014-08-23 07:02:08 h.venev set messages: +
2014-08-23 00:32:20 pitrou set nosy: + janssen, pitrou, giampaolo.rodola, christian.heimes, alex, dstufftmessages: +
2014-08-22 17:31:19 h.venev create