Skip to content

Commit cd5a16d

Browse files
committed
Added processing of the use-as-dictionary response header
1 parent 1d64408 commit cd5a16d

File tree

1 file changed

+54
-6
lines changed

1 file changed

+54
-6
lines changed

fetch.bs

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,6 @@ processing requirements.
17641764
"<code>audio</code>",
17651765
"<code>beacon</code>",
17661766
"<code>body</code>",
1767-
"<code>compression-dictionary</code>",
17681767
"<code>css</code>",
17691768
"<code>early-hints</code>",
17701769
"<code>embed</code>",
@@ -1967,7 +1966,7 @@ not always relevant and might require different behavior.
19671966
<tr>
19681967
<td>"<code>compression-dictionary</code>"
19691968
<td>"<code>compression-dictionary</code>"
1970-
<td><code>default-src</code> (no specific directive)
1969+
<td><code>default-src</code>
19711970
<td>HTML's <code>&lt;link rel=compression-dictionary&gt;</code>
19721971
<tr>
19731972
<td>"<code>download</code>"
@@ -2294,10 +2293,9 @@ bookkeeping details by the <a for=/>fetch</a> algorithm.
22942293

22952294
<p>A <dfn export>subresource request</dfn> is a <a for=/>request</a>
22962295
whose <a for=request>destination</a> is "<code>audio</code>", "<code>audioworklet</code>",
2297-
"<code>compression-dictionary</code>", "<code>font</code>", "<code>image</code>",
2298-
"<code>json</code>", "<code>manifest</code>", "<code>paintworklet</code>", "<code>script</code>",
2299-
"<code>style</code>", "<code>track</code>", "<code>video</code>", "<code>xslt</code>",
2300-
or the empty string.
2296+
"<code>font</code>", "<code>image</code>", "<code>json</code>", "<code>manifest</code>",
2297+
"<code>paintworklet</code>", "<code>script</code>", "<code>style</code>", "<code>track</code>",
2298+
"<code>video</code>", "<code>xslt</code>", or the empty string.
23012299

23022300
<p>A <dfn export>non-subresource request</dfn> is a <a for=/>request</a>
23032301
whose <a for=request>destination</a> is "<code>document</code>", "<code>embed</code>",
@@ -3281,6 +3279,22 @@ or an <a>implementation-defined</a> value.
32813279
</div>
32823280

32833281

3282+
<h3 id=compression-dictionary-cache-partitions>Compression-dictionary cache partitions</h3>
3283+
3284+
<div algorithm>
3285+
<p>To <dfn>determine the compression-dictionary cache partition</dfn>, given a <a for=/>request</a> <var>request</var>:
3286+
3287+
<ol>
3288+
<li><p>Let <var>key</var> be the result of <a for=request>determining the network partition key</a>
3289+
given <var>request</var>.
3290+
3291+
<li><p>If <var>key</var> is null, then return null.
3292+
3293+
<li><p>Return the unique compression-dictionary cache associated with <var>key</var>. [[!HTTP-COMPRESSION-DICTIONARIES]]
3294+
</ol>
3295+
</div>
3296+
3297+
32843298
<h3 id=port-blocking>Port blocking</h3>
32853299

32863300
<p class=note>New protocols can avoid the need for blocking ports by negotiating the protocol
@@ -6399,6 +6413,40 @@ run these steps:
63996413
<li><p>If <var>isAuthenticationFetch</var> is true, then create an <a>authentication entry</a> for
64006414
<var>request</var> and the given realm.
64016415

6416+
<li>
6417+
<p>If <var>response</var>'s <a for=response>header list</a>
6418+
<a for="header list">contains</a> `<code>Use-As-Dictionary</code>`, then:
6419+
<!-- This is defined in [[!HTTP-COMPRESSION-DICTIONARIES]] -->
6420+
6421+
<ol>
6422+
<li><p>Let <var>dictionaryValue</var> be the result of
6423+
<a for="header list">getting a structured field value</a> given `<code>Use-As-Dictionary</code>`,
6424+
"<code>dictionary</code>", and <var>response</var>'s <a for=response>header list</a>.
6425+
6426+
<li><p>If <var>dictionaryValue</var> is null or <var>dictionaryValue</var>["<code>match</code>"]
6427+
does not <a for=map>exist</a>, then return <var>response</var>.
6428+
6429+
<li><p>Let <var>pattern</var> be the result of creating a URL pattern from
6430+
<var>dictionaryValue</var>["<code>match</code>"] and <var>request</var>'s
6431+
<a for=request>current URL</a>.
6432+
6433+
<li><p>If <var>pattern</var> is failure or <var>pattern</var> has regexp groups, then return
6434+
<var>response</var>.
6435+
6436+
<li><p>Let <var>compressionDictionaryCache</var> be the result of
6437+
<a>determining the compression-dictionary cache partition</a> given <var>request</var>.
6438+
6439+
<li><p>If <var>compressionDictionaryCache</var> is null or <var>request</var>'s
6440+
<a for=request>response tainting</a> is "<code>opaque</code>", then return <var>response</var>.
6441+
6442+
<li><p>Let <var>expirationTime</var> be the time at which the <var>response</var> becomes stale.
6443+
6444+
<li><p>If <var>expirationTime</var> is not in the future, then return <var>response</var>.
6445+
6446+
<li><p>Store <var>response</var> in <var>compressionDictionaryCache</var> with its associated
6447+
<var>dictionaryValue</var> and <var>expirationTime</var>.
6448+
</ol>
6449+
64026450
<li><p>Return <var>response</var>. <span class=note>Typically <var>response</var>'s
64036451
<a for=response>body</a>'s <a for=body>stream</a> is still being enqueued to after
64046452
returning.</span>

0 commit comments

Comments
 (0)