diff --git a/S3/ConnMan.py b/S3/ConnMan.py index e5067c182..079cd3100 100644 --- a/S3/ConnMan.py +++ b/S3/ConnMan.py @@ -121,9 +121,14 @@ def _https_connection(hostname, port=None): # back. We then run the same check, relaxed for S3's # wildcard certificates. context.check_hostname = False - conn = httplib.HTTPSConnection(hostname, port, context=context) + conn = httplib.HTTPSConnection(hostname, port, context=context, check_hostname=False) except TypeError: - conn = httplib.HTTPSConnection(hostname, port) + try: + # in case check_hostname parameter is not present try again + conn = httplib.HTTPSConnection(hostname, port, context=context) + except TypeError: + # in case even context parameter is not present try one last time + conn = httplib.HTTPSConnection(hostname, port) return conn def __init__(self, id, hostname, ssl, cfg):