Skip to content

Commit

Permalink
[downloader/http] Improve timeout detection when reading block of dat…
Browse files Browse the repository at this point in the history
…a (refs #10935)
  • Loading branch information
dstftw committed Sep 17, 2020
1 parent 86b7c00 commit cdc55e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions youtube_dl/downloader/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ def retry(e):
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)

Expand Down

0 comments on commit cdc55e6

Please sign in to comment.