Ensure that CancellationToken is propagated to built-in request content types (dotnet...
authorStephen Toub <stoub@microsoft.com>
Mon, 15 Jul 2019 20:17:56 +0000 (16:17 -0400)
committerGitHub <noreply@github.com>
Mon, 15 Jul 2019 20:17:56 +0000 (16:17 -0400)
commitd2c2aba33e2f6d699fe49698afc411cdd607ad2e
tree751cfc30d650553b8f0d531f9d9cc433c2a1afb9
parent1f8420b4162e55f28ebd6bcf17592fc390def3e5
Ensure that CancellationToken is propagated to built-in request content types (dotnet/corefx#39474)

* Ensure that CancellationToken is propagated to built-in request content types

We don't currently expose the overload that would allow CancellationToken to be accessed by HttpContent-derived types in general, but we can at least ensure that when using the built-in content types, the CancellationToken provided to SendAsync is appropriately threaded through.  We were doing this previously in only a few cases, where we knew that the previous overload wouldn't be overridden (namely internal types and sealed types), but we can enable the 90% scenario as well by doing a type check at run-time.

* Disable cancellation test for UAP handler

Commit migrated from https://github.com/dotnet/corefx/commit/450f49a1a80663529b31d3defafbd5e59822a16a
src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
src/libraries/System.Net.Http/src/System/Net/Http/ByteArrayContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/FormUrlEncodedContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/MultipartContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/MultipartFormDataContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/StreamContent.cs
src/libraries/System.Net.Http/src/System/Net/Http/StreamToStreamCopy.cs
src/libraries/System.Net.Http/src/System/Net/Http/StringContent.cs
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Cancellation.cs