diff --git a/fetch.bs b/fetch.bs index a260d34c7..2524f80d4 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3635,24 +3635,48 @@ steps:

This standardizes the error handling for servers that violate HTTP.

  • -

    If response is not a network error and request's - integrity metadata is not the empty string, then: +

    If request's integrity metadata is not the empty string, then:

      -
    1. Wait for response's - body. - -

    2. If response's body's stream has not - errored, and response does not - match - request's integrity metadata, set response and - internalResponse to a network error. - [[!SRI]] +

    3. Let processError be this step: run fetch finale given + fetchParams and a network error. + + +

    4. If request's response tainting is "opaque" or + response is a network error, then run processError and abort these + steps. + +

    5. +

      Let processBody given bytes be these steps: + +

        +
      1. If bytes do not + match + request's integrity metadata, then run processError + and abort these steps. [[!SRI]] + +

      2. Let body and ignoreType be the result of + safely extracting bytes. + +

      3. Set response's body to body. + +

      4. Run fetch finale given fetchParams and response. +

      + +
    6. Fully read response's body given + processBody and with processError set to + processError.

    -

    This operates on response as this algorithm is not supposed to observe - internalResponse. That would allow an attacker to use hashes as an oracle. +

  • Otherwise, run fetch finale given fetchParams and response. + + +


    + +

    The fetch finale, given a fetch params fetchParams and a +response response, run these steps: +

    1. If fetchParams's process response is non-null, then: