[issue8240] ssl.SSLSocket.write may fail on non-blocking sockets
Antoine Pitrou
report at bugs.python.org
Fri Mar 26 19:58:58 CET 2010
Antoine Pitrou <pitrou at free.fr> added the comment:
> pitrou: that's debatable, since the Python programmer has no control
> over memory pointers.
No, but he has control over whether he always uses the same object, or
generates a new argument everytime.
> As I said, I have a cStringIO buffer, and two consecutive calls to
> buffer.getvalue() yield different objects. What can I do about it? I
> think it's a rather sane scenario, and I don't feel I'm doing anything
> wrong.
Hmm, indeed. What you can do, very simply, is cache the getvalue()
result once you have generated it.
> If you think the programmer should be alerted about it, however, then
> we should at least say it explicitely in the documentation and
> probably return an explicit Python error. I had to google quite a bit
> before finding out what this error meant:
>
> error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry
Indeed, this is cryptic.
By the way, I've found a thread explaining this in greater detail:
http://readlist.com/lists/openssl.org/openssl-users/0/1794.html
Basically, even when SSL_write() says the write must be retried, it does
process and buffer some of your data, so that if you retry with
different data, some junk will be written out on the SSL socket.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8240>
_______________________________________
More information about the Python-bugs-list
mailing list