comparison mercurial/sslutil.py @ 37666:46e705b79323

py3: add b'' prefixes to make values bytes # skip-blame because just b'' prefixes Differential Revision: https://phab.mercurial-scm.org/D3327
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 14 Apr 2018 02:03:02 +0530
parents a8a902d7176e
children 51a2f8d199c7
comparison
equal deleted inserted replaced
37665:83250442dc81 37666:46e705b79323
619 # where the wildcard character is embedded within an A-label or 619 # where the wildcard character is embedded within an A-label or
620 # U-label of an internationalized domain name. 620 # U-label of an internationalized domain name.
621 pats.append(re.escape(leftmost)) 621 pats.append(re.escape(leftmost))
622 else: 622 else:
623 # Otherwise, '*' matches any dotless string, e.g. www* 623 # Otherwise, '*' matches any dotless string, e.g. www*
624 pats.append(re.escape(leftmost).replace(r'\*', '[^.]*')) 624 pats.append(re.escape(leftmost).replace(br'\*', '[^.]*'))
625 625
626 # add the remaining fragments, ignore any wildcards 626 # add the remaining fragments, ignore any wildcards
627 for frag in remainder: 627 for frag in remainder:
628 pats.append(re.escape(frag)) 628 pats.append(re.escape(frag))
629 629
630 pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE) 630 pat = re.compile(br'\A' + br'\.'.join(pats) + br'\Z', re.IGNORECASE)
631 return pat.match(hostname) is not None 631 return pat.match(hostname) is not None
632 632
633 def _verifycert(cert, hostname): 633 def _verifycert(cert, hostname):
634 '''Verify that cert (in socket.getpeercert() format) matches hostname. 634 '''Verify that cert (in socket.getpeercert() format) matches hostname.
635 CRLs is not handled. 635 CRLs is not handled.