-
Notifications
You must be signed in to change notification settings - Fork 133
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
Sort headers as if ASCII-uppercased #248
Comments
Do we want to do this specifically for |
I have a slight preference for getAllResponseHeaders() only since this is mainly for backward compatibility and we are moving to a world where lowercased headers is the norm. |
AFAICT, the two are implemented separately in Gecko, so doing this only for XHR and not Fetch seems appropriate. |
whatwg/fetch#906 has some initial refactoring of Fetch. I think what I'm going to do is that XHR takes the output of "sort and combine" and sorts it again using a sorting algorithm I'll define as "legacy-uppercased-byte less than". That way Fetch doesn't contain the hack and it's unlikely it'll spread further, assuming Chrome fixes their bugs... |
Sorry, which bug(s) are you referring to? |
@yutakahirano Chrome doesn't sort headers it seems, at least as far as |
Thanks! |
Needed for Fetch and XMLHttpRequest. See whatwg/fetch#906 and whatwg/xhr#248.
Okay, I have fixes up for Fetch, Infra, and XMLHttpRequest. Are you adding WPT tests @hsivonen? |
Needed for Fetch and XMLHttpRequest. See whatwg/fetch#906 and whatwg/xhr#248.
I'm modifying an existing test to add an underscore header. |
Okay, https://phabricator.services.mozilla.com/D31786 is sufficient for me. If there are no more comments I plan on landing this somewhere next week (it takes some time for all the cross-specification references to be indexed, which is also why the current patch fails). |
Firefox is fixed. I filed https://bugs.webkit.org/show_bug.cgi?id=200565 against Safari. Chrome still has https://bugs.chromium.org/p/chromium/issues/detail?id=651750. |
Implement whatwg/xhr#248. We haven't sorted the headers, so there is no compatibility issue. Bug: 993271, 651750 Change-Id: Ie69fb45a90795ea303324358312b16b7e6e227aa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1750476 Reviewed-by: Yoichi Osato <[email protected]> Reviewed-by: Adam Rice <[email protected]> Commit-Queue: Yutaka Hirano <[email protected]> Cr-Commit-Position: refs/heads/master@{#686673}
Chromium: Fixed. https://bugs.chromium.org/p/chromium/issues/detail?id=993271#c1 |
Added in version 2020-02-17 of XMLHttpRequest whatwg/xhr#248
Sorting headers lexicographically after ASCII-lowercasing them has the property that application-defined headers that begin with underscores sort to the beginning of the return string of
getAllResponseHeaders
. This breaks when JS accidentally assumes that the header of interest cannot be the first one.I suggest doing the sorting as if the the header names had been ASCII-uppercased, to avoid sorting headers starting with an underscore first.
The text was updated successfully, but these errors were encountered: