[Python-checkins] r80451 - in python/trunk: Misc/NEWS Modules/_ssl.c

antoine.pitrou python-checkins at python.org
Sat Apr 24 21:57:01 CEST 2010


Author: antoine.pitrou
Date: Sat Apr 24 21:57:01 2010
New Revision: 80451

Log:
The do_handshake() method of SSL objects now adjusts the blocking mode of
the SSL structure if necessary (as other methods already do).



Modified:
   python/trunk/Misc/NEWS
   python/trunk/Modules/_ssl.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sat Apr 24 21:57:01 2010
@@ -25,6 +25,9 @@
 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

Modified: python/trunk/Modules/_ssl.c
==============================================================================
--- python/trunk/Modules/_ssl.c	(original)
+++ python/trunk/Modules/_ssl.c	Sat Apr 24 21:57:01 2010
@@ -455,7 +455,12 @@
 {
 	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. */


More information about the Python-checkins mailing list