From 7017561f51492056bc038bcb662a88c2dcc4c9e1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 11 Oct 2024 08:48:54 -0500 Subject: [PATCH] Small performance improvement to handling redirects Reverse the conditional so the origin is only checked if not is_same_host_https_redirect --- aiohttp/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiohttp/client.py b/aiohttp/client.py index cb89ec839a9..3546b7462c5 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -742,8 +742,8 @@ async def _request( ) from origin_val_err if ( - url.origin() != redirect_origin - and not is_same_host_https_redirect + not is_same_host_https_redirect + and url.origin() != redirect_origin ): auth = None headers.pop(hdrs.AUTHORIZATION, None)