From 20832d0cdcef0c8198e28a6eb4ea729cc2d688e4 Mon Sep 17 00:00:00 2001 From: Simon Sawicki Date: Tue, 26 Nov 2024 21:43:37 +0100 Subject: [PATCH] Better if placement --- yt_dlp/networking/_requests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yt_dlp/networking/_requests.py b/yt_dlp/networking/_requests.py index 7af7d475d5..6068e18655 100644 --- a/yt_dlp/networking/_requests.py +++ b/yt_dlp/networking/_requests.py @@ -317,6 +317,8 @@ class RequestsRH(RequestHandler, InstanceStoreMixin): headers = self._merge_headers(request.headers) add_accept_encoding_header(headers, SUPPORTED_ENCODINGS) + if request.extensions.get('keep_header_casing'): + headers = headers.sensitive() max_redirects_exceeded = False @@ -325,9 +327,6 @@ class RequestsRH(RequestHandler, InstanceStoreMixin): legacy_ssl_support=request.extensions.get('legacy_ssl'), ) - if request.extensions.get('keep_header_casing'): - headers = headers.sensitive() - try: requests_res = session.request( method=request.method,