Skip to content

Fix: Refactor SSL socket wrapping in ValidatedHTTPSConnection#70

Open
ethanke wants to merge 1 commit intoaszlig:masterfrom
ethanke:master
Open

Fix: Refactor SSL socket wrapping in ValidatedHTTPSConnection#70
ethanke wants to merge 1 commit intoaszlig:masterfrom
ethanke:master

Conversation

@ethanke
Copy link

@ethanke ethanke commented Sep 14, 2025

File c:\Users\Ethan\Hobby\Rustle.venv\Lib\site-packages\hetzner\robot.py:391, in ServerManager.iter(self)
390 def iter(self):
--> 391 return iter([Server(self.conn, s) for s in self.conn.get('/server')])

File c:\Users\Ethan\Hobby\Rustle.venv\Lib\site-packages\hetzner\robot.py:368, in RobotConnection.get(self, path)
367 def get(self, path):
--> 368 return self.request('GET', path)

File c:\Users\Ethan\Hobby\Rustle.venv\Lib\site-packages\hetzner\robot.py:329, in RobotConnection.request(self, method, path, data, allow_empty)
325 headers['Content-Type'] = 'application/x-www-form-urlencoded'
327 self.logger.debug("Sending %s request to Robot at %s with data %r.",
328 method, path, data)
--> 329 response = self._request(method, path, data, headers)
330 raw_data = response.read().decode('utf-8')
331 if len(raw_data) == 0 and not allow_empty:

File c:\Users\Ethan\Hobby\Rustle.venv\Lib\site-packages\hetzner\robot.py:301, in RobotConnection._request(self, method, path, data, headers, retry)
300 def _request(self, method, path, data, headers, retry=1):
...
68 ca_certs=cafile)
69 if bundle is None:
70 ca_certs.close()

AttributeError: module 'ssl' has no attribute 'wrap_socket'

Updated the SSL socket wrapping mechanism to use ssl.create_default_context() for improved security and maintainability. The previous method of wrapping the socket has been replaced with a context that loads verification locations if a CA file is provided.

Updated the SSL socket wrapping mechanism to use ssl.create_default_context() for improved security and maintainability. The previous method of wrapping the socket has been replaced with a context that loads verification locations if a CA file is provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant