-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Added support for link rel=compression-dictionary #11620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
RFC is pending publication so this should wait until it has been published (any day now - final edits are complete). |
source
Outdated
| </ol> | ||
|
|
||
| <p>The <span>process a link header</span> steps for this type of linked resource are to do | ||
| nothing.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-checking that this is intended? https://datatracker.ietf.org/doc/draft-ietf-httpbis-compression-dictionary/ seems to imply the Link: header should work, but this mandates that in browsers it do nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Mistake from mirroring the prefetch behavior. Should be fixed now. The flow feels a bit weird since I merged the header and link element processing steps but need to not fire the load/error in the header side of things (made el optional to the processing). Happy for suggestions on ways to make it cleaner.
Presumably we could also treat it more like preconnect and fire-and-forget without load/error events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the intended pattern is supposed to be like what preload does. I believe you could make that work, but I haven't double-checked...
|
The structure here is a bit surprising for me, in that you have HTML just do a fetch, and then do nothing with the response. Instead, you seem to have located the response processing all in whatwg/fetch#1854. I can understand that if the goal is that there are many places that should be able to trigger that processing, e.g., if you want to be able to trigger it from A more normal processing model would be to process the response in HTML, and not modify Fetch much. Was that considered? |
Compression dictionaries are a transport-layer content-encoding and entirely handled within fetch. For the most part they should be completely transparent to HTML. Any HTTP response for any fetch can be stored as a compression dictionary and, usually, none of that will even be visible from HTML. We did need a way to trigger a fetch for triggering the request of a dictionary that would not have otherwise been loaded (which will then be treated like any other response and handled entirely at the HTTP layer). It also allows for adjusting the priorities and timing of the fetch independently from prefetches and preloads. |
Got it. I misunderstood the role of the In that case, I agree with the design split. |
|
The RFC finally published so this should be ready for review now (just rebased it). |
|
|
||
| <p>The <code data-x="rel-compression-dictionary">compression-dictionary</code> keyword may be used | ||
| with <code>link</code> elements. This keyword creates an <span data-x="external resource link">external | ||
| resource link</span>. This keyword is <span>body-ok</span>.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this data-x is required here, if the text content matches it.
| that preemptively <span data-x="concept-fetch">fetching</span> and caching the specified resource | ||
| or same-site document is likely to be beneficial, as it is highly likely that the user will | ||
| be able to this resource as a compression dictionary for future | ||
| <span data-x="concept-fetch">fetches</span>. <ref>RFC9842</ref></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ref required? We're not referencing any definition from that spec, right? (Maybe I don't understand all the ref rules and Anne can correct me).
| <span data-x="attr-crossorigin-anonymous">Anonymous</span>.</p></li> | ||
|
|
||
| <li><p>Set <var>options</var>'s <span data-x="link options destination">destination</span> to | ||
| the empty string.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already the empty string, per https://html.spec.whatwg.org/C#link-options-destination right?
| data-x="create link options from element">create link options</span> from <var>el</var> and | ||
| to <span>load a compression dictionary</span> given the result and <var>el</var>.</p> | ||
|
|
||
| <p>The <span>process a link header</span> step for this type of linked resource given a <span |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding from TPAC is that compression dictionary responses are intended to be processed almost primarily on subresource requests. But this header-processing algorithm does not run in those cases, and in fact we do not have a spec'ed processing model for subresource Link header requests. Is my understanding correct, and do we have tests for this behavior?
We haven't really had a pressing need to spec the Link header processing model on subresource requests, but if that's one of the main and expected ways of engaging with this new feature, and we have tests for it, perhaps it's important enough to invest in.
Add processing steps for handling the "compression-dictionary" link relation type defined in HTTP Compression Dictionary Transport.
It largely mirrors the support for prefetch but also adds a default crossorigin mode of "cors" anonymous (necessary for dictionaries to be usable in a third-party context).
Fix #11619
/index.html ( diff )
/links.html ( diff )
/references.html ( diff )
/semantics.html ( diff )