-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
- Loading branch information
There are no files selected for viewing
3 comments
on commit 1fa8b86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly with excessive purism, I used the Request.header_items()
method, the common documented interface to the header list between Py2/3, when back-porting the yt-dlp redirect code. Apparently that method unexpectedly adds a Host
header derived from the Request
's URL, as if it was designed to gather the headers for transmission: ofc this is bad if the URL is being changed. Actually we do use Request.headers
elsewhere, eg utils.update_Request()
, and it appears to work back to 2.6.9 despite not being mentioned in the Py2 doc: possibly I could/should have used that routine instead of the literal back-port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah Request.header_items()
reads from unredirected_hdrs
. Headers in that should not be added to redirected requests, so I'm not sure if header_items() is appropriate there.
Anyways, was just checking this isn't something we need to port to yt-dlp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat reverted as part of 2b7dd3b.
In what cases does this apply? The
Host
header is not added to the Request unless done manually (which it shouldn't be)https://datatracker.ietf.org/doc/html/rfc9110#section-15.4-6.3.1