diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-04-24 19:57:01 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-04-24 19:57:01 (GMT) |
commit | 4d3e372ff3f611aa76458a48f26ec4701315c128 (patch) | |
tree | 17bc0c1472cf2d773be57c6581f3054b069b0d16 | |
parent | 5fa9fb40621b3963beef9d58388bb0616e0d8de9 (diff) | |
download | cpython-4d3e372ff3f611aa76458a48f26ec4701315c128.zip cpython-4d3e372ff3f611aa76458a48f26ec4701315c128.tar.gz cpython-4d3e372ff3f611aa76458a48f26ec4701315c128.tar.bz2 |
The do_handshake() method of SSL objects now adjusts the blocking mode of
the SSL structure if necessary (as other methods already do).
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/_ssl.c | 7 |
2 files changed, 9 insertions, 1 deletions
@@ -25,6 +25,9 @@ Core and Builtins Library ------- +- The do_handshake() method of SSL objects now adjusts the blocking mode of + the SSL structure if necessary (as other methods already do). + - Issue #7507: Quote "!" in pipes.quote(); it is special to some shells. - Issue #5238: Calling makefile() on an SSL object would prevent the diff --git a/Modules/_ssl.c b/Modules/_ssl.c index d19bf2d..e81c219 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -455,7 +455,12 @@ static PyObject *PySSL_SSLdo_handshake(PySSLObject *self) { int ret; int err; - int sockstate; + int sockstate, nonblocking; + + /* just in case the blocking state of the socket has been changed */ + nonblocking = (self->Socket->sock_timeout >= 0.0); + BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking); + BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking); /* Actually negotiate SSL connection */ /* XXX If SSL_do_handshake() returns 0, it's also a failure. */ |