[FIX]: check_hostname requires server_hostname in Magnum client

Resolve issue with Magnum client when using HTTPS endpoints in Python 3.12.
The error occurs due to `check_hostname` requiring `server_hostname` to be set
when `CERT_REQUIRED` is used in `SSLContext.wrap_socket`.

References:
- Python 3.12 SSL documentation: https://docs.python.org/3.12/library/ssl.html#ssl.SSLContext.check_hostname
- Related Magnum client commit from version 4.6.0: 5d8fd38400

Closes-bug: https://bugs.launchpad.net/magnum/+bug/2091103

Change-Id: I0337d55c1b24ffce7c798a81a286989c402efcc1
This commit is contained in:
EsmerlinJM
2024-12-11 11:23:13 -03:00
committed by Esmerlin Joel Mieses
parent f28d71af8e
commit ecdcc0697c

View File

@@ -307,7 +307,7 @@ class VerifiedHTTPSConnection(http_client.HTTPSConnection):
if self.cert_file:
context.load_cert_chain(self.cert_file, self.key_file)
self.sock = context.wrap_socket(sock)
self.sock = context.wrap_socket(sock, server_hostname=self.host)
@staticmethod
def get_system_ca_file():