-
Notifications
You must be signed in to change notification settings - Fork 24
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
Should each CH property be a separate header? #14
Comments
I contemplated the same thing following #8 . On the one hand, the bloat issue will be worse if more hints are added (5 extra bytes per extra hint). |
I like the idea!
|
Splitting multiple variables into separate HTTP headers makes the deployment slightly easier with Vary, but I think it's insufficient, and maybe more of an unnecessary distraction. Let me elaborate: If you assume that every CH-X header is a binary toggle, then Vary is fine: we can At the end of the day, I think this comes down to incentives: adoption of any spec is driven by the size of the problem it addresses. CH+Key will solve a big problem, and I think CH is one good example and incentive for vendors (browsers, proxies, etc) to get it on the agenda... If we have Key, then splitting CH into CH-X's is an unnecessary distraction. Granted, you could adopt both approaches: (a) "splitting helps until we have Key", but (b) we need Key anyway. P.S. As Yoav pointed out, much of this may be premature optimization as well.. I think we should understand which other variables should be transported by CH, as that will have implications for which mechanism works. |
@yoavweiss an opt-in mechanism for the hints you're interested indeed mitigates this issue, but it couples the variance. For instance, if a future client hint may share something like its past TCP CWND size from this location, or its geo location, you would have to "Vary" based on them alongside DPR - and it's unlikely all of those factors matter for a given request. @igrigorik I agree Key would be better, but it'll be years before it's widely supported, so I meant this conversation to focus on what we have until then. In addition, while this may be premature, it's one of those things that will be hard to change later. If we define CH as having one header, it'll remain one header... So I do think it's important to decide on it now, doing our best to predict the future needs. IMO an addition of 5 bytes that the website opted into (as per #8) is minor compared to the greater flexibility when using Vary. |
What I meant was that considering multiple headers as promoting bloat (for the extra 5 bytes per attribute) may be premature optimization, and that an opt-in mechanism can mitigate the above mentioned bloat. Also as @mnot pointed out at #8, savings can be made by truncating the "CH-" part and the hint names, which will render the bloat argument moot. @guypod - I completely agree that opt-in will not resolve the variance issues (even though it may reduce them). |
Following a few more discussions (in person and in related threads -- @mnot's comments were especially compelling: #8 (comment)), took a cut at redefining CH as a set of independent headers:
This is all still experimental but any comments and suggestions are welcome. |
+1 @igrigorik I dig it. After thinking about it for a week, how do you feel? |
New draft is using CH-{name} fields, and Chrome is advertising CH-DPR... closing this bug. P.S. Thanks everyone for great feedback! |
Conceptually, anything we add as a client-hint could have been added to the User-Agent instead. The reasons we don't do so are primarily:
We're (hopefully) addressing (1) through this very definition exercise.
However, by putting all hints into one header, we're setting ourselves up for a repeat of (2). Once we add more client hints, varying on the CH header would not be very useful.
If we get support for Key at some point, this may be a lesser issue, but for now we don't have a clear line of sight to get it.
What if we added a separate header for each client-hint instead, using a standard format? For instance:
This will allow us to use Vary on one or more of these fields for very little overhead, which will get even smaller with HTTP/2.
The text was updated successfully, but these errors were encountered: