Correct Blip.tv on 2.6, where HTTP headers are case-sensitive (wtf?)

This commit is contained in:
Philipp Hagemeister 2013-01-12 18:38:23 +01:00
parent 3b83bf8f6a
commit 335959e778

View file

@ -516,18 +516,18 @@ def addinfourl_wrapper(stream, headers, url, code):
return ret return ret
def http_request(self, req): def http_request(self, req):
for h in std_headers: for h,v in std_headers.items():
if h in req.headers: if h in req.headers:
del req.headers[h] del req.headers[h]
req.add_header(h, std_headers[h]) req.add_header(h, v)
if 'Youtubedl-no-compression' in req.headers: if 'Youtubedl-no-compression' in req.headers:
if 'Accept-encoding' in req.headers: if 'Accept-encoding' in req.headers:
del req.headers['Accept-encoding'] del req.headers['Accept-encoding']
del req.headers['Youtubedl-no-compression'] del req.headers['Youtubedl-no-compression']
if 'Youtubedl-user-agent' in req.headers: if 'Youtubedl-user-agent' in req.headers:
if 'User-Agent' in req.headers: if 'User-agent' in req.headers:
del req.headers['User-Agent'] del req.headers['User-agent']
req.headers['User-Agent'] = req.headers['Youtubedl-user-agent'] req.headers['User-agent'] = req.headers['Youtubedl-user-agent']
del req.headers['Youtubedl-user-agent'] del req.headers['Youtubedl-user-agent']
return req return req