X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Futils.py;h=d0606b4bcd3d4706912f753441608dff721d7699;hb=3047121c639428235191ff5f7afbda7ecda38779;hp=653a49055e9b37217847f49c378967e9274091b1;hpb=87f0e62d94e0486598d123e26db3173e6f1d18e6;p=youtube-dl diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 653a49055..d0606b4bc 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -664,12 +664,13 @@ def _create_http_connection(ydl_handler, http_class, is_https, *args, **kwargs): def handle_youtubedl_headers(headers): - if 'Youtubedl-no-compression' in headers: - filtered_headers = dict((k, v) for k, v in headers.items() if k.lower() != 'accept-encoding') + filtered_headers = headers + + if 'Youtubedl-no-compression' in filtered_headers: + filtered_headers = dict((k, v) for k, v in filtered_headers.items() if k.lower() != 'accept-encoding') del filtered_headers['Youtubedl-no-compression'] - return filtered_headers - return headers + return filtered_headers class YoutubeDLHandler(compat_urllib_request.HTTPHandler): @@ -679,7 +680,7 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler): the standard headers to every HTTP request and handles gzipped and deflated responses from web servers. If compression is to be avoided in a particular request, the original request in the program code only has - to include the HTTP header "Youtubedl-No-Compression", which will be + to include the HTTP header "Youtubedl-no-compression", which will be removed before making the real request. Part of this code was copied from: