RESOLVED FIXED175764
Fetch: data: URL HEAD request should result in empty response body
https://bugs.webkit.org/show_bug.cgi?id=175764
Summary Fetch: data: URL HEAD request should result in empty response body
Anne van Kesteren
Reported 2017-08-21 03:09:54 PDT
Test: http://w3c-test.org/XMLHttpRequest/data-uri.htm Updated in: https://github.com/w3c/web-platform-tests/pull/6923 Even if Fetch initially ends up creating a response with a body, main fetch step 18 sets it to null again. This is my bad since it's likely you used to pass this.
Attachments
Patch (4.23 KB, patch)
2019-10-05 01:08 PDT, Rob Buis
no flags
Patch (5.25 KB, patch)
2019-10-05 01:45 PDT, Rob Buis
no flags
Patch (5.25 KB, patch)
2019-10-05 04:36 PDT, Rob Buis
no flags
Patch (4.38 KB, patch)
2019-10-08 00:32 PDT, Rob Buis
no flags
youenn fablet
Comment 1 2019-08-28 00:40:49 PDT
This is probably easy to fix and makes sense to me. Looking at https://wpt.fyi/results/fetch/api/basic/scheme-data.any.html?label=master&label=experimental&aligned&q=fetch%2Fapi%2Fbasic%2Fscheme-data.any.html, all browsers consistently provide a body to HEAD data URL requests when using fetch API. Looking at https://wpt.fyi/results/xhr/data-uri.htm?label=master&label=experimental&aligned&q=xhr%2Fdata-uri.htm, all browsers except Firefox do so when using XHR.
Rob Buis
Comment 2 2019-10-05 01:08:28 PDT
Rob Buis
Comment 3 2019-10-05 01:45:22 PDT
Rob Buis
Comment 4 2019-10-05 04:36:16 PDT
youenn fablet
Comment 5 2019-10-07 11:46:50 PDT
Comment on attachment 380281 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380281&action=review > Source/WebCore/ChangeLog:11 > + imported/web-platform-tests/xhr/data-uri.html Can we update ResourceLoader::loadDataURL()?
Rob Buis
Comment 6 2019-10-08 00:32:04 PDT
Rob Buis
Comment 7 2019-10-08 03:42:19 PDT
(In reply to youenn fablet from comment #5) > Comment on attachment 380281 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=380281&action=review > > > Source/WebCore/ChangeLog:11 > > + imported/web-platform-tests/xhr/data-uri.html > > Can we update ResourceLoader::loadDataURL()? That does seem like the better spot to fix this for data url's, done.
youenn fablet
Comment 8 2019-10-08 03:58:23 PDT
Comment on attachment 380410 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=380410&action=review > Source/WebCore/loader/ResourceLoader.cpp:288 > + if (!this->reachedTerminalState() && dataSize && m_request.httpMethod() != "HEAD") I believe we correctly handle these cases but do we have test coverage for gEt or HeAD? As a side-note, we probably currently fail HEAD requests for blobs. Are we expected to also do the same as for data URLs? Since no HEAD request is expected to give a response with a body, I guess we could add an ASSERT in DocumentThreadableLoader to ensure that.
Rob Buis
Comment 9 2019-10-08 05:04:19 PDT
(In reply to youenn fablet from comment #8) > Comment on attachment 380410 [details] > I believe we correctly handle these cases but do we have test coverage for > gEt or HeAD? I don't think there are tests, I quickly tried it locally on data-uri.htm and indeed we handle it correctly. > As a side-note, we probably currently fail HEAD requests for blobs. > Are we expected to also do the same as for data URLs? IIUC according to the spec we should not even support anything other than GET: https://fetch.spec.whatwg.org/#concept-scheme-fetch (blob 1.2) However AFAIK chromium and WebKit do support HEAD. So this seems a grey area. > Since no HEAD request is expected to give a response with a body, I guess we > could add an ASSERT in DocumentThreadableLoader to ensure that. We could, I will keep it in mind since there may be more bugs/tests that would require it.
Rob Buis
Comment 10 2019-10-08 05:06:26 PDT
*** Bug 201136 has been marked as a duplicate of this bug. ***
WebKit Commit Bot
Comment 11 2019-10-08 05:51:43 PDT
Comment on attachment 380410 [details] Patch Clearing flags on attachment: 380410 Committed r250822: <https://trac.webkit.org/changeset/250822>
WebKit Commit Bot
Comment 12 2019-10-08 05:51:45 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13 2019-10-08 05:52:17 PDT
Note You need to log in before you can comment on or make changes to this bug.