aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-05-30 22:52:02 +0600
committerSergey M․ <dstftw@gmail.com>2015-05-30 22:52:02 +0600
commit931bc3c3a719fe33101c05b9fdc4e6ad8eb08bdc (patch)
treea38e02ee5387c061e3e763aa51d64e75df6adcfc /youtube_dl/YoutubeDL.py
parentdb1e9ee7716ffb39de6dae7211f58c3faa66cf6b (diff)
[YoutubeDL] Do not loose request method information
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 21d247f23..5fc8754c6 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -49,6 +49,7 @@ from .utils import (
ExtractorError,
format_bytes,
formatSeconds,
+ HEADRequest,
locked_file,
make_HTTPS_handler,
MaxDownloadsReached,
@@ -1720,7 +1721,8 @@ class YoutubeDL(object):
if req_is_string:
req = url_escaped
else:
- req = compat_urllib_request.Request(
+ req_type = HEADRequest if req.get_method() == 'HEAD' else compat_urllib_request.Request
+ req = req_type(
url_escaped, data=req.data, headers=req.headers,
origin_req_host=req.origin_req_host, unverifiable=req.unverifiable)