Skip to content

Commit

Permalink
Formalize reading bodies
Browse files Browse the repository at this point in the history
This refactoring allows specifications building on top of Fetch to
avoid having to directly integrate with Streams. It makes these
changes:

* body's transmitted bytes is removed. body's total bytes will likely
  be removed in #604.
* body's done and wait concepts are removed.
* It introduces three primitives to read a body: incrementally read
  (process each chunk), fully read (get all), and
  fully reading body as promise (get all as promise).
* Removed transmit request body in favor of HTTP-network fetch using
  incrementally read directly to transmit the request body.
* Fetch's processRequestBody and processRequestEndOfBody are no longer
  passed a request. The former is passed the chunk length for progress
  reporting. (Needed by XMLHttpRequest.)
* Fetch's processResponseEndOfBody when passed will now cause the body
  to be fully read and will pass the result in the second argument.
  (This means that callers can no longer read the body themselves.)
* Subresource Integrity changed slightly with Fetch handing it the
  bytes and integrity metadata, and no longer a response. Essentially
  fetch fully reads the body, does the check, and then creates a new
  body from the same bytes to hand to the caller.

Subresoruce Integrity PR: w3c/webappsec-subresource-integrity#97.

XMLHttpRequest PR: whatwg/xhr#313.

Closes #661.
  • Loading branch information
annevk authored Feb 24, 2021
1 parent 0f29092 commit 6ad9998
Showing 1 changed file with 244 additions and 193 deletions.
Loading

0 comments on commit 6ad9998

Please sign in to comment.