REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2017 10:00:22 +0000 (10:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2017 10:00:22 +0000 (10:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168115

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2017-02-15
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt:
* web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt:

Source/WebCore:

In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
fetch specification, but the uncommon headers are still combined with ", ".

* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::add):

LayoutTests:

* http/tests/xmlhttprequest/check-combining-headers-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt: Added.
* platform/ios-simulator/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212355 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/check-combining-headers-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt
LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt
LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/network/HTTPHeaderMap.cpp

index 566a7ad..b82ac94 100644 (file)
@@ -1,3 +1,14 @@
+2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
+        https://bugs.webkit.org/show_bug.cgi?id=168115
+
+        Reviewed by Darin Adler.
+
+        * http/tests/xmlhttprequest/check-combining-headers-expected.txt:
+        * platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt: Added.
+        * platform/ios-simulator/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt: Added.
+
 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
 
         An assertion failure inside removeChildren
index bed99b2..fdc3b4e 100644 (file)
@@ -3,11 +3,11 @@ CONSOLE MESSAGE: line 17: Refused to set unsafe header "User-Agent"
 CONSOLE MESSAGE: line 16: Refused to set unsafe header "Content-Transfer-Encoding"
 CONSOLE MESSAGE: line 17: Refused to set unsafe header "Content-Transfer-Encoding"
 
-FAIL XMLHttpRequest: setRequestHeader() - combining headers (Authorization) assert_equals: Combined header value should be t1,t2 expected "t1,t2" but got "t1, t2"
-FAIL XMLHttpRequest: setRequestHeader() - combining headers (Pragma) assert_equals: Combined header value should be t1,t2 expected "t1,t2" but got "t1, t2"
+PASS XMLHttpRequest: setRequestHeader() - combining headers (Authorization) 
+PASS XMLHttpRequest: setRequestHeader() - combining headers (Pragma) 
 FAIL XMLHttpRequest: setRequestHeader() - combining headers (User-Agent) assert_true: Combined header value should be t1,t2 expected true got false
 FAIL XMLHttpRequest: setRequestHeader() - combining headers (Content-Transfer-Encoding) assert_equals: Combined header value should be t1,t2 expected (string) "t1,t2" but got (undefined) undefined
-FAIL XMLHttpRequest: setRequestHeader() - combining headers (Content-Type) assert_equals: Combined header value should be t1,t2 expected "t1,t2" but got "t1, t2"
+PASS XMLHttpRequest: setRequestHeader() - combining headers (Content-Type) 
 PASS XMLHttpRequest: setRequestHeader() - combining headers (Overwrite) 
 PASS XMLHttpRequest: setRequestHeader() - combining headers (If) 
 PASS XMLHttpRequest: setRequestHeader() - combining headers (Status-URI) 
index 4607491..fd34b17 100644 (file)
@@ -1,3 +1,13 @@
+2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
+        https://bugs.webkit.org/show_bug.cgi?id=168115
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt:
+        * web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt:
+
 2017-02-14  Chris Dumez  <cdumez@apple.com>
 
         Fallback to legacy type only when event is trusted
index 84f69b4..6bf3502 100644 (file)
@@ -3,11 +3,11 @@ CONSOLE MESSAGE: line 17: Refused to set unsafe header "User-Agent"
 CONSOLE MESSAGE: line 16: Refused to set unsafe header "Content-Transfer-Encoding"
 CONSOLE MESSAGE: line 17: Refused to set unsafe header "Content-Transfer-Encoding"
 
-FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Authorization) assert_equals: expected "authorization," but got ""
-FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Pragma) assert_equals: expected "pragma," but got ""
+PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Authorization) 
+PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Pragma) 
 FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (User-Agent) assert_equals: expected "user-agent," but got ""
 FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Transfer-Encoding) assert_equals: expected "content-transfer-encoding," but got ""
-FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) assert_equals: expected "content-type," but got ""
+PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) 
 PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Overwrite) 
 PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (If) 
 PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Status-URI) 
diff --git a/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt b/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt
new file mode 100644 (file)
index 0000000..b9f6d78
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS XMLHttpRequest: getResponseHeader() case-insensitive matching 
+
diff --git a/LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt b/LayoutTests/platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-case-insensitive-expected.txt
new file mode 100644 (file)
index 0000000..b9f6d78
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS XMLHttpRequest: getResponseHeader() case-insensitive matching 
+
index c1e55bb..42dae43 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
+        https://bugs.webkit.org/show_bug.cgi?id=168115
+
+        Reviewed by Darin Adler.
+
+        In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
+        fetch specification, but the uncommon headers are still combined with ", ".
+
+        * platform/network/HTTPHeaderMap.cpp:
+        (WebCore::HTTPHeaderMap::add):
+
 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
 
         An assertion failure inside removeChildren
index 4fc8148..1969480 100644 (file)
@@ -97,7 +97,7 @@ void HTTPHeaderMap::add(const String& name, const String& value)
     if (!findHTTPHeaderName(name, headerName)) {
         auto result = m_uncommonHeaders.add(name, value);
         if (!result.isNewEntry)
-            result.iterator->value = makeString(result.iterator->value, ',', value);
+            result.iterator->value = result.iterator->value + ',' + value;
         return;
     }
     add(headerName, value);
@@ -148,7 +148,7 @@ void HTTPHeaderMap::add(HTTPHeaderName name, const String& value)
 {
     auto result = m_commonHeaders.add(name, value);
     if (!result.isNewEntry)
-        result.iterator->value = result.iterator->value + ", " + value;
+        result.iterator->value = result.iterator->value + ',' + value;
 }
 
 } // namespace WebCore