]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[utils] Use bytes-like objects as header values on Python 2
authorYen Chi Hsuan <yan12125@gmail.com>
Sun, 29 May 2016 11:25:25 +0000 (19:25 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Thu, 2 Jun 2016 07:00:49 +0000 (15:00 +0800)
youtube_dl/utils.py

index 6ab1747b3cc058f1e3e22a3b5c5b8967488d5090..26f21602c0a1162bdcef711d87c87fd35481fb3d 100644 (file)
@@ -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