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

@dlrobertson commented on this pull request.

> I spotted a lot of tiny nits, but I might have missed something bigger therefore. Probably needs another close look once these are addressed. Hope that's understandable.

Definitely. Feedback is greatly appreciated!

> +
+        <p class="note">A range header denotes an inclusive byte range, while the <a>slice blob</a>
+        algorithm input range does not. To use the <a>slice blob</a> algorithm, we must 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>contentRange</var> be `<code>bytes </code>`.

:+1: Added a HTML comment and plan to open a issue when merged. I can open one now if that is the preferred workflow.

> +
+       <li><p>Otherwise, if <var>sliceEndRange</var> is null, append <var>fullLength</var> to
+       <var>contentRange</var>.
+
+       <li><p>Append 0x2F (/) to <var>contentRange</var>.
+
+       <li><p>Append <var>fullLength</var> to <var>contentRange</var>.
+
+       <li><p>Set <var>response</var>'s <a for=response>status message</a> to
+       `<code>Partial Content</code>`.
+
+       <li><p>Set <var>response</var>'s <a for=response>status</a> to `<code>206</code>`.
+
+       <li><p>Set <var>response</var>'s <a for=response>header list</a> to «
+       (`<code>Content-Length</code>`, <var>length</var>), (`<code>Content-Type</code>`,
+       <var>type</var>), (`<code>Content-Range</code>`, <var>contentRange</var>) ».

Yeah, I don't see how `type` could change, so I figured I'd continue to use it.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1520#pullrequestreview-1193489332

You are receiving this because you are subscribed to this thread.

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

Received on Thursday, 24 November 2022 17:49:13 UTC