The do_handshake() method of SSL objects now adjusts the blocking mode of

the SSL structure if necessary (as other methods already do).
This commit is contained in:
Antoine Pitrou 2010-04-24 19:57:01 +00:00
parent 5fa9fb4062
commit 4d3e372ff3
2 changed files with 9 additions and 1 deletions

View File

@ -25,6 +25,9 @@ Core and Builtins
Library 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 #7507: Quote "!" in pipes.quote(); it is special to some shells.
- Issue #5238: Calling makefile() on an SSL object would prevent the - Issue #5238: Calling makefile() on an SSL object would prevent the

View File

@ -455,7 +455,12 @@ static PyObject *PySSL_SSLdo_handshake(PySSLObject *self)
{ {
int ret; int ret;
int err; 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 */ /* Actually negotiate SSL connection */
/* XXX If SSL_do_handshake() returns 0, it's also a failure. */ /* XXX If SSL_do_handshake() returns 0, it's also a failure. */