A feature-rich command-line audio/video downloader
[utils] Drop an compatibility wrapper for Python < 2.6
Yen Chi Hsuanb407d8533d39
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.pyindex 6c84bfe0ff..d79410e58a 100644--- a/youtube_dl/utils.py+++ b/youtube_dl/utils.py@@ -932,14 +932,6 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):except zlib.error:return zlib.decompress(data)- @staticmethod- def addinfourl_wrapper(stream, headers, url, code):- if hasattr(compat_urllib_request.addinfourl, 'getcode'):- return compat_urllib_request.addinfourl(stream, headers, url, code)- ret = compat_urllib_request.addinfourl(stream, headers, url)- ret.code = code- return ret-def http_request(self, req):# According to RFC 3986, URLs can not contain non-ASCII characters, however this is not# always respected by websites, some tend to give out URLs with non percent-encoded@@ -991,13 +983,13 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):breakelse:raise original_ioerror- resp = self.addinfourl_wrapper(uncompressed, old_resp.headers, old_resp.url, old_resp.code)+ resp = compat_urllib_request.addinfourl(uncompressed, old_resp.headers, old_resp.url, old_resp.code)resp.msg = old_resp.msgdel resp.headers['Content-encoding']# deflateif resp.headers.get('Content-encoding', '') == 'deflate':gz = io.BytesIO(self.deflate(resp.read()))- resp = self.addinfourl_wrapper(gz, old_resp.headers, old_resp.url, old_resp.code)+ resp = compat_urllib_request.addinfourl(gz, old_resp.headers, old_resp.url, old_resp.code)resp.msg = old_resp.msgdel resp.headers['Content-encoding']# Percent-encode redirect URL of Location HTTP header to satisfy RFC 3986 (see