XMLHttpRequest: getAllResponseHeaders() should lowercase header names before sorting
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 17:14:36 +0000 (17:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Mar 2017 17:14:36 +0000 (17:14 +0000)
commit71722be1b2de565826d8f5ffde9749955f78422e
tree0d3d731488795abb677de6539f30c243ad7e20da
parentbb08757ba6efff5fe0f3f0ceb77ec9ba9ad7d665
XMLHttpRequest: getAllResponseHeaders() should lowercase header names before sorting
https://bugs.webkit.org/show_bug.cgi?id=169286

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-22
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/getallresponseheaders-cl-expected.txt:
* web-platform-tests/XMLHttpRequest/getallresponseheaders-expected.txt:

Source/WebCore:

Covered by rebased tests.

https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method now mandates to lowercase the header names and
sort them before appending them. This ensures that differences in the way headers are processed by browsers are
not visible to web pages. This also moves towards lowercased/case-insensitive header processing which should be
the norm.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::getAllResponseHeaders): Lower-casing, then sorting, then serializing headers.
* xml/XMLHttpRequest.h: Storing getAllResponseHeaders result if case needed again.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getallresponseheaders-cl-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getallresponseheaders-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h