Bug 175600

Summary: Fetch / Beacon: Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, Hironori.Fujii, ryanhaddad, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Chris Dumez 2017-08-15 14:43:10 PDT
Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView in Fetch & Beacon. If we don't set a Content-Type header, our underlying network stack is going to add a "application/x-www-form-urlencoded" Content-Type header, which is worse.
Comment 1 Chris Dumez 2017-08-15 14:47:56 PDT
Created attachment 318176 [details]
Patch
Comment 2 Chris Dumez 2017-08-15 15:39:50 PDT
Created attachment 318186 [details]
Patch
Comment 3 youenn fablet 2017-08-15 15:50:46 PDT
Comment on attachment 318186 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318186&action=review

> Source/WebCore/Modules/fetch/FetchBody.cpp:65
> +        contentType = HTTPHeaderValues::octetStreamContentType();

Can we add a FIXME stating that we should remove it once all WebKit network stacks support sending no CT?
Comment 4 Chris Dumez 2017-08-15 16:01:16 PDT
Created attachment 318188 [details]
Patch
Comment 5 youenn fablet 2017-08-15 16:17:04 PDT
Comment on attachment 318188 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318188&action=review

> Source/WebCore/Modules/fetch/FetchBody.cpp:65
> +        // FIXME: We should not set a Content-Type here but we need to do this until our network stack

s/our/all

> Source/WebCore/Modules/fetch/FetchBody.cpp:72
> +        // FIXME: We should not set a Content-Type here but we need to do this until our network stack

ditto

> LayoutTests/ChangeLog:13
> +2017-08-15  Chris Dumez  <cdumez@apple.com>

dup log and commit I guess
Comment 6 Chris Dumez 2017-08-15 17:41:39 PDT
Created attachment 318204 [details]
Patch
Comment 7 WebKit Commit Bot 2017-08-15 18:23:54 PDT
Comment on attachment 318204 [details]
Patch

Clearing flags on attachment: 318204

Committed r220779: <http://trac.webkit.org/changeset/220779>
Comment 8 WebKit Commit Bot 2017-08-15 18:23:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2017-08-15 18:25:30 PDT
<rdar://problem/33910024>
Comment 10 Fujii Hironori 2017-08-16 01:23:08 PDT
3 LayoutTests of iOS port fail:

http/tests/blink/sendbeacon/beacon-same-origin.html
http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html

https://build.webkit.org/results/Apple%20iOS%2010%20Simulator%20Release%20WK2%20(Tests)/r220779%20(3641)/results.html
Comment 11 Ryan Haddad 2017-08-16 08:36:21 PDT
(In reply to Fujii Hironori from comment #10)
> 3 LayoutTests of iOS port fail:
> 
> http/tests/blink/sendbeacon/beacon-same-origin.html
> http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
> http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
> 
> https://build.webkit.org/results/
> Apple%20iOS%2010%20Simulator%20Release%20WK2%20(Tests)/r220779%20(3641)/
> results.html
The same 3 are failing on Sierra:

https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/r220795%20(3640)/results.html
Comment 12 Chris Dumez 2017-08-16 08:43:49 PDT
(In reply to Ryan Haddad from comment #11)
> (In reply to Fujii Hironori from comment #10)
> > 3 LayoutTests of iOS port fail:
> > 
> > http/tests/blink/sendbeacon/beacon-same-origin.html
> > http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
> > http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
> > 
> > https://build.webkit.org/results/
> > Apple%20iOS%2010%20Simulator%20Release%20WK2%20(Tests)/r220779%20(3641)/
> > results.html
> The same 3 are failing on Sierra:
> 
> https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/
> r220795%20(3640)/results.html

Follow-up landed in <http://trac.webkit.org/changeset/220796>.