Browse code

Merge branch 'ssl_wildcard_fix' of https://github.com/atodorov/s3cmd into atodorov-ssl_wildcard_fix

Matt Domsch authored on 2015/12/07 12:45:46
Showing 1 changed files
... ...
@@ -121,9 +121,14 @@ class http_connection(object):
121 121
                 # back.  We then run the same check, relaxed for S3's
122 122
                 # wildcard certificates.
123 123
                 context.check_hostname = False
124
-            conn = httplib.HTTPSConnection(hostname, port, context=context)
124
+            conn = httplib.HTTPSConnection(hostname, port, context=context, check_hostname=False)
125 125
         except TypeError:
126
-            conn = httplib.HTTPSConnection(hostname, port)
126
+            try:
127
+                # in case check_hostname parameter is not present try again
128
+                conn = httplib.HTTPSConnection(hostname, port, context=context)
129
+            except TypeError:
130
+                # in case even context parameter is not present try one last time
131
+                conn = httplib.HTTPSConnection(hostname, port)
127 132
         return conn
128 133
 
129 134
     def __init__(self, id, hostname, ssl, cfg):