changeset 29224:7424f4294199

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 05 May 2016 19:10:18 -0700
parents c04ad3d3c651
children b115eed11780
files mercurial/sslutil.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sslutil.py	Wed May 18 16:37:32 2016 -0500
+++ b/mercurial/sslutil.py	Thu May 05 19:10:18 2016 -0700
@@ -120,6 +120,9 @@
       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