You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A cache could respond with the same cache entry for all these requests.
If the HTML is reduced to
<imgsrc="wolf.jpg" sizes="100vw">
the same image would be selected or created for requests with client hint headers
DPR: 1, Width: 1920
DPR: 1.5, Width: 1280
DPR: 2, Width: 960
DPR: 3, Width: 640
DPR: 4, Width: 480
The server responds with
Vary: DPR, Width
But although it's the same image, a cache would have to create separate cache entries because the DPR and Width header values differ.
If the client sent a client hint with the needed instrinsic width (e.g. Instrinsic-Width: 1920) (the client has to calculate it in the srcset-w case anyway to compare it to the w descriptors), the server would respond with
Vary: Instrinsic-Width
A cache could respond to all the requests above with the same entry.
Hmm, that's a good suggestion - thanks. It does seem that reporting the intrinsic width would ease the implementation on the server: reduces fragmentation with Vary and does not require any acrobatics for Key. We'd still want to report DPR though.
I agree that in most cases, you'd want your server to respond to DPR+Width, which means redundant variance, and will be hard to cache.
Replacing Width with a Width*DPR value would provide the server side the same information that it can receive today, while reducing the variance of the major use-case.
I don't like Intrinsic-Width as that value's name, since in the browser we're using that to mean Width rather than Width*DPR (The incoming resource's intrinsic width is being corrected as a function of its srcset descriptor or the Content-DPR header).
Maybe Physical-Width? (`Resource-Width' might have been a good fit as well, but our past use of it may cause confusion...)
@yoavweiss as a slightly more radical version: what about changing current definition of Width? Granted, M46 is starting its rollout now, but I don't think it's too late... if we act fast? :)
In terms of history: we specced CSS px values because we were using Width to describe both the resource and viewport width's. However, now that we've split those cases into separate headers, I think we can revisit that.
Activity
waldbaerkoch commentedon Sep 7, 2015
An alternative could be a way to use a
Keyheader (http://mnot.github.io/I-D/http-key/draft-fielding-http-key-03.html) with thepartitionparameter based on the product of two header values, likewhich is not (yet :-) defined.
igrigorik commentedon Sep 14, 2015
Hmm, that's a good suggestion - thanks. It does seem that reporting the intrinsic width would ease the implementation on the server: reduces fragmentation with Vary and does not require any acrobatics for Key. We'd still want to report DPR though.
@yoavweiss any thoughts on this one?
yoavweiss commentedon Sep 15, 2015
I agree that in most cases, you'd want your server to respond to
DPR+Width, which means redundant variance, and will be hard to cache.Replacing
Widthwith aWidth*DPRvalue would provide the server side the same information that it can receive today, while reducing the variance of the major use-case.I don't like
Intrinsic-Widthas that value's name, since in the browser we're using that to meanWidthrather thanWidth*DPR(The incoming resource's intrinsic width is being corrected as a function of itssrcsetdescriptor or theContent-DPRheader).Maybe
Physical-Width? (`Resource-Width' might have been a good fit as well, but our past use of it may cause confusion...)igrigorik commentedon Sep 15, 2015
@yoavweiss as a slightly more radical version: what about changing current definition of
Width? Granted, M46 is starting its rollout now, but I don't think it's too late... if we act fast? :)In terms of history: we specced CSS px values because we were using Width to describe both the resource and viewport width's. However, now that we've split those cases into separate headers, I think we can revisit that.
yoavweiss commentedon Sep 15, 2015
Yeah, we can try to get a semantics change in before M46 hits stable. Usage is still at 0