- if need_HTTPSConnection:
- if not ssl_needs_unverified_context:
- conn = HTTPSConnection(host, None, key_file = self.key_file,
- cert_file = self.cert_file)
- else:
- conn = HTTPSConnection(host, None, key_file = self.key_file,
- cert_file = self.cert_file,
- context = ssl._create_unverified_context())
- else:
- conn = HTTPS(host, None, key_file=self.key_file, cert_file=self.cert_file)
-
- # Some logic to deal with timeouts. It appears that some (or all) versions
- # of python don't set the timeout after the socket is created. We'll do it
- # ourselves by forcing the connection to connect, finding the socket, and
- # calling settimeout() on it. (tested with python 2.6)
- if self.timeout:
- if hasattr(conn, 'set_timeout'):
- conn.set_timeout(self.timeout)
-
- if hasattr(conn, "_conn"):
- # HTTPS is a wrapper around HTTPSConnection
- real_conn = conn._conn
- else:
- real_conn = conn
- conn.connect()
- if hasattr(real_conn, "sock") and hasattr(real_conn.sock, "settimeout"):
- real_conn.sock.settimeout(float(self.timeout))
-
+ conn = http.client.HTTPSConnection(
+ host, port=None,
+ key_file=self.key_file,
+ cert_file=self.cert_file,
+ timeout=self.timeout,
+ context=sfa_client_ssl_context(),
+ check_hostname=False,
+ )
+
+# # Some logic to deal with timeouts. It appears that some (or all) versions
+# # of python don't set the timeout after the socket is created. We'll do it
+# # ourselves by forcing the connection to connect, finding the socket, and
+# # calling settimeout() on it. (tested with python 2.6)
+# if self.timeout:
+# if hasattr(conn, 'set_timeout'):
+# conn.set_timeout(self.timeout)
+#
+# if hasattr(conn, "_conn"):
+# # HTTPS is a wrapper around HTTPSConnection
+# real_conn = conn._conn
+# else:
+# real_conn = conn
+# conn.connect()
+# if hasattr(real_conn, "sock") and hasattr(real_conn.sock, "settimeout"):
+# real_conn.sock.settimeout(float(self.timeout))
+#