Skip to content
Snippets Groups Projects
Commit 1b8b6adb2365 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

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.
parent 121d11814c62
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,8 @@
from mercurial import (
cmdutil,
sslutil,
ui as uimod,
)
def log(msg):
......@@ -35,5 +37,6 @@
if not pair:
return
conn, addr = pair
ui = uimod.ui()
try:
# wrap_socket() would block, but we don't care
......@@ -38,8 +41,6 @@
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment