Bug 160028

Summary: CrossOrigin preflight checker should compute the right Access-Control-Request-Headers value
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, commit-queue, japhet
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 160052    
Bug Blocks: 151937    
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
Patch
none
Fixing case comparison and beefing up tests
none
Fixing case comparison and beefing up tests none

youenn fablet
Reported 2016-07-21 10:00:53 PDT
As per https://fetch.spec.whatwg.org/#cors-preflight-fetch, computation of this value should be done before Origin header is set. It should also remove safe request headers from the list and sort the unsafe headers.
Attachments
Patch (16.11 KB, patch)
2016-07-27 07:02 PDT, youenn fablet
no flags
Archive of layout-test-results from ews125 for ios-simulator-wk2 (578.73 KB, application/zip)
2016-07-27 08:00 PDT, Build Bot
no flags
Patch (18.88 KB, patch)
2016-07-27 09:16 PDT, youenn fablet
no flags
Fixing case comparison and beefing up tests (29.45 KB, patch)
2016-07-28 01:35 PDT, youenn fablet
no flags
Fixing case comparison and beefing up tests (41.39 KB, patch)
2016-07-28 02:40 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2016-07-27 07:02:55 PDT
Build Bot
Comment 2 2016-07-27 08:00:09 PDT
Comment on attachment 284692 [details] Patch Attachment 284692 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/1761974 New failing tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.html
Build Bot
Comment 3 2016-07-27 08:00:13 PDT
Created attachment 284696 [details] Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.5
youenn fablet
Comment 4 2016-07-27 09:16:44 PDT
WebKit Commit Bot
Comment 5 2016-07-27 10:00:57 PDT
Comment on attachment 284702 [details] Patch Rejecting attachment 284702 [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', 'validate-changelog', '--check-oops', '--non-interactive', 284702, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in LayoutTests/ChangeLog contains OOPS!. Full output: http://webkit-queues.webkit.org/results/1762526
Alex Christensen
Comment 6 2016-07-28 00:14:59 PDT
Comment on attachment 284702 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284702&action=review > Source/WebCore/loader/DocumentThreadableLoader.cpp:121 > + preflightSuccess(ResourceRequest(request)); Is it really impossible to make request a ResourceRequest&&? This copy shouldn't be necessary. > Source/WebCore/platform/network/HTTPParsers.cpp:770 > + return value == "application/x-www-form-urlencoded" || value == "multipart/form-data" || value == "text/plain"; These should probably be case-insensitive comparisons and tested as such. tExT/pLaIn should be safe, right?
youenn fablet
Comment 7 2016-07-28 00:27:14 PDT
Comment on attachment 284702 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284702&action=review >> Source/WebCore/loader/DocumentThreadableLoader.cpp:121 >> + preflightSuccess(ResourceRequest(request)); > > Is it really impossible to make request a ResourceRequest&&? This copy shouldn't be necessary. request is const and preflightSuccess will add the origin in the headers, so we need to make a copy. Or we should make DocumentThreadableLoader constructor take a ResourceRequest&&. >> Source/WebCore/platform/network/HTTPParsers.cpp:770 >> + return value == "application/x-www-form-urlencoded" || value == "multipart/form-data" || value == "text/plain"; > > These should probably be case-insensitive comparisons and tested as such. tExT/pLaIn should be safe, right? I need to fix that obviously, thanks!
youenn fablet
Comment 8 2016-07-28 01:35:13 PDT
Created attachment 284761 [details] Fixing case comparison and beefing up tests
youenn fablet
Comment 9 2016-07-28 02:40:06 PDT
Created attachment 284764 [details] Fixing case comparison and beefing up tests
youenn fablet
Comment 10 2016-07-28 02:42:25 PDT
I added rebasing of some worker tests (currently skipped). As can be seen, referrer is set for workers before preflighting, in WorkerThreadableLoader probably. Like we did for Origin, setting referrer should be done at a lower loader code level.
Alex Christensen
Comment 11 2016-07-28 10:16:39 PDT
> Or we should make DocumentThreadableLoader constructor take a > ResourceRequest&&. Yes. Let's do that. That's better than making a copy.
Alex Christensen
Comment 12 2016-07-28 10:31:30 PDT
Comment on attachment 284764 [details] Fixing case comparison and beefing up tests r=me other than that.
youenn fablet
Comment 13 2016-07-29 03:50:14 PDT
(In reply to comment #11) > > Or we should make DocumentThreadableLoader constructor take a > > ResourceRequest&&. > Yes. Let's do that. That's better than making a copy. OK, I'll prepare patches to optimize ResourceResponse and ResourceRequest transfer around DocumentThreadableLoader. As for ResourceRequest, note that DocumentThreadableLoader is already creating a request copy when creating its CachedResourceRequest. We could probably optimize this already without changing its clients. That should go back to the previous number of ResourceRequest copies.
WebKit Commit Bot
Comment 14 2016-07-29 04:09:19 PDT
Comment on attachment 284764 [details] Fixing case comparison and beefing up tests Clearing flags on attachment: 284764 Committed r203899: <http://trac.webkit.org/changeset/203899>
WebKit Commit Bot
Comment 15 2016-07-29 04:09:25 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.