- From: Anne van Kesteren <notifications@github.com>
- Date: Tue, 28 Sep 2021 04:39:13 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/pull/1312/review/765314296@github.com>
@annevk commented on this pull request. Thanks, this looks very readable indeed. > @@ -822,13 +825,13 @@ fetch("https://victim.example/naïve-endpoint", { </code></pre> </div> + <dt>`<code>Range</code>` ```suggestion <dt>`<code>range</code>` ``` (it's lowercased above) > @@ -1038,6 +1041,39 @@ run these steps: <li><p>Return <var>values</var>. </ol> +<p>To determine if a <a>byte sequence</a> <var>value</var> is a +<dfn>simple range header value</dfn>, perform the following steps. They return a <a>boolean</a>. + +<ol> + <li><p>Let <var>data</var> be the <a>isomorphic decoding</a> of <var>value</var>. + + <li><p>If <var>data</var> does not <a for=string>start with</a> "<code>bytes </code>", then return false. While I agree with you on wrapping, until we change it I do think we should maintain consistency. > +<dfn>simple range header value</dfn>, perform the following steps. They return a <a>boolean</a>. + +<ol> + <li><p>Let <var>data</var> be the <a>isomorphic decoding</a> of <var>value</var>. + + <li><p>If <var>data</var> does not <a for=string>start with</a> "<code>bytes </code>", then return false. + + <li><p>Let <var>position</var> be a <a>position variable</a> for <var>data</var>, initially pointing at the 6th <a>code point</a> of <var>data</var>. + + <li><p>Let <var>rangeStart</var> be the result of <a>collecting a sequence of code points</a> that are in the range U+0030 (0) to U+0039 (9), inclusive, from <var>data</var> given <var>position</var>. + + <li><p>If the <a>code point</a> at <var>position</var> within <var>data</var> is not U+002D (-), then return false. + + <li><p>Advance <var>position</var> by 1. + + <li><p>Let <var>rangeEnd</var> be the result of <a>collecting a sequence of code points</a> that are in the range U+0030 (0) to U+0039 (9), inclusive, from <var>data</var> given <var>position</var>. Either you need to collect all code points here or you need to do another check at the end. At the moment `bytes 0-0garbage` is valid I think. > + + <li><p>Let <var>rangeEnd</var> be the result of <a>collecting a sequence of code points</a> that are in the range U+0030 (0) to U+0039 (9), inclusive, from <var>data</var> given <var>position</var>. + + <li> + <p>If <var>rangeEnd</var>'s <a for=string>length</a> is 0, then return true. + + <p class="note">The range end can be omitted, e.g., `<code>bytes 0-</code>` is valid. + + <li><p>If <var>rangeStart</var>, parsed as an integer, is greater than <var>rangeEnd</var>, parsed + as an integer, then return false. + + <li><p>Return true. +</ol> + +<p class="note">A <a>simple range header value</a> is a subset of allowed range header values, but +it's the most common form used by user agents when requesting media or resuming downloads. This it is* > + <li><p>Let <var>position</var> be a <a>position variable</a> for <var>data</var>, initially pointing at the 6th <a>code point</a> of <var>data</var>. + + <li><p>Let <var>rangeStart</var> be the result of <a>collecting a sequence of code points</a> that are in the range U+0030 (0) to U+0039 (9), inclusive, from <var>data</var> given <var>position</var>. + + <li><p>If the <a>code point</a> at <var>position</var> within <var>data</var> is not U+002D (-), then return false. + + <li><p>Advance <var>position</var> by 1. + + <li><p>Let <var>rangeEnd</var> be the result of <a>collecting a sequence of code points</a> that are in the range U+0030 (0) to U+0039 (9), inclusive, from <var>data</var> given <var>position</var>. + + <li> + <p>If <var>rangeEnd</var>'s <a for=string>length</a> is 0, then return true. + + <p class="note">The range end can be omitted, e.g., `<code>bytes 0-</code>` is valid. + + <li><p>If <var>rangeStart</var>, parsed as an integer, is greater than <var>rangeEnd</var>, parsed interpreted as decimal number is what I used in Content-Length. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1312#pullrequestreview-765314296
Received on Tuesday, 28 September 2021 11:39:26 UTC