[WK2][NetworkSession] Add support for resuming downloads
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 20:29:35 +0000 (20:29 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Oct 2017 20:29:35 +0000 (20:29 +0000)
commitafab07f4ee87b7bf11a026088356df741fc32791
tree412b099fbed63b3fea3ebff065bca96d1dd2efb2
parentf0e4d29ec51d49a331412867254a146b645020c4
[WK2][NetworkSession] Add support for resuming downloads
https://bugs.webkit.org/show_bug.cgi?id=177625
<rdar://problem/34345975>

Reviewed by Alex Christensen.

Add support for resuming downloads for the WK2 NETWORK_SESSION code path.

This was tested manually. I was unable to write an API test because our tests
do not run an HTTP server and CFNetwork does not seem to generate resume data
when cancelling a download over non-HTTP.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::didReceiveChallenge):
(WebKit::Download::continueCanAuthenticateAgainstProtectionSpace):
* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::continueCanAuthenticateAgainstProtectionSpace):
(WebKit::DownloadManager::resumeDownload):
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::resume):
This currently includes a workaround for <rdar://problem/34745171>. We update the
resume data to include the NSURLSessionResumeInfoLocalPath key with the final
destination path so that CFNetwork looks for the temporary data at the right
location.

* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(WebKit::NetworkSessionCocoa::downloadTaskWithResumeData):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
* Shared/Authentication/AuthenticationManager.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@223431 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Downloads/Download.cpp
Source/WebKit/NetworkProcess/Downloads/Download.h
Source/WebKit/NetworkProcess/Downloads/DownloadManager.cpp
Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
Source/WebKit/Shared/Authentication/AuthenticationManager.h