Browse Source

[downloader/http] Improve timeout detection when reading block of data (refs #10935)

master
Sergey M․ 4 years ago
parent
commit
cdc55e666f
No known key found for this signature in database GPG Key ID: 2C393E0F18A9236D
1 changed files with 5 additions and 3 deletions
  1. 8
      youtube_dl/downloader/http.py

8
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)

Loading…
Cancel
Save