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
--- 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: