Author chris.stawarz
Recipients chris.stawarz, janssen
Date 2007-10-12.17:19:50
SpamBayes Score 0.00265354
Marked as misclassified No
Message-id <>
In-reply-to <>
> The loop in _ssl.c/do_handshake will never return WANT_READ or
> WANT_WRITE, so the loop in the test case, for instance, is  
> unnecessary.

I don't know why you think that, but it's easy enough to show that  
this statement is incorrect.  I've attached two scripts  
( and  The first does  
basically the same thing as my test case, but connecting to a  
different server and with some print statements added.  Here's the  
output I get when I run it using an up-to-date trunk checkout with my  
patch applied:

$ ../build/bin/python2.6
starting handshake
need read
need read
need read
handshake complete

The second reproduces the situation that led me to file this bug  
report in the first place.  Here's what happens when I run it with an  
*unpatched* trunk build:

$ ../build/bin/python2.6
starting handshake
need read
Traceback (most recent call last):
   File "", line 14, in <module>
     s = ssl.wrap_socket(s,cert_reqs=ssl.CERT_NONE)
   File "/Users/cstawarz/Documents/Code/Python/svn/build/lib/ 
python2.6/", line 466, in wrap_socket
     ssl_version=ssl_version, ca_certs=ca_certs)
   File "/Users/cstawarz/Documents/Code/Python/svn/build/lib/ 
python2.6/", line 103, in __init__
     cert_reqs, ssl_version, ca_certs)
ssl.SSLError: [Errno 1] _ssl.c:429: error:04077068:rsa  
routines:RSA_verify:bad signature

As you see, in both cases the handshaking fails with  
SSL_ERROR_WANT_READ.  But without the fixes introduced by my patch,  
there's no way to handle the error.
File name Uploaded chris.stawarz, 2007-10-12.17:19:50 chris.stawarz, 2007-10-12.17:19:50
Date User Action Args
2007-10-12 17:19:51chris.stawarzsetspambayes_score: 0.00265354 -> 0.00265354
recipients: + chris.stawarz, janssen
2007-10-12 17:19:51chris.stawarzlinkissue1251 messages
2007-10-12 17:19:50chris.stawarzcreate