While writing my HTTP/1.1 server, I get stuck dealing multiple ranges request.
Section 14.35.1 of RFC 2616 refers some examples but doesn't clarify server behaviour. For instance:
GET /some/resource HTTP/1.1
...
Range: bytes=200-400,100-300,500-600
...
Should I return this exact sequence of bytes?
Or should I merge all ranges, sending 100-400,500-600
?
Or sending all in between, 100-600
?
Worst, when checking Content-Range
response header (Section 14.16), only a single range may be returned, so I wonder how would a server response to example in Section 14.35.1 bytes=0-0,-1
!!!
How should my server handle such requests?
I just had a look at how other servers that support the
Range
header field might respond and did a quickcurl
to example.com:Apparently, what your looking for is the
Content-Type: multipart/byteranges; boundary
response header. Googling exactly that turned up a W3C document with appendices to RFC 2616So there you go.
By the way, the server at example.com does not check for overlapping byte ranges and sends you exactly the ranges that you requested...