diff options
author | dirkf <fieldhouse@gmx.net> | 2023-07-28 06:19:15 +0100 |
---|---|---|
committer | dirkf <fieldhouse@gmx.net> | 2023-07-29 14:27:26 +0100 |
commit | abef53466da1f7d2e79f5644718a2cf7524abc49 (patch) | |
tree | c0372d8e3f987a49b793372a8f75c58dd55ca6b4 /youtube_dl/YoutubeDL.py | |
parent | e7926ae9f4e5fa258696551a39295402819280c9 (diff) | |
download | youtube-dl-abef53466da1f7d2e79f5644718a2cf7524abc49.tar.xz |
[utils] Rework URL path munging for ., .. components
* move processing to YoutubeDLHandler
* also process `Location` header for redirect
* use tests from https://github.com/yt-dlp/yt-dlp/pull/7662
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-x | youtube_dl/YoutubeDL.py | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 6a12f91e4..13a41928f 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -71,7 +71,6 @@ from .utils import ( format_bytes, formatSeconds, GeoRestrictedError, - HEADRequest, int_or_none, ISO3166Utils, join_nonempty, @@ -88,7 +87,6 @@ from .utils import ( preferredencoding, prepend_extension, process_communicate_or_kill, - PUTRequest, register_socks_protocols, render_table, replace_extension, @@ -2460,27 +2458,6 @@ class YoutubeDL(object): """ Start an HTTP download """ if isinstance(req, compat_basestring): req = sanitized_Request(req) - # an embedded /../ sequence is not automatically handled by urllib2 - # see https://github.com/yt-dlp/yt-dlp/issues/3355 - url = req.get_full_url() - parts = url.partition('/../') - if parts[1]: - url = compat_urllib_parse.urljoin(parts[0] + parts[1][:1], parts[1][1:] + parts[2]) - if url: - # worse, URL path may have initial /../ against RFCs: work-around - # by stripping such prefixes, like eg Firefox - parts = compat_urllib_parse.urlsplit(url) - path = parts.path - while path.startswith('/../'): - path = path[3:] - url = parts._replace(path=path).geturl() - # get a new Request with the munged URL - if url != req.get_full_url(): - req_type = {'HEAD': HEADRequest, 'PUT': PUTRequest}.get( - req.get_method(), compat_urllib_request.Request) - req = req_type( - url, data=req.data, headers=dict(req.header_items()), - origin_req_host=req.origin_req_host, unverifiable=req.unverifiable) return self._opener.open(req, timeout=self._socket_timeout) def print_debug_header(self): |