From: Yen Chi Hsuan Date: Sun, 29 May 2016 11:25:25 +0000 (+0800) Subject: [utils] Use bytes-like objects as header values on Python 2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=9a4aec8b7ea2c0863bc03ba8f3d3e69a61e77c80;p=youtube-dl [utils] Use bytes-like objects as header values on Python 2 --- diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 6ab1747b3..26f21602c 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -866,6 +866,8 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler): location_escaped = escape_url(location) if location != location_escaped: del resp.headers['Location'] + if sys.version_info < (3, 0): + location_escaped = location_escaped.encode('utf-8') resp.headers['Location'] = location_escaped return resp