[Cocoa] implement URLSession:task:needNewBodyStream: delegate method
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jun 2017 23:51:00 +0000 (23:51 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jun 2017 23:51:00 +0000 (23:51 +0000)
commita05e9b19747a4bc09fd94221ce6697e74db2ef60
tree2ec73b0d7032bdd5dae233e10aad02fc6051453c
parent289e4856042ac6215e23143abfb56ffe95d2ea68
[Cocoa] implement URLSession:task:needNewBodyStream: delegate method
https://bugs.webkit.org/show_bug.cgi?id=173551
rdar://problem/32250512

Source/WebCore:

Reviewed by Alex Christensen.

Covered by http/tests/misc/form-blob-challenge.html

* WebCore.xcodeproj/project.pbxproj: Removed NSURLRequestSPI.h.

* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::createHTTPBodyCFReadStream): Factored this out from setHTTPBody.
(WebCore::setHTTPBody): Factored out the function above.
* platform/network/cf/FormDataStreamCFNet.h: Added createHTTPBodyCFReadStream.

* platform/network/cocoa/ResourceRequestCocoa.mm: Use CFNetworkSPI.h.
* platform/network/ios/ResourceRequestIOS.mm: Ditto.

* platform/network/mac/FormDataStreamMac.h: Added createHTTPBodyNSInputStream.
* platform/network/mac/FormDataStreamMac.mm:
(WebCore::createHTTPBodyNSInputStream): Added/

* platform/network/mac/ResourceHandleMac.mm: Use CFNetworkSPI.h.
* platform/network/mac/ResourceRequestMac.mm: Ditto.
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Ditto.
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: Ditto.

* platform/network/mac/WebCoreURLResponse.h: Moved SPI declarations from
here into CFNetworkSPI.h.

* platform/spi/cf/CFNetworkSPI.h: Use #pragma once, consolidated SPI that was
defined in scattered locations.

* platform/spi/cocoa/NSURLRequestSPI.h: Removed. Superceded by CFNetworkSPI.h.

Source/WebKit2:

Reviewed by Alex Christensen.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate existingTask:]): Added helper method.
(-[WKNetworkSessionDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:]):
Updated to use existingTask: method.
(-[WKNetworkSessionDelegate URLSession:task:needNewBodyStream:]): Added.
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
Updated to use existingTask: method.
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:]): Ditto.
(-[WKNetworkSessionDelegate URLSession:dataTask:didBecomeDownloadTask:]): Ditto.
(WebKit::globalAllowsCellularAccess): Deleted. Just use a normal global.
(WebKit::globalLegacyCustomProtocolManager): Deleted. Just use a normal global.
(WebKit::NetworkSessionCocoa::setLegacyCustomProtocolManager): Updated for normal global.
(WebKit::NetworkSessionCocoa::setAllowsCellularAccess): Ditto.
(WebKit::NetworkSessionCocoa::defaultSession): Ditto.
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa): Ditto.

LayoutTests:

Reviewed by Alex Christensen.

* http/tests/misc/form-blob-challenge-expected.txt: Added.
* http/tests/misc/form-blob-challenge.html: Added.
* http/tests/misc/resources/basic-echo-post.php: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/misc/form-blob-challenge-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/form-blob-challenge.html [new file with mode: 0644]
LayoutTests/http/tests/misc/resources/basic-echo-post.php [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
Source/WebCore/platform/network/cf/FormDataStreamCFNet.h
Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm
Source/WebCore/platform/network/ios/ResourceRequestIOS.mm
Source/WebCore/platform/network/mac/FormDataStreamMac.h
Source/WebCore/platform/network/mac/FormDataStreamMac.mm
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
Source/WebCore/platform/network/mac/WebCoreURLResponse.h
Source/WebCore/platform/spi/cf/CFNetworkSPI.h
Source/WebCore/platform/spi/cocoa/NSURLRequestSPI.h [deleted file]
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm