Mercurial > hg
changeset 29556:1b8b6adb2365
tests: use sslutil.wrapserversocket()
Like the built-in HTTPS server, this code was using the ssl module
directly and only using TLS 1.0. Like the built-in HTTPS server,
we switch it to use sslutil.wrapserversocket() so it can follow better
practices.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 13 Jul 2016 20:41:07 -0700 |
parents | 121d11814c62 |
children | 53de8255ec4e |
files | tests/dummysmtpd.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/dummysmtpd.py Tue Jul 12 23:12:03 2016 -0700 +++ b/tests/dummysmtpd.py Wed Jul 13 20:41:07 2016 -0700 @@ -12,6 +12,8 @@ from mercurial import ( cmdutil, + sslutil, + ui as uimod, ) def log(msg): @@ -35,11 +37,10 @@ if not pair: return conn, addr = pair + ui = uimod.ui() try: # wrap_socket() would block, but we don't care - conn = ssl.wrap_socket(conn, server_side=True, - certfile=self._certfile, - ssl_version=ssl.PROTOCOL_TLSv1) + conn = sslutil.wrapserversocket(conn, ui, certfile=self._certfile) except ssl.SSLError: log('%s ssl error\n' % addr[0]) conn.close()