summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBill Janssen <janssen@parc.com>2008-08-12 16:31:21 (GMT)
committerBill Janssen <janssen@parc.com>2008-08-12 16:31:21 (GMT)
commit39295c2650fe3f7d0a94bfa172e95cfedb28433f (patch)
treee2f1df451c0c263172a82a2a0dee27caec7f3ae7 /Lib/test
parentf91d46a17d85da323895950852093117bc21f860 (diff)
downloadcpython-39295c2650fe3f7d0a94bfa172e95cfedb28433f.zip
cpython-39295c2650fe3f7d0a94bfa172e95cfedb28433f.tar.gz
cpython-39295c2650fe3f7d0a94bfa172e95cfedb28433f.tar.bz2
remove duplicate close() from ssl.py; expose unwrap and add test for it
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ssl.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 79dad64..fca8a57 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -282,6 +282,14 @@ else:
self.write("OK\n")
if not self.wrap_conn():
return
+ elif self.server.starttls_server and self.sslconn and msg.strip() == 'ENDTLS':
+ if test_support.verbose and self.server.connectionchatty:
+ sys.stdout.write(" server: read ENDTLS from client, sending OK...\n")
+ self.write("OK\n")
+ self.sslconn.unwrap()
+ self.sslconn = None
+ if test_support.verbose and self.server.connectionchatty:
+ sys.stdout.write(" server: connection is now unencrypted...\n")
else:
if (test_support.verbose and
self.server.connectionchatty):
@@ -867,7 +875,7 @@ else:
def testSTARTTLS (self):
- msgs = ("msg 1", "MSG 2", "STARTTLS", "MSG 3", "msg 4")
+ msgs = ("msg 1", "MSG 2", "STARTTLS", "MSG 3", "msg 4", "ENDTLS", "msg 5", "msg 6")
server = ThreadedEchoServer(CERTFILE,
ssl_version=ssl.PROTOCOL_TLSv1,
@@ -907,8 +915,15 @@ else:
" client: read %s from server, starting TLS...\n"
% repr(outdata))
conn = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1)
-
wrapped = True
+ elif (indata == "ENDTLS" and
+ outdata.strip().lower().startswith("ok")):
+ if test_support.verbose:
+ sys.stdout.write(
+ " client: read %s from server, ending TLS...\n"
+ % repr(outdata))
+ s = conn.unwrap()
+ wrapped = False
else:
if test_support.verbose:
sys.stdout.write(