Changeset 250822 in webkit


Ignore:
Timestamp:
Oct 8, 2019 5:51:36 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Fetch: data: URL HEAD request should result in empty response body
https://bugs.webkit.org/show_bug.cgi?id=175764

Patch by Rob Buis <rbuis@igalia.com> on 2019-10-08
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Update improved test results.

  • web-platform-tests/fetch/api/basic/scheme-data.any.js:
  • web-platform-tests/xhr/data-uri-expected.txt:

Source/WebCore:

Do not build the response body for HEAD requests for data urls:
https://fetch.spec.whatwg.org/#concept-main-fetch (Step 13)

Tests: imported/web-platform-tests/fetch/api/basic/scheme-data.any.js

imported/web-platform-tests/xhr/data-uri.html

  • loader/ResourceLoader.cpp:

(WebCore::ResourceLoader::loadDataURL):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r250821 r250822  
     12019-10-08  Rob Buis  <rbuis@igalia.com>
     2
     3        Fetch: data: URL HEAD request should result in empty response body
     4        https://bugs.webkit.org/show_bug.cgi?id=175764
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Update improved test results.
     9
     10        * web-platform-tests/fetch/api/basic/scheme-data.any.js:
     11        * web-platform-tests/xhr/data-uri-expected.txt:
     12
    1132019-10-08  Antti Koivisto  <antti@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/scheme-data.any.js

    r215164 r250822  
    3030                   "image/png");
    3131checkFetchResponse("data:,response%27s%20body", "response's body", "text/plain;charset=US-ASCII", null, "POST");
    32 checkFetchResponse("data:,response%27s%20body", "response's body", "text/plain;charset=US-ASCII", null, "HEAD");
     32checkFetchResponse("data:,response%27s%20body", "", "text/plain;charset=US-ASCII", null, "HEAD");
    3333
    3434function checkKoUrl(url, method, desc) {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/data-uri-expected.txt

    r235354 r250822  
    88PASS XHR method PUT with MIME type text/plain
    99PASS XHR method DELETE with MIME type text/plain
    10 FAIL XHR method HEAD with MIME type text/plain assert_equals: expected "" but got "Hello, World!"
     10PASS XHR method HEAD with MIME type text/plain
    1111PASS XHR method UNICORN with MIME type text/plain
    1212
  • trunk/Source/WebCore/ChangeLog

    r250821 r250822  
     12019-10-08  Rob Buis  <rbuis@igalia.com>
     2
     3        Fetch: data: URL HEAD request should result in empty response body
     4        https://bugs.webkit.org/show_bug.cgi?id=175764
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Do not build the response body for HEAD requests for data urls:
     9        https://fetch.spec.whatwg.org/#concept-main-fetch (Step 13)
     10
     11        Tests: imported/web-platform-tests/fetch/api/basic/scheme-data.any.js
     12               imported/web-platform-tests/xhr/data-uri.html
     13
     14        * loader/ResourceLoader.cpp:
     15        (WebCore::ResourceLoader::loadDataURL):
     16
    1172019-10-08  Antti Koivisto  <antti@apple.com>
    218
  • trunk/Source/WebCore/loader/ResourceLoader.cpp

    r249504 r250822  
    286286        dataResponse.setSource(ResourceResponse::Source::Network);
    287287        this->didReceiveResponse(dataResponse, [this, protectedThis = WTFMove(protectedThis), dataSize, data = result.data.releaseNonNull()]() mutable {
    288             if (!this->reachedTerminalState() && dataSize)
     288            if (!this->reachedTerminalState() && dataSize && m_request.httpMethod() != "HEAD")
    289289                this->didReceiveBuffer(WTFMove(data), dataSize, DataPayloadWholeResource);
    290290
Note: See TracChangeset for help on using the changeset viewer.