Title: [289502] trunk
Revision
289502
Author
eric.carl...@apple.com
Date
2022-02-09 14:55:59 -0800 (Wed, 09 Feb 2022)

Log Message

WKWebView: WKURLSchemeHandler “request to the end of the resource” produces an invalid header
https://bugs.webkit.org/show_bug.cgi?id=236401
rdar://88528286

Reviewed by Brent Fulgham.

Source/WebCore:


https://webkit.org/b/203302 added support for Range requests to AVAssetResourceLoadingDataRequest,
but it incorrectly used '*' instead of '' for "last-byte-pos:" for a request to the end of the resource.

API test URLSchemeHandler.Ranges was updated.

* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
(WebCore::WebCoreAVFResourceLoader::startLoading):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289501 => 289502)


--- trunk/Source/WebCore/ChangeLog	2022-02-09 22:02:16 UTC (rev 289501)
+++ trunk/Source/WebCore/ChangeLog	2022-02-09 22:55:59 UTC (rev 289502)
@@ -1,3 +1,21 @@
+2022-02-09  Eric Carlson  <eric.carl...@apple.com>
+
+        WKWebView: WKURLSchemeHandler “request to the end of the resource” produces an invalid header
+        https://bugs.webkit.org/show_bug.cgi?id=236401
+        rdar://88528286
+
+        Reviewed by Brent Fulgham.
+
+        Patch by Jer Noble.
+
+        https://webkit.org/b/203302 added support for Range requests to AVAssetResourceLoadingDataRequest,
+        but it incorrectly used '*' instead of '' for "last-byte-pos:" for a request to the end of the resource.
+
+        API test URLSchemeHandler.Ranges was updated.
+
+        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
+        (WebCore::WebCoreAVFResourceLoader::startLoading):
+
 2022-02-09  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Vertical writing mode with RTL text content has incorrect advances

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (289501 => 289502)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2022-02-09 22:02:16 UTC (rev 289501)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2022-02-09 22:55:59 UTC (rev 289502)
@@ -288,7 +288,7 @@
 
     if (AVAssetResourceLoadingDataRequest *dataRequest = [m_avRequest dataRequest]; dataRequest.requestedLength
         && !request.hasHTTPHeaderField(HTTPHeaderName::Range)) {
-        String rangeEnd = dataRequest.requestsAllDataToEndOfResource ? "*"_s : makeString(dataRequest.requestedOffset + dataRequest.requestedLength - 1);
+        String rangeEnd = dataRequest.requestsAllDataToEndOfResource ? emptyString() : makeString(dataRequest.requestedOffset + dataRequest.requestedLength - 1);
         request.addHTTPHeaderField(HTTPHeaderName::Range, makeString("bytes=", dataRequest.requestedOffset, '-', rangeEnd));
     }
 

Modified: trunk/Tools/ChangeLog (289501 => 289502)


--- trunk/Tools/ChangeLog	2022-02-09 22:02:16 UTC (rev 289501)
+++ trunk/Tools/ChangeLog	2022-02-09 22:55:59 UTC (rev 289502)
@@ -1,3 +1,13 @@
+2022-02-09  Eric Carlson  <eric.carl...@apple.com>
+
+        WKWebView: WKURLSchemeHandler “request to the end of the resource” produces an invalid header
+        https://bugs.webkit.org/show_bug.cgi?id=236401
+        rdar://88528286
+
+        Reviewed by Brent Fulgham.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:
+
 2022-02-09  J Pascoe  <j_pas...@apple.com>
 
         [WebAuthn] Specify LocalAuthenticatorAccessGroup when importing credentials

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm (289501 => 289502)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm	2022-02-09 22:02:16 UTC (rev 289501)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm	2022-02-09 22:55:59 UTC (rev 289502)
@@ -1606,7 +1606,7 @@
         auto rangeBeginString = requestRangeString.substring(begin + rangeBytes.length(), dash - begin - rangeBytes.length());
         auto rangeEndString = requestRangeString.substring(dash + 1, end - dash - 1);
         auto rangeBegin = parseInteger<uint64_t>(rangeBeginString).value_or(0);
-        auto rangeEnd = rangeEndString == "*" ? [videoData length] - 1 : parseInteger<uint64_t>(rangeEndString).value_or(0);
+        auto rangeEnd = rangeEndString.isEmpty() ? [videoData length] - 1 : parseInteger<uint64_t>(rangeEndString).value_or(0);
         auto contentLength = rangeEnd - rangeBegin + 1;
 
         auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"https://webkit.org/"] statusCode:206 HTTPVersion:@"HTTP/1.1" headerFields:@{
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to