RESOLVED FIXED 188588
[Curl] Don't send Content-Type header for POST request when body is null.
https://bugs.webkit.org/show_bug.cgi?id=188588
Summary [Curl] Don't send Content-Type header for POST request when body is null.
Basuke Suzuki
Reported 2018-08-14 16:14:47 PDT
Caught by http/tests/xmlhttprequest/methods.html
Attachments
PATCH (2.73 KB, patch)
2018-08-14 16:30 PDT, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2018-08-14 16:30:17 PDT
youenn fablet
Comment 2 2018-08-14 20:54:19 PDT
Comment on attachment 347126 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=347126&action=review > Source/WebCore/ChangeLog:9 > + when body is null. Is it done for CURL only for POST when setting CURLOPT_POST? Is it also happening for other methods like PUT? > Source/WebCore/platform/network/curl/CurlRequest.cpp:468 > + m_curlHandle->removeRequestHeader("Content-Type"_s); What happens if there are elementSize but no provided HTTPHeaderName::ContentType? If it is the default CURL, does it align with other ports?
Basuke Suzuki
Comment 3 2018-08-15 11:23:16 PDT
Comment on attachment 347126 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=347126&action=review >> Source/WebCore/ChangeLog:9 >> + when body is null. > > Is it done for CURL only for POST when setting CURLOPT_POST? > Is it also happening for other methods like PUT? libcurl only behaves like this on POST. I guess POST is more popular use case for libcurl. >> Source/WebCore/platform/network/curl/CurlRequest.cpp:468 >> + m_curlHandle->removeRequestHeader("Content-Type"_s); > > What happens if there are elementSize but no provided HTTPHeaderName::ContentType? > If it is the default CURL, does it align with other ports? That is covered by this case in the test: req.open("POST", "methods.cgi", false); req.send(""); log('POST(""): ' + req.getResponseHeader("REQMETHOD") + "(" + req.getResponseHeader("REQLENGTH") + " bytes), Content-Type: " + req.getResponseHeader("REQTYPE")); All three ports returns that content type is sent as "Content-Type: text/plain;charset=UTF-8".
Basuke Suzuki
Comment 4 2018-08-15 11:23:46 PDT
Comment on attachment 347126 [details] PATCH Thanks Youenn for r+
WebKit Commit Bot
Comment 5 2018-08-15 11:51:00 PDT
Comment on attachment 347126 [details] PATCH Clearing flags on attachment: 347126 Committed r234892: <https://trac.webkit.org/changeset/234892>
WebKit Commit Bot
Comment 6 2018-08-15 11:51:01 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2018-08-15 11:52:15 PDT
Fujii Hironori
Comment 8 2018-08-15 13:46:34 PDT
Basuke Suzuki
Comment 9 2018-08-15 20:18:14 PDT
I confirmed this difference. It is weird the result was different than at home. I'm double check my build env.
Note You need to log in before you can comment on or make changes to this bug.