background-fetch icon indicating copy to clipboard operation
background-fetch copied to clipboard

Content-Range header parsing

Open annevk opened this issue 4 years ago • 2 comments

I looked at https://wicg.github.io/background-fetch/#extract-content-range-values and one problem I found is that this will lead to different results between

Content-Range: x, y

and

Content-Range: x
Content-Range: y

which is something we should avoid (with the notable exception of Set-Cookie). Please use https://fetch.spec.whatwg.org/#concept-header-list-get to get the value instead.

The implications for this algorithm are that either you need to handle values containing , in a special way or you let them be treated as errors. Not sure what matches implementations better.

The outcome here might also impact https://github.com/annevk/orb/pull/16 as that has rather lax header checking.

(I suspect we might also want to move this into Fetch if this is to be shared between this, media elements, and ORB.)

annevk avatar Jan 22 '21 14:01 annevk

I should just be able to switch to https://fetch.spec.whatwg.org/#concept-header-list-get, and step 3 will still do the right validation.

jakearchibald avatar Jan 22 '21 14:01 jakearchibald

Yeah, though the second example above might pass today (for a correct x) and would no longer after that change. Worth testing as implementations are buggy around stuff like this.

annevk avatar Jan 22 '21 14:01 annevk