-
Notifications
You must be signed in to change notification settings - Fork 159
Define more precisely which CH headers are sent by default #156
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
Comments
One plausible plumbing approach, borrowing from referrer policy:
WDYT? I think that would solve both #155 and #156. The one notable change here, compared to what we've already shipped in Chrome is the "on by default" policy for navigation requests for Downlink + Viewport-Width hints. /cc @annevk @yoavweiss |
Yes, that seems like a good approach. And yes, CH needs to define how to parse and set the "client hints policy". Or at least some spec needs to before CH is implementable. |
So, Fetch gets updated every time a new hint is defined? |
Do we have an easy way of identifying them as hints so that it would be unnecessary to do that? |
@mnot @martinthomson do you think that's a no-go? FWIW, I think the number of headers is relatively small and being explicit is OK in this instance.. I can imagine cases where we might want to define a header that's not automatically treated as "simple header". |
I think it's OK if every time we create a new hint, we update Fetch (based on the anticipated number / volume). |
In which case, the remaining question is: @annevk are you comfortable (re, whatwg/fetch#258) with integrating this as part of Fetch? I'm happy to draft the update. Alternatively, I guess I can try and monkey patch it from CH spec, but that's far less appealing.. |
Yeah, I am. It seems @hsivonen still has concerns with this entire feature, but if Mozilla will ship regardless (?) it sounds like that would be a good way to define all the edge cases here. Another way to do this would be to patch the HTML Standard to set these headers as appropriate. Though the HTML Standard, especially the navigate algorithm, still needs some work done so perhaps it's better to use Fetch (at least for now). |
@hsivonen's complaints are pretty well grounded in hard experience with inconsistent implementation of these features and the consequences of that. If it comes back to In this case, I think that the advantage of having this information available at the server before the client has even seen the first byte is a reasonable argument for the headers. |
👍 to suggested Fetch integration |
If anyone wants to follow along: whatwg/fetch#258 -- initial run at integrating CH and Fetch. |
TODO from whatwg/fetch#258 (comment):
|
Does anything else need to change in the client-hints spec for this, or can we close the issue? |
@mnot we're still missing integration with HTML spec - see #155 (comment). I was using this as a tracker for that work, perhaps we should rename this one? |
After discussing it some more.. The remaining integration work (#155 (comment)) is against the HTML spec, so I'll close this and open a tracking issue there. |
The spec currently says that clients should send CH headers "based on their default settings, user configuration and/or preferences". This needs to be more precisely defined in order to not cause interoperability problems between browsers.
I know that there's a tension between not sending too much header data which is commonly not used by servers, thus wasting bandwidth, while also sending enough information that servers can optimize their responses. However leaving the decision out of the spec and up to clients, doesn't make the problem simpler, it just pushes it onto someone else.
What I propose is the following:
For "document" loads, i.e. when browsers make the request during navigation, send the information which is typically needed for websites to determine what markup to serve. So things that let the server choose which version of a responsive-design page to serve first. I'd think this includes things like "viewport-width", "downlink" and "save-data". (We might also want to send other information like, is the device touch-enabled, but that's a separate discussion I think).
For non-"document" loads, serve no CH headers by default and instead let the "document" response opt in to which headers should be served for the non-"document" requests within that document. See also issue #155.
The text was updated successfully, but these errors were encountered: