diff options
author | Sergey M․ <dstftw@gmail.com> | 2020-09-18 03:32:54 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2020-09-18 03:32:54 +0700 |
commit | cdc55e666f3f9c795ed74c478c6a249d992cf93f (patch) | |
tree | 696ddd76d9b3a0b430617a92ea8964d8a61547c3 | |
parent | 86b7c00adca578b36138b165b0add5978972917e (diff) |
[downloader/http] Improve timeout detection when reading block of data (refs #10935)
-rw-r--r-- | youtube_dl/downloader/http.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/youtube_dl/downloader/http.py b/youtube_dl/downloader/http.py index e14ddce58..6ef26548d 100644 --- a/youtube_dl/downloader/http.py +++ b/youtube_dl/downloader/http.py @@ -238,9 +238,11 @@ class HttpFD(FileDownloader): except socket.timeout as e: retry(e) except socket.error as e: - if e.errno not in (errno.ECONNRESET, errno.ETIMEDOUT): - raise - retry(e) + # SSLError on python 2 (inherits socket.error) may have + # no errno set but this error message + if e.errno in (errno.ECONNRESET, errno.ETIMEDOUT) or getattr(e, 'message') == 'The read operation timed out': + retry(e) + raise byte_counter += len(data_block) |