问题描述
这与:我应该如何在我的 RESTful Web 服务? , 在 Rest 集合中分页和 使用带有字节以外的范围说明符?
实际上我认为这里的 -1 评级 anwser 是正确的 https://stackoverflow.com/a/1434701/1237617
Actually I think the -1 rated anwser here is correct https://stackoverflow.com/a/1434701/1237617
通常 anwsers 说你可以使用自定义单位引用 sec 3.12
Generally anwsers say that you can use custom units citing the sec 3.12
range-unit = bytes-unit | other-range-unit
bytes-unit = "bytes"
other-range-unit = token
但是,当您阅读 HTTP 规范时,请注意生产规则是这样的:
However when you read the HTTP spec please notice the production rules are thus:
Content-Range = "Content-Range" ":" content-range-spec
content-range-spec = byte-content-range-spec
byte-content-range-spec = bytes-unit SP
byte-range-resp-spec "/"
( instance-length | "*" )
标头规范只引用了第 3.12 节中的字节单位,而不是范围单位,所以我认为实际上在这里使用自定义单位是违反规范的.
The header spec only references bytes-unit from sec 3.12, not range-units, so I think that actually it's against the spec to use custom units here.
是我遗漏了什么还是流行的回答有问题?
Am I missing something or is the popular anwser wrong?
由于这可能不清楚,我的问题的要点是:rfc2616 sec14.16 仅引用字节单位.它从未提及范围单位,因此范围单位的产生与内容范围无关,因此只能使用字节单位.
Since this probbably isn't clear, the gist of my question is:rfc2616 sec14.16 only references bytes-unit. It never mentions range-unit, so range-unit production is not relevant for Content-Range, and thus only byte-units can be used.
我认为这最能解决我的担忧,尽管我需要一些时间来理解它(另外我想确保措辞有问题).
I think this adresses my concerns best, although I needed some time to understand it (plus I wanted to make sure, that there is something wrong with the wording).
这反映了一个事实,显然,第一组语法规则是专门为解析而制定的,第二组是为产生 HTTP 请求而制定的
感谢埃尔加顿
推荐答案
正在修订的规范允许自定义范围单位.请参阅 HTTPbis 第 5 部分第 2 部分一>.
The spec, as being revised, allows custom range units. See HTTPbis Part 5, Section 2.
这篇关于Content-Range 标头 - 允许的单位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!