diff --git a/fetch.bs b/fetch.bs index 8a18caf10..92c220204 100755 --- a/fetch.bs +++ b/fetch.bs @@ -81,6 +81,9 @@ urlPrefix:https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-layered-cooki "HTTP-CACHING": { "aliasOf": "RFC9111" }, + "HTTP-COMPRESSION-DICTIONARIES": { + "aliasOf": "RFC9842" + }, "HTTP1": { "aliasOf": "RFC9112" }, @@ -1768,6 +1771,7 @@ is "all" or "none". Unless stated otherwise it is "A request has an associated initiator, which is the empty string, +"compression-dictionary", "download", "imageset", "manifest", @@ -1782,6 +1786,7 @@ device to assist defining CSP and Mixed Content. It is not exposed to JavaScript

A destination type is one of: the empty string, "audio", +"compression-dictionary", "audioworklet", "document", "embed", @@ -1926,6 +1931,11 @@ not always relevant and might require different behavior. "video" media-src HTML's <video> element + + "compression-dictionary" + "compression-dictionary" + default-src + HTML's <link rel=compression-dictionary> "download" "" @@ -3237,6 +3247,22 @@ or an implementation-defined value. +

Compression-dictionary cache partitions

+ +
+

To determine the compression-dictionary cache partition, given a request request: + +

    +
  1. Let key be the result of determining the network partition key + given request. + +

  2. If key is null, then return null. + +

  3. Return the unique compression-dictionary cache associated with key. [[!HTTP-COMPRESSION-DICTIONARIES]] +

+
+ +

Port blocking

New protocols can avoid the need for blocking ports by negotiating the protocol @@ -6106,8 +6132,9 @@ run these steps:

  • If httpRequest's cache mode is "only-if-cached", then return a network error. -

  • Let forwardResponse be the result of running HTTP-network fetch given - httpFetchParams, includeCredentials, and isNewConnectionFetch. +

  • Let forwardResponse be the result of running + HTTP-network compression-dictionary fetch given httpFetchParams, + includeCredentials, and isNewConnectionFetch.

  • If httpRequest's method is unsafe and forwardResponse's status is in the range 200 to 399, inclusive, @@ -6256,12 +6283,120 @@ run these steps:

  • If isAuthenticationFetch is true, then create an authentication entry for request and the given realm. +

  • +

    If response's header list + contains `Use-As-Dictionary`, then: + + +

      +
    1. Let dictionaryValue be the result of + getting a structured field value given `Use-As-Dictionary`, + "dictionary", and response's header list. + +

    2. If dictionaryValue is null or dictionaryValue["match"] + does not exist, then return response. + +

    3. Let pattern be the result of creating a URL pattern from + dictionaryValue["match"] and request's + current URL. + +

    4. If pattern is failure or pattern has regexp groups, then return + response. + +

    5. Let compressionDictionaryCache be the result of + determining the compression-dictionary cache partition given request. + +

    6. If compressionDictionaryCache is null or request's + response tainting is "opaque", then return response. + +

    7. Let expirationTime be the time at which the response becomes stale. + +

    8. If expirationTime is not in the future, then return response. + +

    9. Store response in compressionDictionaryCache with its associated + dictionaryValue and expirationTime. +

    +
  • Return response. Typically response's body's stream is still being enqueued to after returning. +

    HTTP-network compression-dictionary fetch

    + +
    +

    To HTTP-network compression-dictionary fetch, +given a fetch params fetchParams, an optional boolean +includeCredentials (default false), and an optional boolean forceNewConnection +(default false), run these steps: + +

      +
    1. Let request be fetchParams's request. + +

    2. If request's mode is "no-cors", then return the + result of running HTTP-network fetch given fetchParams, + includeCredentials, and forceNewConnection. + +

    3. If the user agent is configured to block cookies for request, then return the + result of running HTTP-network fetch given fetchParams, + includeCredentials, and forceNewConnection. + +

    4. Let compressionDictionaryCache be the result of + determining the compression-dictionary cache partition given request. + +

    5. If compressionDictionaryCache is null, then return the result of running + HTTP-network fetch given fetchParams, includeCredentials, and + forceNewConnection. + +

    6. Let bestMatch be the result of finding the best matching dictionary in + compressionDictionaryCache for request as defined in + [[!HTTP-COMPRESSION-DICTIONARIES]]. + +

    7. If bestMatch is null, then return the result of running HTTP-network fetch + given fetchParams, includeCredentials, and forceNewConnection. + +

    8. Add the `Available-Dictionary` and `Dictionary-ID` + (if applicable) headers to request using bestMatch as defined in + [[!HTTP-COMPRESSION-DICTIONARIES]]. + +

    9. Combine (`Accept-Encoding`, `dcb`) + in request's header list. + +

    10. Combine (`Accept-Encoding`, `dcz`) + in request's header list. + +

    11. Let response be the result of running HTTP-network fetch given + fetchParams, includeCredentials, and forceNewConnection. + +

    12. Let codings be the result of extracting header list values given + `Content-Encoding` and response's header list. + +

    13. If codings is null or does not contain `dcb` or `dcz`, + then return response. + +

    14. If response's type is "opaque", then return a + network error. + +

    15. Let availableDictionaryHash be the result of + getting a structured field value given `Available-Dictionary`, + "bytestring", and request's header list. + +

    16. Let newBody be a new body whose stream is the + result of transforming response's body's stream + with an algorithm that verifies that the dictionary hash in the stream matches + availableDictionaryHash and decodes the rest of the stream with the applicable + algorithm as defined in [[!HTTP-COMPRESSION-DICTIONARIES]]. If verification or decoding fails, + the transformed stream must error. + +

    17. Set response's body to newBody. + +

    18. Delete `Content-Encoding` from response's + header list. + +

    19. Return response. +

    +

    HTTP-network fetch

    @@ -6326,6 +6461,7 @@ optional boolean forceNewConnection (default false), run these steps: