Skip to content

chore(http): Add Compression Dictionary Transport headers#38948

Merged
bsmth merged 7 commits intomdn:mainfrom
bsmth:shared-dictionary-compression-headers
Apr 7, 2025
Merged

chore(http): Add Compression Dictionary Transport headers#38948
bsmth merged 7 commits intomdn:mainfrom
bsmth:shared-dictionary-compression-headers

Conversation

@bsmth
Copy link
Copy Markdown
Member

@bsmth bsmth commented Apr 3, 2025

Description

Adds Compression Dictionary Transport to headers page

Related issues and pull requests

Follow-up from #38722

@bsmth bsmth requested a review from a team as a code owner April 3, 2025 10:28
@bsmth bsmth requested review from hamishwillee and removed request for a team April 3, 2025 10:28
@github-actions github-actions bot added the Content:HTTP HTTP docs label Apr 3, 2025
@github-actions github-actions bot added the size/s [PR only] 6-50 LoC changed label Apr 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2025

Preview URLs

Flaws (4)

URL: /en-US/docs/Web/HTTP/Reference/Headers
Title: HTTP headers
Flaw count: 3

  • macros:
    • Can't resolve /en-US/docs/Web/HTTP/Reference/Headers/Accept-Signature
    • Can't resolve /en-US/docs/Web/HTTP/Reference/Headers/Signature
    • Can't resolve /en-US/docs/Web/HTTP/Reference/Headers/Signed-Headers

URL: /en-US/docs/Web/HTTP/Reference/Headers/Use-As-Dictionary
Title: Use-As-Dictionary
Flaw count: 1

  • unknown:
    • No generic content config found

(comment last updated: 2025-04-07 08:41:00)

- : 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.
Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee Apr 4, 2025

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.

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Member Author

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.
Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Contributor

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).

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee left a 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.

@bsmth bsmth merged commit dba7747 into mdn:main Apr 7, 2025
8 checks passed
@bsmth bsmth deleted the shared-dictionary-compression-headers branch April 7, 2025 08:47
cssinate pushed a commit to cssinate/content that referenced this pull request Apr 11, 2025
* chore(http): Add Compression Dictionary Transport headers

* Update files/en-us/web/http/reference/headers/index.md

* Update files/en-us/web/http/reference/headers/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* chore(http): Remove CTA for contribution

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTTP HTTP docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants