I have been trying to stream audio from a particular point by using the Range header values but I always get the song right from the beginning. I am doing this through a program so am not sure whether the problem lies in my code or on the server.
How can I find out whether the server supports the Range header param?
Thanks.
The way the HTTP spec defines it, if the server knows how to support the
Rangeheader, it will. That in turn, requires it to return a 206 Partial Content response code with aContent-Rangeheader, when it returns content to you. Otherwise, it will simply ignore theRangeheader in your request, and return a 200 response code.This might seem silly, but are you sure you’re crafting a valid HTTP request header? All too commonly, I forget to specify HTTP/1.1 in the request, or forget to specify the Range specifier, such as ‘bytes’.
Oh, and if all you want to do is check, then just send a HEAD request instead of a GET request. Same headers, same everything, just ‘HEAD’ instead of ‘GET’. If you receive a
206response, you’ll knowRangeis supported, and otherwise you’ll get a200response.