I have seen download managers manage to resume HTTP downloads from where they stopped. How are they able to resume downloads? Is it related to the Accept-Range
Header? Or are there other mechanisms that download managers use to identify how much of the file has been downloaded and how much is left to be downloaded?
-
Hi :) welcome to SE.SE :) i think your question is a much better fit for stackoverflow, thoughmarstato– marstato10/29/2021 07:15:09Commented Oct 29, 2021 at 7:15
-
@marstato they'll probably call it too vague on StackOverflow though. Pretty sure they usually want one specific question with one specific answer on there.matkv– matkv10/29/2021 07:23:34Commented Oct 29, 2021 at 7:23
-
I’m voting to close this question because it has nothing to do with software engineering.Philipp– Philipp10/29/2021 08:14:32Commented Oct 29, 2021 at 8:14
-
2@Philipp: arguably, this can be seen as an algorithmic question, and algorithmic questions are definitely on-topic on this site. Of course, most questions of the type "how does XYZ type software work" are too broad for this site. However, I think in this case, it is unlikely there are a lot of different approaches for resuming a download - let me try to reword the question a bit.Doc Brown– Doc Brown10/29/2021 09:24:25Commented Oct 29, 2021 at 9:24
1 Answer 1
For tracking the progress: the response to the first download request will have a Content-Length
header telling the download manager how big the entire file is. That info will be persisted (and obviously shown in the UI).
Finding out How much has been downloaded is a simple matter of asking the OS how big the local file is.
On pause/resume: Yes, this is done with the Range
request header. I don't know how many servers that support the request-header advertise that support with the Accept-Ranges
response-header.
If you resume a download from a server that does not support the Range
header, download managers will typically download the content again, possibly not writing the bytes to disk that they already have (because that avoids unnecessary load on the disk).
Explore related questions
See similar questions with these tags.