Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
916 views
in Technique[技术] by (71.8m points)

http - Why does Firebug show a "206 Partial Content" response on a video loading request?

I have a bunch of html5 video elements, with their preload attribute set to "auto". They start loading just fine, but I think there might be a problem with their caching, because each time I reload the page (without clearing the cache), they start all over again.

When I checked the Network panel in firebug, I noticed everything else (images and files) was giving me a "304 not modified" message as espected, while the videos (and audio) files were giving me a "206 partial content" message, in duplicated entries.

The "206 partial content" response also appears in duplicated entries when the page is loaded with the cache cleared, instead of a "200 OK" response, as it would be expected.

Is this a normal behavior for video and audio elements? If not, how could it be corrected?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...