Remove SSL cancellation workaround from SocketsHttpHandler (dotnet/corefx#37990)
authorStephen Toub <stoub@microsoft.com>
Wed, 29 May 2019 15:30:52 +0000 (11:30 -0400)
committerGitHub <noreply@github.com>
Wed, 29 May 2019 15:30:52 +0000 (11:30 -0400)
Both sockets cancellation and SslStream auth cancellation have been implemented.

Commit migrated from https://github.com/dotnet/corefx/commit/46800900077920534038be00d7bc73236e1a5fa7

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectHelper.cs

index 2f7d99e..a154cac 100644 (file)
@@ -158,8 +158,6 @@ namespace System.Net.Http
         {
             SslStream sslStream = new SslStream(stream);
 
-            // TODO #25206 and #24430: Register/IsCancellationRequested should be removable once SslStream auth and sockets respect cancellation.
-            CancellationTokenRegistration ctr = cancellationToken.Register(s => ((Stream)s).Dispose(), stream);
             try
             {
                 await sslStream.AuthenticateAsClientAsync(sslOptions, cancellationToken).ConfigureAwait(false);
@@ -175,10 +173,6 @@ namespace System.Net.Http
 
                 throw new HttpRequestException(SR.net_http_ssl_connection_failed, e);
             }
-            finally
-            {
-                ctr.Dispose();
-            }
 
             // Handle race condition if cancellation happens after SSL auth completes but before the registration is disposed
             if (cancellationToken.IsCancellationRequested)