Description: key_file and cert_file must be used using context() api
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: https://bugs.debian.org/1058323
Forwarded: no
Last-Update: 2023-12-15

--- python-magnumclient-4.2.0.orig/magnumclient/common/httpclient.py
+++ python-magnumclient-4.2.0/magnumclient/common/httpclient.py
@@ -270,7 +270,11 @@
 
     def __init__(self, host, port, key_file=None, cert_file=None,
                  ca_file=None, timeout=None, insecure=False):
-        http_client.HTTPSConnection.__init__(self, host, port)
+
+        self.context = ssl.create_default_context()
+        if key_file and cert_file:
+            self.context.load_cert_chain(cert_file, key_file)
+
         self.key_file = key_file
         self.cert_file = cert_file
         if ca_file is not None:
@@ -280,6 +284,10 @@
         self.timeout = timeout
         self.insecure = insecure
 
+        http_client.HTTPSConnection.__init__(self, host, port,
+                                             context=self.context)
+
+
     def connect(self):
         """Connect to a host on a given (SSL) port.
 
