diff --git a/fetch.bs b/fetch.bs
index 7872b8067..76d8d5b2a 100755
--- a/fetch.bs
+++ b/fetch.bs
@@ -16,12 +16,19 @@ Translate IDs: typedefdef-bodyinit bodyinit,dictdef-requestinit requestinit,type
urlPrefix:https://httpwg.org/specs/rfc5861.html#;type:dfn;spec:stale-while-revalidate
url:n-the-stale-while-revalidate-cache-control-extension;text:stale-while-revalidate lifetime
+urlPrefix:https://httpwg.org/specs/rfc9842.html#;type:dfn;spec:rfc9842
+ url:use-as-dictionary;text:Use-As-Dictionary
+ url:available-dictionary;text:Available-Dictionary
+ url:dictionary-id;text:Dictionary-ID
+ url:rfc.section.2.2;text:finding the best matching dictionary
+
urlPrefix:https://httpwg.org/specs/rfc9651.html#;type:dfn;spec:rfc9651
url:rfc.section.2;text:structured field value
url:text-serialize;text:serializing structured fields
url:text-parse;text:parsing structured fields
url:;text:structured header
url:token;text:structured field token
+ url:parse-bare-item;text:bare item
urlPrefix:https://httpwg.org/specs/rfc9110.html#;type:dfn;spec:http
url:method.overview;text:method
@@ -67,6 +74,11 @@ urlPrefix:https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-layered-cooki
url:name-serialize-cookies;text:serialize cookies
url:name-garbage-collect-cookies;text:garbage collect cookies
+urlPrefix:https://urlpattern.spec.whatwg.org/#;type:dfn;spec:urlpattern
+ url:url-pattern-create;text:creating a URL pattern
+ url:url-pattern-has-regexp-groups;text:has regexp groups
+
+
urlPrefix:https://www.rfc-editor.org/rfc/rfc6454;type:dfn;spec:RFC6454
url:section-7.1;text:serialized-origin
@@ -1822,6 +1834,7 @@ device to assist defining CSP and Mixed Content. It is not exposed to JavaScript
the empty string,
"audio",
"audioworklet",
+"compression-dictionary",
"document",
"embed",
"font",
@@ -1878,7 +1891,7 @@ not always relevant and might require different behavior.
report"
video"
media-src
<video> element
+ compression-dictionary"
+ connect-src
+ <link rel=compression-dictionary>
download"
A subresource request is a request
whose destination is "audio", "audioworklet",
-"font", "image", "json", "manifest",
-"paintworklet", "script", "style", "text",
-"track", "video", "xslt", or the empty string.
+"compression-dictionary", "font", "image",
+"json", "manifest", "paintworklet", "script",
+"style", "text", "track", "video",
+"xslt", or the empty string.
A non-subresource request is a request
whose destination is "document", "embed",
@@ -3326,6 +3344,22 @@ or an implementation-defined value.
+
To determine the compression-dictionary cache partition, given a request request: + +
Let key be the result of determining the network partition key + given request. + +
If key is null, then return null. + +
Return the unique compression-dictionary cache associated with key. [[!RFC9842]] +
New protocols can avoid the need for blocking ports by negotiating the protocol @@ -6435,8 +6469,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, @@ -6585,12 +6620,148 @@ run these steps:
If isAuthenticationFetch is true, then create an authentication entry for request and the given realm. +
If request's response tainting is not "opaque"
+ and response's header list contains
+ Use-As-Dictionary:
+
+
+
Let dictionaryValue be the result of
+ getting a structured field value given Use-As-Dictionary,
+ "dictionary", and response's header list.
+
+
If dictionaryValue is null or dictionaryValue["match"]
+ does not exist, then return response.
+
+
If dictionaryValue["type"] exists and its
+ bare item is not an implementation-defined supported dictionary type, then return
+ response.
+
+
If dictionaryValue["id"] exists and its
+ bare item's length is greater than 1024, then remove
+ dictionaryValue["id"].
+
+
If dictionaryValue["match-dest"] exists:
+
+
Let matchDestList be dictionaryValue["match-dest"][0].
+
+
For each dest of matchDestList: if dest's bare item + is not a destination supported by the user agent, then remove dest + from matchDestList. + +
If matchDestList is empty, then return response. +
Let compressionDictionaryCache be the result of + determining the compression-dictionary cache partition given request. + +
If compressionDictionaryCache is null, then return response. + +
Let pattern be the result of
+ creating a URL pattern given the bare item of dictionaryValue["match"],
+ the serialization of request's current URL,
+ and an empty map. If this throws an exception, then return response.
+
+
If pattern is failure or pattern has regexp groups, + then return response. + +
Let expirationTime be the time at which the response becomes + a stale response. + +
If expirationTime is not in the future, then return response. + +
Store response in compressionDictionaryCache with its associated + pattern, dictionaryValue, and expirationTime. +
Return response. Typically response's body's stream is still being enqueued to after returning. +
To HTTP-network compression-dictionary fetch, +given a fetch params fetchParams, an optional boolean +includeCredentials (default false), and an optional boolean forceNewConnection +(default false): + +
Let request be fetchParams's request. + +
Let fallback be the following steps: + +
Return the result of running HTTP-network fetch given fetchParams, + includeCredentials, and forceNewConnection. +
If request's mode is "no-cors", then return the
+ result of running fallback.
+
+
If the user agent is configured to block cookies for request, then return the + result of running fallback. + +
Let compressionDictionaryCache be the result of + determining the compression-dictionary cache partition given request. + +
If compressionDictionaryCache is null, then return the result of running + fallback. + +
Let bestMatch be the result of finding the best matching dictionary in + compressionDictionaryCache for request. + +
If bestMatch is null, then return the result of running fallback. + +
Add the Available-Dictionary and Dictionary-ID
+ (if applicable) headers to request using bestMatch.
+
+
append (`Accept-Encoding`, `dcb`)
+ to request's header list.
+
+
append (`Accept-Encoding`, `dcz`)
+ to request's header list.
+
+
Let response be the result of running fallback. + +
Let codings be the result of extracting header list values given
+ `Content-Encoding` and response's header list.
+
+
If codings is null or does not contain `dcb` or `dcz`,
+ then return response.
+
+
If request's response tainting is "opaque",
+ then return a network error.
+
+
Let availableDictionaryItem be the result of
+ getting a structured field value given Available-Dictionary,
+ "item", and request's header list.
+
+
If availableDictionaryItem is null, then return a network error. + +
Let availableDictionaryHash be the bare item of availableDictionaryItem. + +
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 [[!RFC9842]]. If verification or decoding fails, + error the transformed stream. + +
Set response's body to newBody. + +
delete `Content-Encoding` from response's
+ header list.
+
+
Return response. +
Follow the relevant requirements from HTTP. [[!HTTP]] [[!HTTP-CACHING]] + [[!RFC9842]]
If request's body is non-null, and request's @@ -8527,7 +8699,7 @@ dictionary RequestInit { any window; // can only be set to null }; -enum RequestDestination { "", "audio", "audioworklet", "document", "embed", "font", "frame", "iframe", "image", "json", "manifest", "object", "paintworklet", "report", "script", "sharedworker", "style", "text", "track", "video", "worker", "xslt" }; +enum RequestDestination { "", "audio", "audioworklet", "compression-dictionary", "document", "embed", "font", "frame", "iframe", "image", "json", "manifest", "object", "paintworklet", "report", "script", "sharedworker", "style", "text", "track", "video", "worker", "xslt" }; enum RequestMode { "navigate", "same-origin", "no-cors", "cors" }; enum RequestCredentials { "omit", "same-origin", "include" }; enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };