Browse Source

[utils] Use bytes-like objects as header values on Python 2

master
Yen Chi Hsuan 8 years ago
parent
commit
9a4aec8b7e
1 changed files with 2 additions and 0 deletions
  1. 2
      youtube_dl/utils.py

2
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

Loading…
Cancel
Save