Why does Firebug show a “206 Partial Content” response on a video loading request?

微笑、不失礼 提交于 2019-11-27 13:38:20

This Partial Content code (206) may be sent from the server when the client has asked for a range (e.g. "give me the first 2MB of video data").

It is vital for downloading data in chunks which avoids fetching unused resources. (I seldom watch a full video online.) Look at the outgoing request for a Range header.

See Status Codes (RFC2616 - HTTP/1.1) (note that any 2xx code means "Success"):

10.2.7 206 Partial Content:

The server has fulfilled the partial GET request for the resource. The request MUST have included a Range header field (section 14.35) indicating the desired range, and MAY have included an If-Range header field (section 14.27) to make the request conditional.

And from the Range header section:

If the server supports the Range header and the specified range or ranges are appropriate for the entity

  • The presence of a Range header in an unconditional GET modifies what is returned if the GET is otherwise successful. In other words, the response carries a status code of 206 (Partial Content) instead of 200 (OK).

I do not understand the intricicies of caching and/or ETags or what to expect in FireFox, however.

In firefox on my local development machine I couldn't get .webm videos to play unless the server was configured to use them. Firebug would show 206 but nothing would show. This can be as resolved by adding

AddType video/webm .webm

to your .htaccess.

According to https://httpstatuses.com/206

"A server MUST NOT generate a multipart response to a request for a single range, since a client that does not request multiple parts might not support multipart responses. However, a server MAY generate a multipart/byteranges payload with only a single body part if multiple ranges were requested and only one range was found to be satisfiable or only one range remained after coalescing. A client that cannot process a multipart/byteranges response MUST NOT generate a request that asks for multiple ranges.

When a multipart response payload is generated, the server SHOULD send the parts in the same order that the corresponding byte-range-spec appeared in the received Range header field, excluding those ranges that were deemed unsatisfiable or that were coalesced into other ranges. A client that receives a multipart response MUST inspect the Content-Range header field present in each body part in order to determine which range is contained in that body part; a client cannot rely on receiving the same ranges that it requested, nor the same order that it requested."

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!