字节范围0-表示什么 [英] What byte range 0- means

查看:41
本文介绍了字节范围0-表示什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是范围:字节= 0-"?标头是什么意思?是整个文件吗?我尝试发送回0个字节,但不起作用,当我发送整个文件时,它可以工作,但是在流上下文中多次收到此请求,看起来不正确.

What "Range: bytes=0-" header means ? Is the entire file ? I tried sending back 0 bytes and is not working, when I send the entire file it works, but I receive this request more than once in a streaming context, it doesn't look right.

推荐答案

是整个文件吗?

是的,就是这样.

该规范具有语法:

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

并注意:

如果最后一个字节的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

另外:

客户端可以请求所选表示形式的最后N个字节使用后缀字节范围规范.

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

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

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

So, valid examples from the spec include:

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

我在流媒体环境中多次收到此请求

I receive this request more than once in a streaming context

标头表示此客户端可以理解范围请求,并且可以接受 206部分内容响应,而不是整个文件,以实现高效流式传输(

The header indicates that this client understands range requests, and would accept a 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?).

这篇关于字节范围0-表示什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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