浏览代码

Merge remote-tracking branch 'derrotebaron/master'

Philipp Hagemeister 10 年之前
父节点
当前提交
ba655a0e4c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      youtube_dl/utils.py

+ 3 - 1
youtube_dl/utils.py

@@ -612,7 +612,9 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
 
 
     def http_request(self, req):
     def http_request(self, req):
         for h, v in std_headers.items():
         for h, v in std_headers.items():
-            if h not in req.headers:
+            # Capitalize is needed because of Python bug 2275: http://bugs.python.org/issue2275
+            # The dict keys are capitalized because of this bug by urllib
+            if h.capitalize() not in req.headers:
                 req.add_header(h, v)
                 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: