Skip to content

Commit

Permalink
changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Aug 8, 2024
1 parent a82874e commit a7bac61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
1 change: 1 addition & 0 deletions changelog.d/17536.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace override of deprecated method `HTTPAdapter.get_connection` with `get_connection_with_tls_context`.
20 changes: 1 addition & 19 deletions scripts-dev/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,22 +298,6 @@ def send(

return super().send(request, *args, **kwargs)

# def get_connection(
# self, url: str, proxies: Optional[Dict[str, str]] = None,
# ) -> HTTPConnectionPool:
# # overrides the get_connection() method in the base class
# parsed = urlparse.urlsplit(url)
# (host, port, ssl_server_name) = self._lookup(parsed.netloc)
# print(
# f"Connecting to {host}:{port} with SNI {ssl_server_name}", file=sys.stderr
# )
# return self.poolmanager.connection_from_host(
# host,
# port=port,
# scheme="https",
# pool_kwargs={"server_hostname": ssl_server_name},
# )

def get_connection_with_tls_context(
self,
request: PreparedRequest,
Expand All @@ -322,11 +306,9 @@ def get_connection_with_tls_context(
cert: Optional[Union[Tuple[str, str], str]] = None,
) -> HTTPConnectionPool:
# overrides the get_connection_with_tls_context() method in the base class
# return self.get_connection(request.url, proxies)
# overrides the get_connection() method in the base class
parsed = urlparse.urlsplit(request.url)

# Extract the hostname from the request URL and ensure it's a str.
# Extract the server name from the request URL, and ensure it's a str.
hostname = parsed.netloc
if isinstance(hostname, bytes):
hostname = hostname.decode("utf-8")
Expand Down

0 comments on commit a7bac61

Please sign in to comment.