Browse Source

[downloader/http] Retry download when urlopen times out (#26603) (refs #10935)

master
Ori Avtalion 4 years ago
committed by GitHub
parent
commit
86b7c00adc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions
  1. 7
      youtube_dl/downloader/http.py

7
youtube_dl/downloader/http.py

@ -106,7 +106,12 @@ class HttpFD(FileDownloader):
set_range(request, range_start, range_end)
# Establish connection
try:
ctx.data = self.ydl.urlopen(request)
try:
ctx.data = self.ydl.urlopen(request)
except (compat_urllib_error.URLError, ) as err:
if isinstance(err.reason, socket.timeout):
raise RetryDownload(err)
raise err
# When trying to resume, Content-Range HTTP header of response has to be checked
# to match the value of requested Range HTTP header. This is due to a webservers
# that don't support resuming and serve a whole file with no Content-Range

Loading…
Cancel
Save