diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-12-05 12:18:56 +0100 |
---|---|---|
committer | Michael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com> | 2019-12-05 11:08:12 -0500 |
commit | e21f5959a5965622fa57755b14e82638a42dde3c (patch) | |
tree | a8cc544818355cc8092dadb70740ff9795e7e4f1 /mesonbuild/wrap/wrap.py | |
parent | 75133d5d12b0236163b394cc117497434482854f (diff) | |
download | meson-e21f5959a5965622fa57755b14e82638a42dde3c.zip meson-e21f5959a5965622fa57755b14e82638a42dde3c.tar.gz meson-e21f5959a5965622fa57755b14e82638a42dde3c.tar.bz2 |
lgtm: Fix insecure SSL/TLS version by removing dead code
Diffstat (limited to 'mesonbuild/wrap/wrap.py')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 8d73d00..2895914 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -34,7 +34,9 @@ if typing.TYPE_CHECKING: import http.client try: - import ssl + # Importing is just done to check if SSL exists, so all warnings + # regarding 'imported but unused' can be safely ignored + import ssl # noqa has_ssl = True API_ROOT = 'https://wrapdb.mesonbuild.com/v1/' except ImportError: @@ -44,14 +46,6 @@ except ImportError: req_timeout = 600.0 ssl_warning_printed = False -def build_ssl_context() -> 'ssl.SSLContext': - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ctx.options |= ssl.OP_NO_SSLv2 - ctx.options |= ssl.OP_NO_SSLv3 - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.load_default_certs() - return ctx - def quiet_git(cmd: typing.List[str], workingdir: str) -> typing.Tuple[bool, str]: try: pc = subprocess.run(['git', '-C', workingdir] + cmd, universal_newlines=True, @@ -66,7 +60,7 @@ def open_wrapdburl(urlstring: str) -> 'http.client.HTTPResponse': global ssl_warning_printed if has_ssl: try: - return urllib.request.urlopen(urlstring, timeout=req_timeout)# , context=build_ssl_context()) + return urllib.request.urlopen(urlstring, timeout=req_timeout) # , context=ssl.create_default_context()) except urllib.error.URLError: if not ssl_warning_printed: print('SSL connection failed. Falling back to unencrypted connections.', file=sys.stderr) |