[issue20951] SSLSocket.send() returns 0 for non-blocking socket

Nikolaus Rath report at bugs.python.org
Sun Mar 16 22:52:12 CET 2014


Nikolaus Rath added the comment:

This is actually seems to be not just an inconvience, but a real bug: since SSLSocket.sendall() uses SSLSocket.send() internally, the former method will busy-loop when called on a non-blocking socket. 

Note also that the .sendto and .write methods already behave consistently and raise SSLWantWrite. It seems it's really just the send() method that is the lone outlier.

The attached patch changes ssl.send to raise SSLWantWrite instead of returning zero. The  full testsuite still runs fine. I'm a bit sceptical though, because the code looks as if send() was deliberately written to catch the SSLWantWrite exception and return zero instead.. Can anyone familiar with the code comment on this?

----------
keywords: +patch
Added file: http://bugs.python.org/file34448/issue20951.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20951>
_______________________________________


More information about the Python-bugs-list mailing list