-
Notifications
You must be signed in to change notification settings - Fork 333
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
Make get, decode, and split handle edge cases correctly #1769
Conversation
Hmm, what about an header with empty value? If they are allowed (which seems the case to me, reading both RFC 9110 and header value definition) I think this algorithm should return a list of a single empty string, not an empty list. What do you think? Maybe something like this? (sorry for the bad formatting)
|
Without reviewing the actual verbiage, I agree with CarloCannas that a terminal comma should result in adding an empty string. Specs allow for: Foo: Bar to be replaced with: Foo: Bar, So the latter should presumably return two values when parsed. |
@CarloCannas yeah, that seems reasonable and it looks like that should be compatible with existing callers. I guess with that in theory we could make the "parent" algorithm return the empty list instead of null when the header is missing, but null is clearer. I'll see about making that change. |
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.
I can't really run this algorithm in my head enough to verify it's correct, but editorially this seems reasonable. Let's count on @CarloCannas for the normative review :).
A reference implementation and tests file with 100% code coverage would be the best solution of course.
@CarloCannas any further thoughts on this? I'll merge this Monday if there's no more feedback. |
Hi Anne, |
See: - whatwg/fetch#1769 - whatwg/fetch@3153e5e (cherry picked from commit 84351dfa51dc8bd0046c3a9ec3e574c58fe9f790)
See: - whatwg/fetch#1769 - whatwg/fetch@3153e5e (cherry picked from commit 84351dfa51dc8bd0046c3a9ec3e574c58fe9f790)
See: - whatwg/fetch#1769 - whatwg/fetch@3153e5e (cherry picked from commit 84351dfa51dc8bd0046c3a9ec3e574c58fe9f790)
Correct how it handles when a header is present but has no value (should be a list solely containing an empty string value) and when there is a trailing comma (should be a list ending with an empty string value).
Fixes #1768.
@domenic @MattMenke2 this was an oversight in #831 it appears. If you'd like to review in addition to @CarloCannas I'd appreciate it. Thanks!
Preview | Diff