# HG changeset patch # User Gregory Szorc # Date 2016-05-06 02:10:18 # Node ID 7424f429419987706559aa67d81d337f560961df # Parent c04ad3d3c651bc2b28293f3e49209b6d0b1f6161 sslutil: require serverhostname argument (API) All callers now specify it. So we can require it. Requiring the argument means SNI will always work if supported by Python. The main reason for this change is to store state on the socket instance to make the validation function generic. This will be evident in subsequent commits. diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -120,6 +120,9 @@ def wrapsocket(sock, keyfile, certfile, server (and client) support SNI, this tells the server which certificate to use. """ + if not serverhostname: + raise error.Abort('serverhostname argument is required') + # Despite its name, PROTOCOL_SSLv23 selects the highest protocol # that both ends support, including TLS protocols. On legacy stacks, # the highest it likely goes in TLS 1.0. On modern stacks, it can