Hope everything is good.
I have two questions regarding Partial Content requests.
1.When the browser(chrome) makes a partial request with “Range” set to “bytes=0-” I cant imagine that it wants the entire file on the initial request, so what is the purpose of this request(Range: bytes=0-) and how should it be handled?
2.When the browser(chrome) makes a partial request with “Range” set to “bytes=123333-” I get the file content from position “123333” to the end and then return everything with the right headers.
So why does the browser continue to send 2-3 additional request > 123333 until it’s satisfied.
From the specification:
A client can limit the number of bytes requested without knowing the
size of the selected representation. If the last-byte-pos value is
absent, or if the value is greater than or equal to the current
length of the representation data, the byte range is interpreted as
the remainder of the representation (i.e., the server replaces the
value of last-byte-pos with a value that is one less than the current
length of the selected representation).
So basically 1- means from the first position until the end of the file, only Chrome doesn’t know how big the file is so it can’t request a range and leaves it up to the server to figure that out.
I’m not sure this is what’s happening, but it sounds like the Content-Type header contains the full length of the file, instead of the length of the file minus 123333 (bytes already sent earlier). Then Chrome thinks more is still to come (because it received less than the Content-Length header said would be semt) and requests it, but in fact that data doesn’t exist.
Hey man. Thanks for your reply.
I’m not sure this is what’s happening, but it sounds like the Content-Type header contains the full length of the file
I think you mean Content-Range instead of content-type…
E.g. I get a request where following is included:
My response contains:
Content-Range: bytes 3309568-3423275/3423276
Looks right to me.
It looks the same when I try it with apache as well.
Apache receives 3-4 requests for a mp4 file.
In all of those responses back, “content-range” is set to: from the specified range in the request, to the end of the file…
It doesn’t make sense that it continues to make requests from a new “starting point” to the end of the file, when it already received from a specified “starting point” to the end of the file. What is happening?
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.