Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 17:14:09 +0000 (17:14 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 17:14:09 +0000 (17:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175872

Reviewed by Daniel Bates.

r221059 was calling the ResponseCompletionHandler with {} which ended up being
PolicyUse. Since this is an error case and do not want to receive the data, it
makes more sense to use PolicyIgnore instead. There should not be a behavior
change on WebKit side though since we are cancelling the load right after
calling the completion handler anyway.

Tests under http/tests/security/http-0.9/ are still passing.

* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::didReceiveResponse):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221081 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkDataTask.cpp

index 4b0e15e..83ca612 100644 (file)
@@ -1,3 +1,21 @@
+2017-08-23  Chris Dumez  <cdumez@apple.com>
+
+        Regression(r221059): NetworkDataTask::didReceiveResponse() should not use PolicyUse for HTTP/0.9
+        https://bugs.webkit.org/show_bug.cgi?id=175872
+
+        Reviewed by Daniel Bates.
+
+        r221059 was calling the ResponseCompletionHandler with {} which ended up being
+        PolicyUse. Since this is an error case and do not want to receive the data, it
+        makes more sense to use PolicyIgnore instead. There should not be a behavior
+        change on WebKit side though since we are cancelling the load right after
+        calling the completion handler anyway.
+
+        Tests under http/tests/security/http-0.9/ are still passing.
+
+        * NetworkProcess/NetworkDataTask.cpp:
+        (WebKit::NetworkDataTask::didReceiveResponse):
+
 2017-08-22  Tim Horton  <timothy_horton@apple.com>
 
         _WKThumbnailView should use the screen color space instead of sRGB
index a033dc4..eaae3da 100644 (file)
@@ -103,7 +103,7 @@ void NetworkDataTask::didReceiveResponse(ResourceResponse&& response, ResponseCo
         auto url = response.url();
         std::optional<uint16_t> port = url.port();
         if (port && !isDefaultPortForProtocol(port.value(), url.protocol())) {
-            completionHandler({ });
+            completionHandler(PolicyIgnore);
             cancel();
             m_client->didCompleteWithError({ String(), 0, url, "Cancelled load from '" + url.stringCenterEllipsizedToLength() + "' because it is using HTTP/0.9." });
             return;