Skip to content

Commit 845f8cd

Browse files
committed
Adding ssl_version parameter to Urllib3HttpConnection
Fixes elastic#246
1 parent df6e05b commit 845f8cd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elasticsearch/connection/http_urllib3.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ class Urllib3HttpConnection(Connection):
2020
for instructions how to get default set
2121
:arg client_cert: path to the file containing the private key and the
2222
certificate
23+
:arg ssl_version: version of the SSL protocol to use. Choices are:
24+
SSLv23 (default) SSLv2 SSLv3 TLSv1 (see ``PROTOCOL_*`` constants in the
25+
``ssl`` module for exact options for your environment).
2326
:arg maxsize: the maximum number of connections which will be kept open to
2427
this host.
2528
"""
2629
def __init__(self, host='localhost', port=9200, http_auth=None,
2730
use_ssl=False, verify_certs=False, ca_certs=None, client_cert=None,
28-
maxsize=10, **kwargs):
31+
ssl_version=None, maxsize=10, **kwargs):
2932

3033
super(Urllib3HttpConnection, self).__init__(host=host, port=port, **kwargs)
3134
self.headers = urllib3.make_headers(keep_alive=True)
@@ -38,6 +41,7 @@ def __init__(self, host='localhost', port=9200, http_auth=None,
3841
kw = {}
3942
if use_ssl:
4043
pool_class = urllib3.HTTPSConnectionPool
44+
kw['ssl_version'] = ssl_version
4145

4246
if verify_certs:
4347
kw['cert_reqs'] = 'CERT_REQUIRED'

0 commit comments

Comments
 (0)