mercurial/sslutil.py
changeset 29389 98e8313dcd9e
parent 29341 0d83ad967bf8
child 29410 222f6834c69a
equal deleted inserted replaced
29388:f694e20193f2 29389:98e8313dcd9e
    74         def load_default_certs(self, purpose=None):
    74         def load_default_certs(self, purpose=None):
    75             pass
    75             pass
    76 
    76 
    77         def load_verify_locations(self, cafile=None, capath=None, cadata=None):
    77         def load_verify_locations(self, cafile=None, capath=None, cadata=None):
    78             if capath:
    78             if capath:
    79                 raise error.Abort('capath not supported')
    79                 raise error.Abort(_('capath not supported'))
    80             if cadata:
    80             if cadata:
    81                 raise error.Abort('cadata not supported')
    81                 raise error.Abort(_('cadata not supported'))
    82 
    82 
    83             self._cacerts = cafile
    83             self._cacerts = cafile
    84 
    84 
    85         def set_ciphers(self, ciphers):
    85         def set_ciphers(self, ciphers):
    86             if not self._supportsciphers:
    86             if not self._supportsciphers:
    87                 raise error.Abort('setting ciphers not supported')
    87                 raise error.Abort(_('setting ciphers not supported'))
    88 
    88 
    89             self._ciphers = ciphers
    89             self._ciphers = ciphers
    90 
    90 
    91         def wrap_socket(self, socket, server_hostname=None, server_side=False):
    91         def wrap_socket(self, socket, server_hostname=None, server_side=False):
    92             # server_hostname is unique to SSLContext.wrap_socket and is used
    92             # server_hostname is unique to SSLContext.wrap_socket and is used
   227     * serverhostname - The expected hostname of the remote server. If the
   227     * serverhostname - The expected hostname of the remote server. If the
   228       server (and client) support SNI, this tells the server which certificate
   228       server (and client) support SNI, this tells the server which certificate
   229       to use.
   229       to use.
   230     """
   230     """
   231     if not serverhostname:
   231     if not serverhostname:
   232         raise error.Abort('serverhostname argument is required')
   232         raise error.Abort(_('serverhostname argument is required'))
   233 
   233 
   234     settings = _hostsettings(ui, serverhostname)
   234     settings = _hostsettings(ui, serverhostname)
   235 
   235 
   236     # Despite its name, PROTOCOL_SSLv23 selects the highest protocol
   236     # Despite its name, PROTOCOL_SSLv23 selects the highest protocol
   237     # that both ends support, including TLS protocols. On legacy stacks,
   237     # that both ends support, including TLS protocols. On legacy stacks,