什么字节范围 0- 表示

What byte range 0- means

“范围:bytes=0-”header 是什么意思?是整个文件吗?我尝试发回 0 个字节但没有成功,当我发送整个文件时它可以正常工作,但我在流式上下文中不止一次收到此请求,它看起来不正确。

Is the entire file ?

是的,正是这样。

规范有 the grammar:

     byte-range-set  = 1#( byte-range-spec / suffix-byte-range-spec )
     byte-range-spec = first-byte-pos "-" [ last-byte-pos ]

还有注释:

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

此外:

A client can request the last N bytes of the selected representation using a suffix-byte-range-spec.

     suffix-byte-range-spec = "-" suffix-length

因此,规范中的有效示例包括:

bytes=-500
bytes=9500-
bytes=0-0,-1

I receive this request more than once in a streaming context

header 表示此客户端理解范围请求,并会接受 206 Partial Content response, rather than the entire file, for efficient streaming (What does the HTTP 206 Partial Content status message mean and how do I fully load resources?)。