aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--youtube_dl/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 16bc7408a..4ebdf6a78 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -766,10 +766,9 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
return ret
def http_request(self, req):
- for h,v in std_headers.items():
- if h in req.headers:
- del req.headers[h]
- req.add_header(h, v)
+ for h, v in std_headers.items():
+ if h not in req.headers:
+ req.add_header(h, v)
if 'Youtubedl-no-compression' in req.headers:
if 'Accept-encoding' in req.headers:
del req.headers['Accept-encoding']