Re: [whatwg/fetch] Add support for blob range requests (PR #1520)

@annevk commented on this pull request.

Specifications are generally quite happy with multiple return statements, but I'm okay sticking with one here. Couple final nits and this seems good to go.

> +     <li><p>If <var>request</var>'s <a for=response>header list</a> contains `<code>Range</code>`,
+     then set <var>response</var>'s <a for=response>range-requested flag</a>.

I still think we should deduplicate this with the conditional below.

>  
-     <li><p>Let <var>length</var> be <var>body</var>'s <a for=body>length</a>,
+     <li><p>Let <var>fullLength</var> be <var>blobURLEntry</var>'s
+     <a for="blob URL entry">object</a>'s <a for=Blob data-link-type=attribute>size</a>,

We can use `{{Blob/size}}` as we do elsewhere in this document. Same for type.

> +        algorithm input range does not. To use the <a>slice blob</a> algorithm, we have to increment
+        the parsed range header end value.
+
+       <li><p>Let <var>slicedBlob</var> be the result of invoking <a>slice blob</a> given
+       <var>blobURLEntry</var>'s <a for="blob URL entry">object</a>, <var>rangeValue</var>[0],
+       <var>sliceEndRange</var>, and <var>type</var>.
+
+       <li><p>Let <var>slicedBodyWithType</var> be the result of
+       <a for=BodyInit>safely extracting</a> <var>slicedBlob</var>.
+
+       <li><p>Set <var>response</var>'s <a for=response>body</a> to <var>slicedBodyWithType</var>'s
+       <a for="body with type">body</a>.
+
+       <li><p>Let <var>slicedLength</var> be <var>slicedBlob</var>'s
+       <a for=Blob data-link-type=attribute>size</a>, <a lt="serialize an integer">serialized</a>
+       and <a>isomorphic encoded</a>.

Here we could still refer to the length of the body (that's the result of extracting), but I'm on the fence as to whether that's better. In any event we should use `{{Blob/size}}` until we can reference some internal field on `Blob`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1520#pullrequestreview-1200848604
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1520/review/1200848604@github.com>

Received on Thursday, 1 December 2022 12:00:55 UTC