2.1. Byte Ranges
last-byte-pos修正
A client can limit the number of bytes requested without knowing the
size of the selected representation. 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 (i.e., the server replaces the
value of last-byte-pos with a value that is one less than the current
length of the selected representation)
"he server replaces the value of last-byte-pos with a value that is one less than the current length of the selected representation"指的是:
将last-byte-pos修正为current length - 1
suffix-byte-range-spec什么时候是valid的?
UNDEDFINED!
这一节貌似只对“byte-range-spec”是否有效进行了定义
A byte-range-spec is invalid if the last-byte-pos value is present
and less than the first-byte-pos.
satisfiable判定
If a valid byte-range-set includes at least one byte-range-spec with
a first-byte-pos that is less than the current length of the
representation, or at least one suffix-byte-range-spec with a
non-zero suffix-length, then the byte-range-set is satisfiable.
前提:
"byte-range-set"必须是valid的,然后才能进行后面的“satisfiable”判断;
UNDEFINED:没找到在哪里定义"byte-range-set"是否是valid
"at least one":
只要byte-range-set满足其中一个条件,它就是satisfiable。
假设文件大小 1000字节,在请求携带Range:
- Range: bytes=100000-, 0-50 或者
- Range: bytes=100000-, -100000000
上述2种情况的byte-range-set 都是 satisfiable的
payload长度太太太长了的情况
In the byte-range syntax, first-byte-pos, last-byte-pos, and
suffix-length are expressed as decimal number of octets. Since there
is no predefined limit to the length of a payload, recipients MUST
anticipate potentially large decimal numerals and prevent parsing
errors due to integer conversion overflows.
playload太长时,byte-range相关数值装不进Int/Long里。