-
Notifications
You must be signed in to change notification settings - Fork 341
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
Add HTTP OWS handling to single range header parsing #1564
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakearchibald @youennf @rayankans does any of you think this boolean is worth having for CORS? I think I'd rather allow whitespace in CORS for the Range
header so we can keep Range
header parsing consistent. In particular this would allow an arbitrary number of 0x09 and 0x20 after bytes=
. I don't see the security benefit.
(We also use this parser for blob:
URL requests and there we already allow whitespace.)
fetch.bs
Outdated
@@ -1243,7 +1243,7 @@ run these steps: | |||
|
|||
<div algorithm> | |||
<p>To <dfn id=simple-range-header-value>parse a single range header value</dfn> from a | |||
<a>byte sequence</a> <var>value</var>, run these steps: | |||
<a>byte sequence</a> <var>value</var> and a boolean <var>allowWhiteSpace</var>, run these steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep this we should name this disallowWhitespace so it can default to false. Although as long as we don't export it we should probably keep it as a required argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this still be the case following the discussion in #1070
I've tested Blink and WebKit and both disallow the whitespace allowed in HTTP-RANGE as tested here. Would it make sense to remove the boolean, but add a note that some implementations don't allow this optional whitespace? |
It seems that as per more recent discussion in #1070 I misunderstood the ABNF and no whitespace is allowed after |
8561a73
to
0768aac
Compare
Updated to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only removes whitespace after =
if I understand it correctly. Whereas #1070 (comment) argues for removing it in 6 places.
1be32b3
to
bab5f9b
Compare
HTTP 2616 allowed whitespace:
Added some extra cases to web-platform-tests/wpt#37569 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that makes sense as we don't support multiple values here. One nit and with that this is good to go.
Add HTTP optional white space handling to the single range header parser.
bab5f9b
to
8a4f3f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks!
Blocked on speced/bikeshed#2476 unfortunately.
No problem! Thanks for the review... Will I need to rebase once the fix for speced/bikeshed#2476 lands? |
No, this is all good. I also looked at #1520 again and apart from invoking this algorithm with true I think that's also good (and I can make that change when merging if it all looks good to you). |
Add HTTP optional white space handling to the single range header parser.
Normative changes happen as part of #1520.
Preview | Diff