diff -r a730280392ee Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py Fri Mar 26 04:18:31 2010 +0100 +++ b/Lib/test/test_ssl.py Fri Mar 26 16:32:37 2010 +0100 @@ -167,6 +167,27 @@ if test_support.verbose: sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count) + def testNonBlockingSend(self): + s = socket.socket(socket.AF_INET) + s.connect(("svn.python.org", 443)) + s.setblocking(False) + s = ssl.wrap_socket(s, + cert_reqs=ssl.CERT_NONE) + # have two different strings with the same content, but not the same memory address + data = (('xx'[0] + 'xx'[1:])*10000, ('xx'[0] + 'xx'[1:])*10000) + i = 0 + while True: + count = s.send(data[i % 2]) + i += 1 + if count == 0: + select.select([], [s], []) + try: + count = s.send(data[i % 2]) + except ssl.SSLError, x: + raise test_support.TestFailed("Unexpected SSL error: " + str(x)) + break + s.close() + def testFetchServerCert(self): pem = ssl.get_server_certificate(("svn.python.org", 443))