]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Correct Blip.tv on 2.6, where HTTP headers are case-sensitive (wtf?)
authorPhilipp Hagemeister <phihag@phihag.de>
Sat, 12 Jan 2013 17:38:23 +0000 (18:38 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Sat, 12 Jan 2013 17:38:23 +0000 (18:38 +0100)
youtube_dl/utils.py

index 08be9e6373f6d4129327a6125b7d3b8c863273c0..51c5ad9204d319de00cbbd7458d22cbdb1172cc5 100644 (file)
@@ -516,18 +516,18 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
         return ret
 
     def http_request(self, req):
-        for h in std_headers:
+        for h,v in std_headers.items():
             if h in req.headers:
                 del req.headers[h]
-            req.add_header(h, std_headers[h])
+            req.add_header(h, v)
         if 'Youtubedl-no-compression' in req.headers:
             if 'Accept-encoding' in req.headers:
                 del req.headers['Accept-encoding']
             del req.headers['Youtubedl-no-compression']
         if 'Youtubedl-user-agent' in req.headers:
-            if 'User-Agent' in req.headers:
-                del req.headers['User-Agent']
-            req.headers['User-Agent'] = req.headers['Youtubedl-user-agent']
+            if 'User-agent' in req.headers:
+                del req.headers['User-agent']
+            req.headers['User-agent'] = req.headers['Youtubedl-user-agent']
             del req.headers['Youtubedl-user-agent']
         return req