Skip to content

Conversation

@pmeenan
Copy link
Contributor

@pmeenan pmeenan commented Aug 25, 2025

Add processing steps for handling HTTP Compression Dictionary Transport content encoding and dictionary negotiation (RFC pending publication).

This adds a processing layer between the HTTP cache and network fetch that handles most of the dictionary-based content encoding (including matching dictionaries to outgoing requests).

Additionally, it adds processing above the HTTP cache for storing the dictionaries for future use and defines the "compression-dictionary" initiator and destination (the matching HTML spec update is in-process).

Fix #1739, #1839


Preview | Diff

@pmeenan
Copy link
Contributor Author

pmeenan commented Sep 3, 2025

The RFC is pending publication so this will have to wait until that happens (should be any day now). RFC number has been assigned and final edits are complete: https://www.rfc-editor.org/auth48/rfc9842

@pmeenan
Copy link
Contributor Author

pmeenan commented Nov 11, 2025

RFC has published now so this should be ready to go (just rebased it).

@pmeenan pmeenan requested a review from annevk November 11, 2025 16:47
@pmeenan
Copy link
Contributor Author

pmeenan commented Nov 13, 2025

From the TPAC 2025 discussions, I added support for opaque responses to use compression dictionary when the Cross-Origin-Resource-Policy response header is set to cross-origin.

Comment on lines +84 to +86
"HTTP-COMPRESSION-DICTIONARIES": {
"aliasOf": "RFC9842"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just reference the RFC number directly. No need for an alias.

<p>A <a for=/>request</a> has an associated
<dfn export for=request id=concept-request-initiator>initiator</dfn>, which is
the empty string,
"<code>compression-dictionary</code>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a distinct initiator if we also have a distinct destination?


<li><p>If <var>key</var> is null, then return null.

<li><p>Return the unique compression-dictionary cache associated with <var>key</var>. [[!HTTP-COMPRESSION-DICTIONARIES]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there PRs against Storage and Clear-Site-Data about clearing this cache? It would be good if those were linked from the commit message.


<li>
<p>If <var>response</var>'s <a for=response>header list</a>
<a for="header list">contains</a> `<code>Use-As-Dictionary</code>`, then:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<a for="header list">contains</a> `<code>Use-As-Dictionary</code>`, then:
<a for="header list">contains</a> `<code>Use-As-Dictionary</code>`:

<li><p>If <var>dictionaryValue</var> is null or <var>dictionaryValue</var>["<code>match</code>"]
does not <a for=map>exist</a>, then return <var>response</var>.

<li><p>Let <var>pattern</var> be the result of creating a URL pattern from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"creating a URL pattern" needs some kind of link to a definition.

Comment on lines +6440 to +6445
<li><p>Let <var>corpPolicy</var> be the result of <a for="header list">getting</a>
`<a http-header><code>Cross-Origin-Resource-Policy</code></a>` from <var>response</var>'s
<a for=response>header list</a>.

<li><p>If <var>request</var>'s <a for=request>response tainting</a> is "<code>opaque</code>" and
<var>corpPolicy</var> is not `<code>cross-origin</code>`, then return <var>response</var>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't good enough. We want corpPolicy to be a good value across redirects. We should have tests for that as well.

<li><p>If <var>request</var>'s <a for=request>response tainting</a> is "<code>opaque</code>" and
<var>corpPolicy</var> is not `<code>cross-origin</code>`, then return <var>response</var>.

<li><p>Let <var>expirationTime</var> be the time at which the <var>response</var> becomes stale.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs more links to definitions.

<li><p>If <var>expirationTime</var> is not in the future, then return <var>response</var>.

<li><p>Store <var>response</var> in <var>compressionDictionaryCache</var> with its associated
<var>dictionaryValue</var> and <var>expirationTime</var>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also store pattern somewhere?

Comment on lines +6476 to +6478
<li><p>If the user agent is configured to block cookies for <var>request</var>, then return the
result of running <a>HTTP-network fetch</a> given <var>fetchParams</var>,
<var>includeCredentials</var>, and <var>forceNewConnection</var>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this. The dictionary is partitioned so how is it different from the HTTP cache?

Comment on lines +6498 to +6502
<li><p><a for="header list">Combine</a> (`<code>Accept-Encoding</code>`, `<code>dcb</code>`)
in <var>request</var>'s <a for=request>header list</a>.

<li><p><a for="header list">Combine</a> (`<code>Accept-Encoding</code>`, `<code>dcz</code>`)
in <var>request</var>'s <a for=request>header list</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we doing this even if web developers set these headers? That seems rather sketchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add compression dictionary negotiation and decoding to the fetch processing model

2 participants