From 6beb38d9cec25f08eba9de7bcf7cb6937ec47577 Mon Sep 17 00:00:00 2001 From: Yutaka Hirano Date: Sat, 7 Jan 2017 01:28:29 +0900 Subject: [PATCH] Specify "transmit body for a request" Fixes #441. --- fetch.bs | 61 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/fetch.bs b/fetch.bs index 17e833703..36a272150 100644 --- a/fetch.bs +++ b/fetch.bs @@ -213,18 +213,6 @@ of: queue a fetch task on request to process request end-of-body for request. -
- -

To read a request, if request's -body is non-null, whenever -request's body is read from (i.e. -is transmitted or read by script), increase request's -body's -transmitted bytes with the amount of payload body -bytes transmitted and then queue a fetch task on request to -process request body for request. - -

HTTP

@@ -1106,6 +1094,8 @@ or "worker".

See handle fetch for usage of these terms. [[!SW]] +


+

To clone a request request, run these steps: @@ -1121,6 +1111,49 @@ or "worker".

  • Return newRequest. +


    + +

    To transmit body for a +request request, run these steps: + +

      +
    1. Let body be request's body. + +
    2. If body is null, then queue a fetch task on request to + process request end-of-body for request and abort these steps. + +

    3. +

      Let read be the result of reading a + chunk from body's stream. + +

        +
      • +

        When read is fulfilled with an object whose done + property is false and whose value property is a + Uint8Array object, run these substeps: + +

          +
        1. Let bytes be the byte sequence represented by the + Uint8Array object. + +

        2. Transmit bytes. + +

        3. Increase body's transmitted bytes by bytes's + length. + +

        4. Run the above step again. +

        + +
      • When read is fulfilled with an object whose done + property is true, queue a fetch task on request to + process request end-of-body for request. + +

      • When read is fulfilled with a value that matches with neither of the + above patterns, or read is rejected, terminate the + ongoing fetch with reason fatal. +

      +
    +

    Responses

    @@ -2791,7 +2824,7 @@ optional CORS flag and CORS-preflight flag, run these steps:

    If response is not null, then run these substeps:

      -
    1. Read request. +

    2. Transmit body for request.

    3. Set actualResponse to response, if response is not a filtered response, and to response's @@ -3457,7 +3490,7 @@ steps: "deprecated" state value ought to be a temporary and last resort kind of option. -

      Read request. +

      Transmit body for request.

    4. Let strategy be an object. The user agent may choose any object.