Mercurial > hg-stable
changeset 32287:e05cfb4a6a8e
sslutil: remove conditional cipher code needed for Python 2.6
We dropped support for Python 2.6. So this code to work around a
missing feature on 2.6 is no longer necessary.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 10 May 2017 23:32:00 -0700 |
parents | 7e79373263ab |
children | b47e6b0ba6ca |
files | mercurial/sslutil.py |
diffstat | 1 files changed, 1 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/sslutil.py Thu May 11 18:38:43 2017 -0700 +++ b/mercurial/sslutil.py Wed May 10 23:32:00 2017 -0700 @@ -13,7 +13,6 @@ import os import re import ssl -import sys from .i18n import _ from . import ( @@ -58,9 +57,6 @@ # We implement SSLContext using the interface from the standard library. class SSLContext(object): - # ssl.wrap_socket gained the "ciphers" named argument in 2.7. - _supportsciphers = sys.version_info >= (2, 7) - def __init__(self, protocol): # From the public interface of SSLContext self.protocol = protocol @@ -92,13 +88,6 @@ self._cacerts = cafile def set_ciphers(self, ciphers): - if not self._supportsciphers: - raise error.Abort(_('setting ciphers in [hostsecurity] is not ' - 'supported by this version of Python'), - hint=_('remove the config option or run ' - 'Mercurial with a modern Python ' - 'version (preferred)')) - self._ciphers = ciphers def wrap_socket(self, socket, server_hostname=None, server_side=False): @@ -113,11 +102,9 @@ 'cert_reqs': self.verify_mode, 'ssl_version': self.protocol, 'ca_certs': self._cacerts, + 'ciphers': self._ciphers, } - if self._supportsciphers: - args['ciphers'] = self._ciphers - return ssl.wrap_socket(socket, **args) def _hostsettings(ui, hostname):