Yesterday I asked about serving byte ranges from PHP. Today my question is – how should I set Content-Type and Content-Disposition headers when serving several requested byte ranges? Should I repeat them for every byte range or should I just output them once at the beginning? Or maybe I shouldn’t output them at all because the client should already know what it is asking?
Yesterday I asked about serving byte ranges from PHP. Today my question is –
Share
Generally, the HTTP response headers should be the same (repeated) if you return the entire resource or just a portion of it; except of course for the Content-Range header which will vary.
Remember that HTTP is stateless, so every response should be complete and able to stand on its own. If serving byte ranges, you really should also be using entity tags (ETags); so that there is no chance that a client could request and get two separate byte ranges that really belong to different revisions of the same resource.