Technically, what is the difference between the way of hosting (on the server) of
- a file that can be paused while downloading and resumed again, and
- a file that needs to be downloaded in one go?
Technically, what is the difference between the way of hosting (on the server) of
The server would need to support the ability to serve partial content and handle partial requests. Most modern web servers are able to handle it unless you are using something that you built in-house.
You can get more information by reading this Apache document and the relevant RFCs. From the document linked - an example of a response.
HTTP/1.1 206 Partial Content
Date: Wed, 15 Nov 1995 06:25:24 GMT
Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
--THIS_STRING_SEPARATES
Content-type: application/pdf
Content-range: bytes 500-999/8000
...the first range...
--THIS_STRING_SEPARATES
Content-type: application/pdf
Content-range: bytes 7000-7999/8000
...the second range
--THIS_STRING_SEPARATES--
A common one is a lack of a content-size
or content-range
header. Perhaps the author forgot to set one in their download script?
A download can be resumed if the HTTP server supports range retrieval requests as defined in Section 14.35 of RFC 2616, which Wikipedia calls "byte serving" for some odd reason.
Accept-Ranges: bytes
in a response to a HEAD
or GET
request to indicate that it supports byte serving.GET
request including Range: bytes=aaa-bbb
, where the starting offset is aaa
bytes after the start of the file, and the length of the range is bbb - aaa + 1
bytes.Content-range: bytes aaa-bbb/cccc
, where aaa-bbb
are as before and cccc
is either the length of the file in bytes or *
if the server cannot determine it, followed by a response body containing the requested range of bytes. If the range is out of bounds, the server instead sends a status 416 (requested range not satisfiable) response.Some video players use range requests to support seeking through a video. The Ogg media container uses interpolated bisection search to support this use case.
Popular web server software can be configured to serve ranges from static files, but a server-side script that authenticates the download may or may not need to handle ranges itself. (Check your scripting language's manual.) Some operators of download servers open to the public deliberately block range requests because several download managers have used support for content ranges to make more than one request to a server, hogging resources that could be used to provide downloads to other users.