forked from pool/python
43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
Index: Lib/ssl.py
|
|
===================================================================
|
|
--- Lib/ssl.py (revision 66515)
|
|
+++ Lib/ssl.py (working copy)
|
|
@@ -434,7 +434,10 @@
|
|
for compability with Python 2.5 and earlier. Will disappear in
|
|
Python 3.0."""
|
|
|
|
- ssl_sock = _ssl.sslwrap(sock._sock, 0, keyfile, certfile, CERT_NONE,
|
|
+ if hasattr(sock, "_sock"):
|
|
+ sock = sock._sock
|
|
+
|
|
+ ssl_sock = _ssl.sslwrap(sock, 0, keyfile, certfile, CERT_NONE,
|
|
PROTOCOL_SSLv23, None)
|
|
ssl_sock.do_handshake()
|
|
return ssl_sock
|
|
Index: Lib/test/test_ssl.py
|
|
===================================================================
|
|
--- Lib/test/test_ssl.py (revision 66515)
|
|
+++ Lib/test/test_ssl.py (working copy)
|
|
@@ -58,6 +58,21 @@
|
|
finally:
|
|
s.close()
|
|
|
|
+ def testSimpleSSLwrap(self):
|
|
+ try:
|
|
+ ssl.sslwrap_simple(socket.socket(socket.AF_INET))
|
|
+ except IOError, e:
|
|
+ if e.errno == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
|
|
+ pass
|
|
+ else:
|
|
+ raise
|
|
+ try:
|
|
+ ssl.sslwrap_simple(socket.socket(socket.AF_INET)._sock)
|
|
+ except IOError, e:
|
|
+ if e.errno == 32: # broken pipe when ssl_sock.do_handshake(), this test doesn't care about that
|
|
+ pass
|
|
+ else:
|
|
+ raise
|
|
|
|
def testCrucialConstants(self):
|
|
ssl.PROTOCOL_SSLv2
|