From 1c3b09e771d4743552dd3cfaa251333fe126b584 Mon Sep 17 00:00:00 2001 From: Chris Moore Date: Thu, 22 Oct 2015 11:36:31 -0400 Subject: [PATCH] Re add support for OpenSSL < 1.0.0 This reverts part of commit 08cedb82a89ea2ec9a1e1f41b2d71a28b35ca45e, which appears to have accidentally removed openssl < 1.0.0 compatibility when removing python3.3 compatibility. See https://github.com/KeepSafe/aiohttp/issues/583 --- aiohttp/connector.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 1cb3e1fca43..f69767d8fa3 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -369,6 +369,8 @@ def _create_connection(self, req): raise NotImplementedError() +_SSL_OP_NO_COMPRESSION = getattr(ssl, "OP_NO_COMPRESSION", 0) + _marker = object() @@ -449,7 +451,7 @@ def ssl_context(self): sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23) sslcontext.options |= ssl.OP_NO_SSLv2 sslcontext.options |= ssl.OP_NO_SSLv3 - sslcontext.options |= ssl.OP_NO_COMPRESSION + sslcontext.options |= _SSL_OP_NO_COMPRESSION sslcontext.set_default_verify_paths() else: sslcontext = ssl.create_default_context()