Bug 211999 - XMLHTTPRequest.send should not send Content-Type headers when Blob has no type
Summary: XMLHTTPRequest.send should not send Content-Type headers when Blob has no type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
: 159210 (view as bug list)
Depends on:
Blocks: 213690
  Show dependency treegraph
 
Reported: 2020-05-17 12:25 PDT by Rob Buis
Modified: 2020-07-18 21:59 PDT (History)
4 users (show)

See Also:


Attachments
Patch (4.45 KB, patch)
2020-05-17 12:28 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.71 KB, patch)
2020-05-17 13:32 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.41 KB, patch)
2020-05-18 00:04 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (8.95 KB, patch)
2020-06-08 07:49 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (9.10 KB, patch)
2020-06-08 09:17 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Buis 2020-05-17 12:25:28 PDT
XMLHTTPRequest.send should not send Content-Type headers when Blob has no type [1, 2].
This behavior overrides the behavior of the File API spec [3].

[1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
[2] https://fetch.spec.whatwg.org/#concept-bodyinit-extract
[3] http://dev.w3.org/2006/webapi/FileAPI/#dfn-type
Comment 1 Rob Buis 2020-05-17 12:28:37 PDT
Created attachment 399599 [details]
Patch
Comment 2 Rob Buis 2020-05-17 13:32:08 PDT
Created attachment 399604 [details]
Patch
Comment 3 Rob Buis 2020-05-18 00:04:48 PDT
Created attachment 399625 [details]
Patch
Comment 4 Rob Buis 2020-06-08 07:49:10 PDT
Created attachment 401335 [details]
Patch
Comment 5 Rob Buis 2020-06-08 09:17:37 PDT
Created attachment 401344 [details]
Patch
Comment 6 EWS 2020-06-08 23:44:52 PDT
Committed r262776: <https://trac.webkit.org/changeset/262776>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401344 [details].
Comment 7 Radar WebKit Bug Importer 2020-06-08 23:45:20 PDT
<rdar://problem/64152152>
Comment 8 youenn fablet 2020-06-09 02:04:23 PDT
Comment on attachment 401344 [details]
Patch

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

> Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:125
> +        // CFNetwork will add "application/x-www-form-urlencoded" content-type for POST, even if no Content-Type was specified, remove it in that case.

If that is true, CFNetwork should probably fix that issue as well.
Is there a test that is exhibiting that issue?
Comment 9 youenn fablet 2020-06-09 02:04:25 PDT
Comment on attachment 401344 [details]
Patch

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

> Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:125
> +        // CFNetwork will add "application/x-www-form-urlencoded" content-type for POST, even if no Content-Type was specified, remove it in that case.

If that is true, CFNetwork should probably fix that issue as well.
Is there a test that is exhibiting that issue?
Comment 10 youenn fablet 2020-06-09 02:04:53 PDT
*** Bug 159210 has been marked as a duplicate of this bug. ***
Comment 11 Rob Buis 2020-06-09 02:30:18 PDT
Comment on attachment 401344 [details]
Patch

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

>>> Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:125
>>> +        // CFNetwork will add "application/x-www-form-urlencoded" content-type for POST, even if no Content-Type was specified, remove it in that case.
>> 
>> If that is true, CFNetwork should probably fix that issue as well.
>> Is there a test that is exhibiting that issue?
> 
> If that is true, CFNetwork should probably fix that issue as well.
> Is there a test that is exhibiting that issue?

To be clear, this remark is only true for WK1, WK2 is fine. Maybe it is the difference of using NSURLConnection for WK1 versus NSURLSession?

The test is imported/w3c/web-platform-tests/xhr/send-blob-with-no-mime-type.html, or did I misunderstand your question?
Comment 12 Alex Christensen 2020-06-09 08:20:29 PDT
NSURLConnection bugs have low likelihood of being fixed.  This fix is fine.
Comment 13 Alex Christensen 2020-07-18 21:59:59 PDT
This broke an app.  I fix the app in https://bugs.webkit.org/show_bug.cgi?id=214528