mercurial/sslutil.py
changeset 30332 318a24b52eeb
parent 30228 b9f7b0c10027
child 30639 d524c88511a7
equal deleted inserted replaced
30331:b19291e5d506 30332:318a24b52eeb
   636         for sub in cert.get('subject', []):
   636         for sub in cert.get('subject', []):
   637             for key, value in sub:
   637             for key, value in sub:
   638                 # According to RFC 2818 the most specific Common Name must
   638                 # According to RFC 2818 the most specific Common Name must
   639                 # be used.
   639                 # be used.
   640                 if key == 'commonName':
   640                 if key == 'commonName':
   641                     # 'subject' entries are unicide.
   641                     # 'subject' entries are unicode.
   642                     try:
   642                     try:
   643                         value = value.encode('ascii')
   643                         value = value.encode('ascii')
   644                     except UnicodeEncodeError:
   644                     except UnicodeEncodeError:
   645                         return _('IDN in certificate not supported')
   645                         return _('IDN in certificate not supported')
   646 
   646 
   762                   'how to configure Mercurial to avoid this message)\n'))
   762                   'how to configure Mercurial to avoid this message)\n'))
   763 
   763 
   764     return None
   764     return None
   765 
   765 
   766 def validatesocket(sock):
   766 def validatesocket(sock):
   767     """Validate a socket meets security requiremnets.
   767     """Validate a socket meets security requirements.
   768 
   768 
   769     The passed socket must have been created with ``wrapsocket()``.
   769     The passed socket must have been created with ``wrapsocket()``.
   770     """
   770     """
   771     host = sock._hgstate['hostname']
   771     host = sock._hgstate['hostname']
   772     ui = sock._hgstate['ui']
   772     ui = sock._hgstate['ui']