-
Notifications
You must be signed in to change notification settings - Fork 22.7k
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
chore(http): Add Compression Dictionary Transport headers #38948
Conversation
Preview URLs Flaws (4)URL:
URL:
(comment last updated: 2025-04-07 08:41:00) |
@@ -31,7 +31,7 @@ Headers can also be grouped according to how {{Glossary("Proxy_server", "proxies | |||
- End-to-end headers | |||
- : These headers _must_ be transmitted to the final recipient of the message: the server for a request, or the client for a response. Intermediate proxies must retransmit these headers unmodified and caches must store them. | |||
- Hop-by-hop headers | |||
- : These headers are meaningful only for a single transport-level connection, and _must not_ be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the {{httpheader("Connection")}} header. | |||
- : These headers are meaningful only for a single transport-level connection, and _must not_ be retransmitted by proxies or cached. Note that only hop-by-hop headers may be set using the {{HTTPHeader("Connection")}} header. |
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.
Strongly disagree with all these changes to the macro casing. The system doesn't and shouldn't care about case for macros, and neither should we. I wouldn't reject on this, but not a fan.
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 actually prefer all lower case, and plan on injecting it whenever I write a doc.
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.
The system doesn't and shouldn't care about case for macros, and neither should we.
Yeah, I have no strong opinions on what convention we settle for this syntax as long as there's only one way to write it, so "all lower, no spaces" is fine with me. This is what we're currently looking at:
- 1x
{{HttpHeader(…)}}
- 3x
{{ HTTPHeader(…) }}
- 3x
{{ httpheader(…) }}
- 3x
{{HTTPheader(…)}}
- 422x
{{httpheader(…)}}
- 1814x
{{HTTPHeader(…)}}
- : Lets the browser indicate that it already has a dictionary available that the server can use for compression. | ||
- {{HTTPHeader("Dictionary-ID")}} {{experimental_inline}} | ||
- : Used when a browser already has a dictionary available for a resource and the server provided an `id` for the dictionary in the `Use-As-Dictionary` header. | ||
Requests for resources that can use the dictionary have an `Available-Dictionary` header and the server-provided dictionary `id` in the `Dictionary-ID` header. |
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.
FMI what is the point of Available-Dictionary
, and does it always require Dictionary-ID
too?
I ask because you get and return the server id. Why do you need a hash of the dictionary too when you already have an identity for it?
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 can take this one. @pmeenan correct me if I'm wrong.
The point of Available-Dictionary
is for the client to tell the server which Dictionary it has that can be used for compression. It is a crypto-graphic hash to ensure the correct dictionary is actually used.
No it does not require the optional Dictionary-ID
too. This is an optional, extra field that, from my understanding, servers may use if they don't want to store dictionaries by the hash value but by some other identifier. In this case calculating the hash of all available dictionaries to find the match to the Available-Dictionary
would be expensive. And storing a key-value store of these might be large. Once the dictionary is found, the hash must still be calculated and checked against the Available-Dictionary
to ensure a match.
The identifier is provided in the Use-As-Dictionary
header (when the dictionary is originally sent to the client) in the id
field and and must be reflected in the Dictionary-ID
header for any subsequent request wanting to use that dictionary.
See: httpwg/http-extensions#2687 (and the issue it closes).
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.
Correct. The Dictionary-ID
was an added helper to make it easier for origins and CDN's to find/fetch the dictionary using whatever key they want (for example, the URL of the original resource). It saves them from having to hash every response that includes a Use-As-Dictionary
response header just in case it might eventually be used as a dictionary (and to avoid double-storing).
The client doesn't do anything with it except echo whatever value was used back. The hard-verification (and failure in case of a mismatch) is on the dictionary hash.
They still verify the hash against Available-Dictionary before using it but that's when they're already initializing the dictionary itself anyway.
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.
OK updated the main docs in this PR with some information on this: #38974
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.
Thank you both. I will look at that.
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.
@bsmth I've added a suggestion and a question that is mostly FMI https://github.com/mdn/content/pull/38948/files#r2027917100
But this is probably all fine, so approving in case you think these are not useful.
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Description
Adds Compression Dictionary Transport to headers page
Related issues and pull requests
Follow-up from #38722