Author nikratio
Recipients christian.heimes, giampaolo.rodola, janssen, nikratio, pitrou
Date 2014-03-16.21:16:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395004591.32.0.211111410214.issue20951@psf.upfronthosting.co.za>
In-reply-to
Content
When using non-blocking operation, the SSLSocket.send method returns 0 if no data can be sent at this point.

This is counterintuitive, because in the same situation (write to non-blocking socket that isn't ready for IO):

 * A regular (non-SSL) socket raises BlockingIOError
 * libc's send(2) does not return 0, but -EAGAIN or -EWOULDBLOCK.
 * OpenSSL's ssl_write does not return 0, but returns an SSL_ERROR_WANT_WRITE error
 * The ssl module's documentation describes the SSLWantWrite exception as "A subclass of SSLError raised by a non-blocking SSL socket when trying to read or write data, but more data needs to be sent on the underlying TCP transport before the request can be fulfilled."
 * Consistent with that, trying to *read* from a non-blocking SSLSocket when no data is ready raises SSLWantRead, instead of returning zero.

This behavior also makes it more complicated to write code that works with both SSLSockets and regular sockets.


Since the current behavior undocumented at best (and contradicting the documentation at worst), can we change this in Python 3.5?
History
Date User Action Args
2014-03-16 21:16:31nikratiosetrecipients: + nikratio, janssen, pitrou, giampaolo.rodola, christian.heimes
2014-03-16 21:16:31nikratiosetmessageid: <1395004591.32.0.211111410214.issue20951@psf.upfronthosting.co.za>
2014-03-16 21:16:31nikratiolinkissue20951 messages
2014-03-16 21:16:30nikratiocreate