|
|
49b7d4 |
From 04b6d11d7745b319fad127622f45bfb99759a8d7 Mon Sep 17 00:00:00 2001
|
|
|
49b7d4 |
From: Rob Crittenden <rcritten@redhat.com>
|
|
|
49b7d4 |
Date: Tue, 17 May 2016 14:02:24 -0400
|
|
|
49b7d4 |
Subject: [PATCH] Work around missing ndg-httpsclient breaking import of
|
|
|
49b7d4 |
pyopenssl
|
|
|
49b7d4 |
|
|
|
49b7d4 |
---
|
|
|
49b7d4 |
test/test_request.py | 13 +++++++++----
|
|
|
49b7d4 |
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
|
49b7d4 |
|
|
|
49b7d4 |
diff --git a/test/test_request.py b/test/test_request.py
|
|
|
49b7d4 |
index 5d2a525..254b31c 100644
|
|
|
49b7d4 |
--- a/test/test_request.py
|
|
|
49b7d4 |
+++ b/test/test_request.py
|
|
|
49b7d4 |
@@ -8,8 +8,13 @@ import logging
|
|
|
49b7d4 |
import socket
|
|
|
49b7d4 |
from requests.packages.urllib3.util import get_host
|
|
|
49b7d4 |
from requests.packages.urllib3.util.timeout import Timeout
|
|
|
49b7d4 |
-from requests.packages.urllib3.contrib import pyopenssl
|
|
|
49b7d4 |
from requests.packages.urllib3.connectionpool import HTTPConnectionPool, HTTPSConnectionPool, VerifiedHTTPSConnection
|
|
|
49b7d4 |
+try:
|
|
|
49b7d4 |
+ from requests.packages.urllib3.contrib.pyopenssl import DEFAULT_SSL_CIPHER_LIST
|
|
|
49b7d4 |
+except ImportError:
|
|
|
49b7d4 |
+ DEFAULT_SSL_CIPHER_LIST = "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:" + \
|
|
|
49b7d4 |
+ "ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:" + \
|
|
|
49b7d4 |
+ "!aNULL:!MD5:!DSS"
|
|
|
49b7d4 |
|
|
|
49b7d4 |
# Don't bend over backwards for ssl support, assume it is there.
|
|
|
49b7d4 |
import ssl
|
|
|
49b7d4 |
@@ -33,7 +38,7 @@ except ImportError:
|
|
|
49b7d4 |
# Other older python we use the urllib3 bundled copy
|
|
|
49b7d4 |
from urllib3.packages.ssl_match_hostname import match_hostname, CertificateError
|
|
|
49b7d4 |
|
|
|
49b7d4 |
-SAVE_DEFAULT_SSL_CIPHER_LIST = pyopenssl.DEFAULT_SSL_CIPHER_LIST
|
|
|
49b7d4 |
+SAVE_DEFAULT_SSL_CIPHER_LIST = DEFAULT_SSL_CIPHER_LIST
|
|
|
49b7d4 |
|
|
|
49b7d4 |
log = logging.getLogger(__name__)
|
|
|
49b7d4 |
|
|
|
49b7d4 |
@@ -141,9 +146,9 @@ class MyVerifiedHTTPSConnection(VerifiedHTTPSConnection):
|
|
|
49b7d4 |
def connect(self):
|
|
|
49b7d4 |
if self.sni:
|
|
|
49b7d4 |
if self.ciphers:
|
|
|
49b7d4 |
- pyopenssl.DEFAULT_SSL_CIPHER_LIST = self.ciphers
|
|
|
49b7d4 |
+ DEFAULT_SSL_CIPHER_LIST = self.ciphers
|
|
|
49b7d4 |
else:
|
|
|
49b7d4 |
- pyopenssl.DEFAULT_SSL_CIPHER_LIST = SAVE_DEFAULT_SSL_CIPHER_LIST
|
|
|
49b7d4 |
+ DEFAULT_SSL_CIPHER_LIST = SAVE_DEFAULT_SSL_CIPHER_LIST
|
|
|
49b7d4 |
return super(MyVerifiedHTTPSConnection, self).connect()
|
|
|
49b7d4 |
|
|
|
49b7d4 |
# Add certificate verification
|
|
|
49b7d4 |
--
|
|
|
49b7d4 |
2.5.5
|
|
|
49b7d4 |
|