Skip to content

Commit e4f6c00

Browse files
authored
Add HTTP OWS handling to single range header parsing
No normative changes. This is a pre-requisite for #1520.
1 parent 67d4cde commit e4f6c00

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

fetch.bs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ fetch("https://victim.example/naïve-endpoint", {
10201020
<dd>
10211021
<ol>
10221022
<li><p>Let <var>rangeValue</var> be the result of <a>parsing a single range header value</a>
1023-
given <var>value</var>.
1023+
given <var>value</var> and false.
10241024

10251025
<li><p>If <var>rangeValue</var> is failure, then return false.
10261026

@@ -1292,28 +1292,45 @@ run these steps:
12921292

12931293
<div algorithm>
12941294
<p>To <dfn id=simple-range-header-value>parse a single range header value</dfn> from a
1295-
<a>byte sequence</a> <var>value</var>, run these steps:
1295+
<a>byte sequence</a> <var>value</var> and a boolean <var>allowWhitespace</var>, run these steps:
12961296

12971297
<ol>
12981298
<li><p>Let <var>data</var> be the <a>isomorphic decoding</a> of <var>value</var>.
12991299

1300-
<li><p>If <var>data</var> does not <a for=string>start with</a> "<code>bytes=</code>", then return
1300+
<li><p>If <var>data</var> does not <a for=string>start with</a> "<code>bytes</code>", then return
13011301
failure.
13021302

13031303
<li><p>Let <var>position</var> be a <a>position variable</a> for <var>data</var>, initially
1304-
pointing at the 6th <a>code point</a> of <var>data</var>.
1304+
pointing at the 5th <a>code point</a> of <var>data</var>.
1305+
1306+
<li><p>If <var>allowWhitespace</var> is true, <a>collect a sequence of code points</a> that are
1307+
<a>HTTP tab or space</a>, from <var>data</var> given <var>position</var>.
1308+
1309+
<li><p>If the <a>code point</a> at <var>position</var> within <var>data</var> is not U+003D (=),
1310+
then return failure.
1311+
1312+
<li><p>Advance <var>position</var> by 1.
1313+
1314+
<li><p>If <var>allowWhitespace</var> is true, <a>collect a sequence of code points</a> that are
1315+
<a>HTTP tab or space</a>, from <var>data</var> given <var>position</var>.
13051316

13061317
<li><p>Let <var>rangeStart</var> be the result of <a>collecting a sequence of code points</a> that
13071318
are <a>ASCII digits</a>, from <var>data</var> given <var>position</var>.
13081319

13091320
<li><p>Let <var>rangeStartValue</var> be <var>rangeStart</var>, interpreted as decimal number, if
13101321
<var>rangeStart</var> is not the empty string; otherwise null.
13111322

1323+
<li><p>If <var>allowWhitespace</var> is true, <a>collect a sequence of code points</a> that are
1324+
<a>HTTP tab or space</a>, from <var>data</var> given <var>position</var>.
1325+
13121326
<li><p>If the <a>code point</a> at <var>position</var> within <var>data</var> is not U+002D (-),
13131327
then return failure.
13141328

13151329
<li><p>Advance <var>position</var> by 1.
13161330

1331+
<li><p>If <var>allowWhitespace</var> is true, <a>collect a sequence of code points</a> that are
1332+
<a>HTTP tab or space</a>, from <var>data</var> given <var>position</var>.
1333+
13171334
<li><p>Let <var>rangeEnd</var> be the result of <a>collecting a sequence of code points</a> that
13181335
are <a>ASCII digits</a>, from <var>data</var> given <var>position</var>.
13191336

0 commit comments

Comments
 (0)