about summary refs log tree commit diff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-07-20 05:29:59 +0100
committerdirkf <fieldhouse@gmx.net>2023-07-20 05:29:59 +0100
commit1fa8b86f0b95f2e1488042ceeda8f356ea2a5448 (patch)
treed6d83837d263884e6db21bf78d0a7a92b7032493
parentb2ba24bb026904f3503db71f65d2b1627f08edf1 (diff)
downloadyoutube-dl-1fa8b86f0b95f2e1488042ceeda8f356ea2a5448.tar.gz
youtube-dl-1fa8b86f0b95f2e1488042ceeda8f356ea2a5448.tar.xz
youtube-dl-1fa8b86f0b95f2e1488042ceeda8f356ea2a5448.zip
[utils] Remove stray undocumented Host header in redirect (fix 46fde7c)
-rw-r--r--youtube_dl/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index d52fa7a28..6d798f13a 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -2996,7 +2996,8 @@ class YoutubeDLRedirectHandler(compat_urllib_request.HTTPRedirectHandler):
         # Technically the Cookie header should be in unredirected_hdrs;
         # however in practice some may set it in normal headers anyway.
         # We will remove it here to prevent any leaks.
-        remove_headers = ['Cookie']
+        # Also remove unwanted and undocumented Host header for old URL
+        remove_headers = ['Cookie', 'Host']
 
         # A 303 must either use GET or HEAD for subsequent request
         # https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.4