From 817393235285ac0fd497ee2f14549471929a68df Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:02:01 +0100 Subject: [PATCH] [PR #8920/5cf5db56 backport][3.11] Re-enable keep-alive on proxies (#8939) **This is a backport of PR #8920 as merged into master (5cf5db569c8f32b5ecd6a1586e4b8c349767d941).** Co-authored-by: Sam Bull --- CHANGES/8920.misc.rst | 1 + aiohttp/client_proto.py | 3 --- aiohttp/connector.py | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) create mode 100644 CHANGES/8920.misc.rst diff --git a/CHANGES/8920.misc.rst b/CHANGES/8920.misc.rst new file mode 100644 index 00000000000..2e8640593a4 --- /dev/null +++ b/CHANGES/8920.misc.rst @@ -0,0 +1 @@ +Enabled keep-alive support on proxies (which was originally disabled several years ago) -- by :user:`Dreamsorcerer`. diff --git a/aiohttp/client_proto.py b/aiohttp/client_proto.py index f8c83240209..e612450c746 100644 --- a/aiohttp/client_proto.py +++ b/aiohttp/client_proto.py @@ -62,9 +62,6 @@ def should_close(self) -> bool: or bool(self._tail) ) - def force_close(self) -> None: - self._should_close = True - def close(self) -> None: transport = self.transport if transport is not None: diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 04115c36a24..91174e319ab 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -1376,11 +1376,6 @@ async def _create_proxy_connection( proxy_req, [], timeout, client_error=ClientProxyConnectionError ) - # Many HTTP proxies has buggy keepalive support. Let's not - # reuse connection but close it after processing every - # response. - proto.force_close() - auth = proxy_req.headers.pop(hdrs.AUTHORIZATION, None) if auth is not None: if not req.is_ssl():