为什么Firebug会显示“206 Partial Content”对视频加载请求的响应? [英] Why does Firebug show a "206 Partial Content" response on a video loading request?

查看:2391
本文介绍了为什么Firebug会显示“206 Partial Content”对视频加载请求的响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆html5视频元素,其preload属性设置为auto。他们开始加载很好,但我认为他们的缓存可能有问题,因为每次我重新加载页面(没有清除缓存),他们都会重新开始。

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.

当我在firebug中检查网络面板时,我发现其他所有内容(图像和文件)都给了我一条304未修改的消息,而视频(和音频)文件却给了我206部分内容 消息,在重复的条目中。

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.

当页面加载清除缓存时,206部分内容响应也出现在重复条目中,而不是200 OK 响应,正如预期的那样。

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?

推荐答案

此部分内容代码(206)可能是当客户端请求范围时从服务器发送(例如给我前2MB的视频数据)。

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.

参见< a href =http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\"rel =noreferrer>状态代码(RFC2616 - HTTP / 1.1)(请注意 any 2xx代码表示成功):

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


10.2.7 206部分内容:

10.2.7 206 Partial Content:

服务器已完成对资源的部分GET请求。 请求必须包含一个Range头字段(第14.35节),表示所需的范围,并且可能包含一个If-Range头字段(第14.27节)来发出请求条件。

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.

来自范围标题部分:


如果服务器支持Range标头指定的范围适用于实体

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


  • 存在无条件GET中的Range标头修改
    如果GET成功则返回什么。在其他
    字样中,响应的状态代码为206(部分
    内容),而不是200(OK)

  • 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).

然而,我不了解缓存和/或ETag的复杂性或FireFox的预期内容。

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

这篇关于为什么Firebug会显示“206 Partial Content”对视频加载请求的响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆