RESOLVED FIXED 161736
[Fetch API] Headers should be combined with ',' and not ', '
https://bugs.webkit.org/show_bug.cgi?id=161736
Summary [Fetch API] Headers should be combined with ',' and not ', '
youenn fablet
Reported 2016-09-08 06:05:22 PDT
This is also the case for XHR
Attachments
Patch (12.01 KB, patch)
2016-09-08 06:15 PDT, youenn fablet
buildbot: commit-queue-
Archive of layout-test-results from ews101 for mac-yosemite (743.53 KB, application/zip)
2016-09-08 07:10 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (903.35 KB, application/zip)
2016-09-08 07:12 PDT, Build Bot
no flags
Patch (11.38 KB, patch)
2016-09-08 07:18 PDT, youenn fablet
no flags
Using makeString (11.39 KB, patch)
2016-09-08 10:50 PDT, youenn fablet
no flags
Adding new test to keep same level of test coverage (15.75 KB, patch)
2016-09-09 07:43 PDT, youenn fablet
no flags
Patch for landing (15.47 KB, patch)
2016-09-16 00:03 PDT, youenn fablet
no flags
Patch for landing (15.55 KB, patch)
2016-09-16 00:54 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2016-09-08 06:15:42 PDT
Build Bot
Comment 2 2016-09-08 07:10:27 PDT
Comment on attachment 288261 [details] Patch Attachment 288261 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2034282 New failing tests: imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
Build Bot
Comment 3 2016-09-08 07:10:32 PDT
Created attachment 288265 [details] Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 4 2016-09-08 07:12:48 PDT
Comment on attachment 288261 [details] Patch Attachment 288261 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2034285 New failing tests: imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
Build Bot
Comment 5 2016-09-08 07:12:53 PDT
Created attachment 288266 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
youenn fablet
Comment 6 2016-09-08 07:18:33 PDT
Alex Christensen
Comment 7 2016-09-08 09:06:18 PDT
Comment on attachment 288267 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288267&action=review > Source/WebCore/platform/network/HTTPHeaderMap.cpp:100 > - result.iterator->value = result.iterator->value + ", " + value; > + result.iterator->value = result.iterator->value + "," + value; Somebody once told me makeString is faster than operator+ because this does unnecessary allocations and copies. > LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt:10 > -PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) > +FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) assert_equals: expected "content-type," but got "" Should these tests be changed?
youenn fablet
Comment 8 2016-09-08 09:16:58 PDT
>LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt:10 > > -PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) > > +FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) assert_equals: expected "content-type," but got "" > > Should these tests be changed? I tried making the error messages more descriptive, but they would be flaky (see previous patch). The tests do not need to be fixed. It is the lower HTTP library that would need to be fixed as they insert spaces for some headers: ct, pragma... That should be done elsewhere
youenn fablet
Comment 9 2016-09-08 10:50:07 PDT
Created attachment 288278 [details] Using makeString
youenn fablet
Comment 10 2016-09-08 10:51:54 PDT
Thanks for the comments > > Source/WebCore/platform/network/HTTPHeaderMap.cpp:100 > > - result.iterator->value = result.iterator->value + ", " + value; > > + result.iterator->value = result.iterator->value + "," + value; > > Somebody once told me makeString is faster than operator+ because this does > unnecessary allocations and copies. Done. > > LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt:10 > > -PASS XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) > > +FAIL XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type) assert_equals: expected "content-type," but got "" > > Should these tests be changed? As said above, we should be able to pass these tests, but that should be left to another bug. It might be the case that other ports might pass this test directly.
Alex Christensen
Comment 11 2016-09-08 11:04:48 PDT
Comment on attachment 288278 [details] Using makeString View in context: https://bugs.webkit.org/attachment.cgi?id=288278&action=review > LayoutTests/imported/w3c/ChangeLog:10 > + This is due to the fact that the underlying HTTP code is probably reprocessing those headers and readding ', ' in lieu of ','. But it wasn't before? These tests passed before this change. I'm not convinced. I don't think we should regress this test.
youenn fablet
Comment 12 2016-09-08 12:33:29 PDT
> > LayoutTests/imported/w3c/ChangeLog:10 > > + This is due to the fact that the underlying HTTP code is probably reprocessing those headers and readding ', ' in lieu of ','. > > But it wasn't before? These tests passed before this change. I'm not > convinced. I don't think we should regress this test. Is is true that these tests were passing before the changes. It is also true that these tests were not conforming with the spec. The fact that some of these tests were passing is a proof that WebKit was not compliant with the spec. Now that this patch makes the test conforming and updates part of the implementation, we see that some tests are passing (which is good), while some still do not work. They do not work for two reasons: - headers are not set according user input (previous failing tests). - headers are reserialised at a lower level with a '' between values (new failing tests, Content-Type e.g.). This should be fixed at CFNetwork level. Plan is to file a radar once WebKit layer gets fixed.
youenn fablet
Comment 13 2016-09-09 07:43:56 PDT
Created attachment 288402 [details] Adding new test to keep same level of test coverage
Alex Christensen
Comment 14 2016-09-09 09:56:13 PDT
If web platform tests are not conforming with the spec, web platform tests ought to be changed.
youenn fablet
Comment 15 2016-09-09 10:03:41 PDT
(In reply to comment #14) > If web platform tests are not conforming with the spec, web platform tests > ought to be changed. headers-combined was already changed in wpt repo. I will upload the other changed WPT tests in this patch once it gets landed in WebKit.
youenn fablet
Comment 16 2016-09-09 10:04:05 PDT
Or I can prepare the PR in parallel, I'll do it when possible
youenn fablet
Comment 17 2016-09-09 10:11:46 PDT
youenn fablet
Comment 18 2016-09-12 05:13:47 PDT
(In reply to comment #14) > If web platform tests are not conforming with the spec, web platform tests > ought to be changed. PR was merged today. The WPT tests are now changed according to this patch in W3C repo.
Sam Weinig
Comment 19 2016-09-15 06:43:20 PDT
Comment on attachment 288402 [details] Adding new test to keep same level of test coverage View in context: https://bugs.webkit.org/attachment.cgi?id=288402&action=review > Source/WebCore/loader/CrossOriginAccessControl.cpp:134 > + headerBuffer.appendLiteral(","); This can use headerBuffer.append(',')
youenn fablet
Comment 20 2016-09-16 00:03:18 PDT
Created attachment 289038 [details] Patch for landing
WebKit Commit Bot
Comment 21 2016-09-16 00:35:10 PDT
Comment on attachment 289038 [details] Patch for landing Rejecting attachment 289038 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 289038, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: n "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit LayoutTests/imported/w3c/web-platform-tests/fetch/api/headers/headers-combine-expected.txt: needs update LayoutTests/imported/w3cqweb-platform-tests/fetch/api/headers/headers-combine-expected.txt: needs update update-index --refresh: command returned error: 1 Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Updating OpenSource Current branch master is up to date. Full output: http://webkit-queues.webkit.org/results/2085802
youenn fablet
Comment 22 2016-09-16 00:54:13 PDT
Created attachment 289047 [details] Patch for landing
WebKit Commit Bot
Comment 23 2016-09-16 01:26:27 PDT
Comment on attachment 289047 [details] Patch for landing Clearing flags on attachment: 289047 Committed r206014: <http://trac.webkit.org/changeset/206014>
WebKit Commit Bot
Comment 24 2016-09-16 01:26:33 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 25 2016-09-16 15:05:44 PDT
Comment on attachment 289047 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=289047&action=review > Source/WebCore/platform/network/HTTPHeaderMap.cpp:100 > + result.iterator->value = makeString(result.iterator->value, ",", value); I think it would be slightly more efficient if you used ',' instead of "," here, skipping a call to the strlen function. Unless makeString does not know how to handle single characters.
youenn fablet
Comment 26 2016-09-18 22:55:18 PDT
(In reply to comment #25) > Comment on attachment 289047 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=289047&action=review > > > Source/WebCore/platform/network/HTTPHeaderMap.cpp:100 > > + result.iterator->value = makeString(result.iterator->value, ",", value); > > I think it would be slightly more efficient if you used ',' instead of "," > here, skipping a call to the strlen function. Unless makeString does not > know how to handle single characters. Filed bug 162140 for that purpose
Note You need to log in before you can comment on or make changes to this bug.