Bug 178027

Summary: [Beacon][Cocoa] Beacon requests with BufferSource payload should not have a Content-Type HTTP header
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, aestes, commit-queue, jlewis3, ryanhaddad, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2017-10-06 14:05:15 PDT
Beacon requests with BufferSource payload should not have a Content-Type HTTP header.
Comment 1 Chris Dumez 2017-10-06 14:05:31 PDT
<rdar://problem/34748470>
Comment 2 Chris Dumez 2017-10-06 14:09:01 PDT
Created attachment 323043 [details]
Patch
Comment 3 Chris Dumez 2017-10-06 14:09:21 PDT
--- /Volumes/Data/cdumez/WebKit/OpenSource/WebKitBuild/Debug/layout-test-results/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt
+++ /Volumes/Data/cdumez/WebKit/OpenSource/WebKitBuild/Debug/layout-test-results/imported/w3c/web-platform-tests/beacon/headers/header-content-type-actual.txt
@@ -1,7 +1,7 @@
 
 PASS Test content-type header for a body string 
-FAIL Test content-type header for a body ArrayBufferView assert_equals: Correct Content-Type header result expected "" but got "application/x-www-form-urlencoded"
-FAIL Test content-type header for a body ArrayBuffer assert_equals: Correct Content-Type header result expected "" but got "application/x-www-form-urlencoded"
+PASS Test content-type header for a body ArrayBufferView 
+PASS Test content-type header for a body ArrayBuffer 
 PASS Test content-type header for a body Blob 
 PASS Test content-type header for a body FormData 
 PASS Test content-type header for a body URLSearchParams
Comment 4 Chris Dumez 2017-10-06 14:09:37 PDT
--- /Volumes/Data/cdumez/WebKit/OpenSource/WebKitBuild/Debug/layout-test-results/http/tests/blink/sendbeacon/beacon-same-origin-expected.txt
+++ /Volumes/Data/cdumez/WebKit/OpenSource/WebKitBuild/Debug/layout-test-results/http/tests/blink/sendbeacon/beacon-same-origin-actual.txt
@@ -16,12 +16,11 @@
 Sending beacon with type: [object Uint32Array]
 PASS navigator.sendBeacon("resources/save-beacon.php?name=same-origin", payload); is true
 PASS Beacon sent successfully
-PASS Content-Type: application/x-www-form-urlencoded
 PASS Origin: http://127.0.0.1:8000
 PASS Referer: http://127.0.0.1:8000/blink/sendbeacon/beacon-same-origin.html
 PASS Request-Method: POST
 PASS Length: 40
-PASS Body: QAAAAEEAAABCAAAAQwAAAEQAAABFAAAARgAAAEcAAABIAAAASQAAAA==
+PASS Body: @\0\0\0A\0\0\0B\0\0\0C\0\0\0D\0\0\0E\0\0\0F\0\0\0G\0\0\0H\0\0\0I
 PASS 
 Sending beacon with type: [object Blob]
 PASS navigator.sendBeacon("resources/save-beacon.php?name=same-origin", payload); is true
Comment 5 Chris Dumez 2017-10-06 14:29:25 PDT
Created attachment 323045 [details]
Patch
Comment 6 WebKit Commit Bot 2017-10-06 17:25:03 PDT
Comment on attachment 323045 [details]
Patch

Clearing flags on attachment: 323045

Committed r223014: <http://trac.webkit.org/changeset/223014>
Comment 7 WebKit Commit Bot 2017-10-06 17:25:05 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Andy Estes 2017-10-06 23:51:03 PDT
(In reply to WebKit Commit Bot from comment #6)
> Comment on attachment 323045 [details]
> Patch
> 
> Clearing flags on attachment: 323045
> 
> Committed r223014: <http://trac.webkit.org/changeset/223014>

This broke several of the Internal SDK builds, since -_suppressedAutoAddedHTTPHeaders isn't defined in most macOS 10.13 and iOS 11 Internal SDKs, and CFNetworkSPI.h only defines it for Public SDK builds.
Comment 9 Andy Estes 2017-10-07 00:02:51 PDT
Tried to fix the build in r223019: <http://trac.webkit.org/changeset/223019>
Comment 10 Chris Dumez 2017-10-09 08:57:13 PDT
(In reply to Andy Estes from comment #8)
> and CFNetworkSPI.h only defines it for Public SDK builds.

Oh, I did not know this. Thanks for fixing.