|
28 | 28 | from socket import (socket, timeout) |
29 | 29 |
|
30 | 30 | import OpenSSL.SSL |
31 | | -from botocore.vendored.requests.packages.urllib3 import connection \ |
32 | | - as urllib3_connection |
33 | | -from botocore.vendored.requests.packages.urllib3 import util \ |
34 | | - as urllib3_util |
| 31 | + |
35 | 32 | from cryptography import x509 |
36 | 33 | from cryptography.hazmat.backends.openssl import backend as openssl_backend |
37 | 34 | from cryptography.hazmat.backends.openssl.x509 import _Certificate |
38 | 35 |
|
| 36 | +import requests.packages.urllib3.util.ssl_ as ssl_ |
| 37 | +import requests.packages.urllib3.connection as connection_ |
| 38 | + |
39 | 39 | from .compat import PY2 |
40 | 40 | from .errorcode import (ER_SERVER_CERTIFICATE_REVOKED) |
41 | 41 | from .errors import (OperationalError) |
@@ -84,7 +84,7 @@ def inject_into_urllib3(): |
84 | 84 | Monkey-patch urllib3 with PyOpenSSL-backed SSL-support and OCSP. |
85 | 85 | """ |
86 | 86 | log.debug(u'Injecting ssl_wrap_socket_with_ocsp') |
87 | | - urllib3_connection.ssl_wrap_socket = ssl_wrap_socket_with_ocsp |
| 87 | + connection_.ssl_wrap_socket = ssl_wrap_socket_with_ocsp |
88 | 88 |
|
89 | 89 |
|
90 | 90 | def _dnsname_to_stdlib(name): |
@@ -310,7 +310,7 @@ def makefile(self, mode, bufsize=-1): |
310 | 310 |
|
311 | 311 | WrappedSocket.makefile = makefile |
312 | 312 |
|
313 | | -DEFAULT_SSL_CIPHER_LIST = urllib3_util.ssl_.DEFAULT_CIPHERS |
| 313 | +DEFAULT_SSL_CIPHER_LIST = ssl_.DEFAULT_CIPHERS |
314 | 314 | if isinstance(DEFAULT_SSL_CIPHER_LIST, str): |
315 | 315 | DEFAULT_SSL_CIPHER_LIST = DEFAULT_SSL_CIPHER_LIST.encode('utf-8') |
316 | 316 |
|
@@ -368,12 +368,13 @@ def _verify_callback(cnx, x509, err_no, err_depth, return_code): |
368 | 368 |
|
369 | 369 |
|
370 | 370 | def ssl_wrap_socket_with_ocsp( |
371 | | - sock, keyfile=None, certfile=None, cert_reqs=None, |
372 | | - ca_certs=None, server_hostname=None, ssl_version=None): |
373 | | - ret = ssl_wrap_socket( |
374 | | - sock, keyfile=keyfile, certfile=certfile, cert_reqs=cert_reqs, |
375 | | - ca_certs=ca_certs, server_hostname=server_hostname, |
376 | | - ssl_version=ssl_version) |
| 371 | + sock, keyfile=None, certfile=None, ca_certs=None, |
| 372 | + ca_cert_dir=None, server_hostname=None, ssl_context=None): |
| 373 | + |
| 374 | + ret = ssl_.ssl_wrap_socket( |
| 375 | + sock, keyfile=keyfile, certfile=certfile, |
| 376 | + ca_certs=ca_certs, ca_cert_dir=ca_cert_dir, |
| 377 | + server_hostname=server_hostname) |
377 | 378 | global FEATURE_OCSP_MODE |
378 | 379 | global FEATURE_OCSP_RESPONSE_CACHE_FILE_NAME |
379 | 380 |
|
|
0 commit comments