How can I find out whether a server supports the Range header?

后端 未结 5 1004
迷失自我
迷失自我 2020-12-01 09:44

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 pro

5条回答
  •  伪装坚强ぢ
    2020-12-01 10:16

    This is for others searching how to do this. You can use curl:

    curl -I http://exampleserver.com/example_video.mp4
    

    In the header you should see

    Accept-Ranges: bytes
    

    You can go further and test retrieving a range

    curl --header "Range: bytes=100-107" -I http://exampleserver.com/example_vide0.mp4
    

    and in the headers you should see

    HTTP/1.1 206 Partial Content
    

    and

    Content-Range: bytes 100-107/10000000
    Content-Length: 8
    

    [instead of 10000000 you'll see the length of the file]

提交回复
热议问题