Changeset 291622 in webkit


Ignore:
Timestamp:
Mar 22, 2022 8:45:59 AM (4 months ago)
Author:
jer.noble@apple.com
Message:

Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
https://bugs.webkit.org/show_bug.cgi?id=238170

Reviewed by Eric Carlson.

Source/WebCore:

Test: fetch/fetch-blob-unbounded-range.html

Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
to pass into ParsedContentRange.

  • platform/network/BlobResourceHandle.cpp:

(WebCore::BlobResourceHandle::notifyResponseOnSuccess):

Source/WebKit:

Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
to pass into ParsedContentRange.

  • NetworkProcess/NetworkDataTaskBlob.cpp:

(WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):

LayoutTests:

  • fetch/fetch-blob-unbounded-range-expected.txt: Added.
  • fetch/fetch-blob-unbounded-range.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r291613 r291622  
     12022-03-22  Jer Noble  <jer.noble@apple.com>
     2
     3        Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
     4        https://bugs.webkit.org/show_bug.cgi?id=238170
     5
     6        Reviewed by Eric Carlson.
     7
     8        * fetch/fetch-blob-unbounded-range-expected.txt: Added.
     9        * fetch/fetch-blob-unbounded-range.html: Added.
     10
    1112022-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r291616 r291622  
     12022-03-22  Jer Noble  <jer.noble@apple.com>
     2
     3        Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
     4        https://bugs.webkit.org/show_bug.cgi?id=238170
     5
     6        Reviewed by Eric Carlson.
     7
     8        Test: fetch/fetch-blob-unbounded-range.html
     9
     10        Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
     11        to pass into ParsedContentRange.
     12
     13        * platform/network/BlobResourceHandle.cpp:
     14        (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
     15
    1162022-03-22  Zan Dobersek  <zdobersek@igalia.com>
    217
  • trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp

    r287240 r291622  
    580580    addCrossOriginEmbedderPolicyHeaders(response, m_blobData->policyContainer().crossOriginEmbedderPolicy);
    581581
    582     if (isRangeRequest)
    583         response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());
     582    if (isRangeRequest) {
     583        auto rangeEnd = m_rangeEnd;
     584        if (rangeEnd == kPositionNotSpecified)
     585            rangeEnd = m_totalSize - 1;
     586
     587        response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, rangeEnd, m_totalSize).headerValue());
     588    }
    584589    // FIXME: If a resource identified with a blob: URL is a File object, user agents must use that file's name attribute,
    585590    // as if the response had a Content-Disposition header with the filename parameter set to the File's name attribute.
  • trunk/Source/WebKit/ChangeLog

    r291621 r291622  
     12022-03-22  Jer Noble  <jer.noble@apple.com>
     2
     3        Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
     4        https://bugs.webkit.org/show_bug.cgi?id=238170
     5
     6        Reviewed by Eric Carlson.
     7
     8        Handle the case where the request contains an unbounded range, and property calculate the rangeEnd
     9        to pass into ParsedContentRange.
     10
     11        * NetworkProcess/NetworkDataTaskBlob.cpp:
     12        (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
     13
    1142022-03-22  Miguel Gomez  <magomez@igalia.com>
    215
  • trunk/Source/WebKit/NetworkProcess/NetworkDataTaskBlob.cpp

    r289018 r291622  
    271271        addCrossOriginEmbedderPolicyHeaders(response, m_blobData->policyContainer().crossOriginEmbedderPolicy);
    272272
    273         if (isRangeRequest)
    274             response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, m_rangeEnd, m_totalSize).headerValue());
     273        if (isRangeRequest) {
     274            auto rangeEnd = m_rangeEnd;
     275            if (rangeEnd == kPositionNotSpecified)
     276                rangeEnd = m_totalSize - 1;
     277
     278            response.setHTTPHeaderField(HTTPHeaderName::ContentRange, ParsedContentRange(m_rangeOffset, rangeEnd, m_totalSize).headerValue());
     279        }
    275280        // FIXME: If a resource identified with a blob: URL is a File object, user agents must use that file's name attribute,
    276281        // as if the response had a Content-Disposition header with the filename parameter set to the File's name attribute.
Note: See TracChangeset for help on using the changeset viewer.