From e5e78797e6e9873b93e550c32f454bbd5444a4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Wed, 2 Sep 2015 02:16:04 +0600 Subject: [PATCH] [utils] Strict HTTP responses (Closes #6727) --- youtube_dl/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index e265c7574..b7a423166 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -587,6 +587,11 @@ def __init__(self, downloaded, expected): def _create_http_connection(ydl_handler, http_class, is_https, *args, **kwargs): + # Working around python 2 bug (see http://bugs.python.org/issue17849) by limiting + # expected HTTP responses to meet HTTP/1.0 or later (see also + # https://github.com/rg3/youtube-dl/issues/6727) + if sys.version_info < (3, 0): + kwargs['strict'] = True hc = http_class(*args, **kwargs) source_address = ydl_handler._params.get('source_address') if source_address is not None: