Patchwork D3467: sslutil: fix some edge cases in Python 3 support

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 1:34 p.m.
Message ID <6bb017814bda054dda8b4022f9048db3@localhost.localdomain>
Download mbox | patch
Permalink /patch/31347/
State Not Applicable
Headers show

Comments

phabricator - May 8, 2018, 1:34 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG51a2f8d199c7: sslutil: fix some edge cases in Python 3 support (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3467?vs=8494&id=8522

REVISION DETAIL
  https://phab.mercurial-scm.org/D3467

AFFECTED FILES
  mercurial/sslutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -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: