Re: [whatwg/fetch] Allow range header to be set by APIs (#560)

annevk commented on this pull request.



> @@ -197,6 +197,11 @@ of:
 <a>queue a fetch task</a> on <var>request</var> to <a>process request end-of-body</a>
 for <var>request</var>.
 
+<p>To <dfn>serialize an integer</dfn>, represent it as a DOMString of the shortest possible decimal

s/DOMString/string/ please. I don't like using IDL types (and there's an issue against IDL about mapping DOMString to JavaScript string once it enters the specification side).

> @@ -197,6 +197,11 @@ of:
 <a>queue a fetch task</a> on <var>request</var> to <a>process request end-of-body</a>
 for <var>request</var>.
 
+<p>To <dfn>serialize an integer</dfn>, represent it as a DOMString of the shortest possible decimal
+number.
+
+<p class=note>This will be replaced by a more descriptive algorithm in the infra spec. See

class=XXX

> @@ -443,6 +448,26 @@ documented in <a href=#cors-protocol-exceptions>CORS protocol exceptions</a>.
 <p>A <dfn export>CORS non-wildcard request-header name</dfn> is a <a>byte-case-insensitive</a> match
 for `<code>Authorization</code>`.
 
+<p>A <dfn export>privileged no-cors request-header name</dfn> is a <a for=/>header</a>
+<a for=header>name</a> that is a <a>byte-case-insensitive</a> match for one of
+
+<ul class=brief>
+ <li>`<code>Range</code>`

There should be a dot after this. (This is also the case for the Set-Cookie list, which also has an incorrect colon leading it, but you don't have to fix that.)

> @@ -1291,6 +1316,34 @@ or "<code>worker</code>".
   </ol>
 </ol>
 
+<hr>
+
+<p>To <dfn export for=request id=concept-request-add-range-header>add a range header</dfn> to a
+<a for=/>request</a> <var>request</var>, with an integer <var>first</var>, and an optional integer
+<var>last</var>, run these steps:
+
+<ol>
+ <li><p>Let <var>rangeValue</var> be `<code>bytes </code>`.
+
+ <li><p><a lt="serialize an integer">serialize</a> and <a>UTF-8 encode</a> <var>first</var>, and

Serialize* (uppercase)

> @@ -1291,6 +1316,34 @@ or "<code>worker</code>".
   </ol>
 </ol>
 
+<hr>
+
+<p>To <dfn export for=request id=concept-request-add-range-header>add a range header</dfn> to a
+<a for=/>request</a> <var>request</var>, with an integer <var>first</var>, and an optional integer
+<var>last</var>, run these steps:
+
+<ol>
+ <li><p>Let <var>rangeValue</var> be `<code>bytes </code>`.
+
+ <li><p><a lt="serialize an integer">serialize</a> and <a>UTF-8 encode</a> <var>first</var>, and
+ append the result to <var>rangeValue</var>.
+
+ <li><p>Append `<code>-</code>` to <var>rangeValue</var>.
+
+ <li><p>If <var>last</var> is provided, then <a lt="serialize an integer">serialize</a> and

is given*

>  
   <p class=note>`<code>invalid</code>` is used because
   <a method for=Headers><code>delete()</code></a> is not passed a value as argument.
+ </li>

No need for closing `</li>` outside of the HTML Standard.

> @@ -2911,6 +2972,39 @@ with a <i>CORS flag</i> and <i>recursive flag</i>, run these steps:
    <li><a lt="should response to request be blocked due to nosniff">should <var>internalResponse</var> to <var>request</var> be blocked due to nosniff</a>
   </ul>
 
+ <li>
+  <p>If <var>internalResponse</var>'s <a for=response>status</a> is <code>206</code>,
+  <var>response</var>'s <a for=response>type</a> is "<code>opaque</code>",
+  <var>internalResponse</var>'s <a for=response>range-requested flag</a> is set, and
+  <var>request</var>'s <a for=request>header list</a> does not <a for="header list">contain</a>
+  `<code>Range</code>`, then:
+
+  <ol>
+   <li><p>Set <var>internalResponse</var> to a new <a for=/>response</a>.
+
+   <li><p>Set <var>response</var>'s <a>internal response</a> to <var>internalResponse</var>.

Didn't that already happen in the above step? This resets all state though. Does that really work with the various algorithms?

-- 
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/560#pullrequestreview-121434774

Received on Friday, 18 May 2018 14:20:41 UTC