changeset 37872:51a2f8d199c7

sslutil: fix some edge cases in Python 3 support Detected by fixing up test-url.py on Python 3. Differential Revision: https://phab.mercurial-scm.org/D3467
author Augie Fackler <augie@google.com>
date Fri, 27 Apr 2018 00:05:46 -0400
parents 6574c81b6831
children bb1b15acfd06
files mercurial/sslutil.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sslutil.py	Thu Apr 26 23:33:27 2018 -0400
+++ b/mercurial/sslutil.py	Fri Apr 27 00:05:46 2018 -0400
@@ -640,9 +640,9 @@
         return _('no certificate received')
 
     dnsnames = []
-    san = cert.get('subjectAltName', [])
+    san = cert.get(r'subjectAltName', [])
     for key, value in san:
-        if key == 'DNS':
+        if key == r'DNS':
             try:
                 if _dnsnamematch(value, hostname):
                     return
@@ -672,6 +672,7 @@
 
                     dnsnames.append(value)
 
+    dnsnames = [pycompat.bytesurl(d) for d in dnsnames]
     if len(dnsnames) > 1:
         return _('certificate is for %s') % ', '.join(dnsnames)
     elif len(dnsnames) == 1: