fix processing of TLS renegotiation (#88511)
authorTomas Weinfurt <tweinfurt@yahoo.com>
Mon, 10 Jul 2023 15:48:14 +0000 (08:48 -0700)
committerGitHub <noreply@github.com>
Mon, 10 Jul 2023 15:48:14 +0000 (08:48 -0700)
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.IO.cs

index d7438c0..f2c4207 100644 (file)
@@ -865,17 +865,16 @@ namespace System.Net.Security
                                 throw new IOException(SR.net_ssl_io_renego);
                             }
                             await ReplyOnReAuthenticationAsync<TIOAdapter>(extraBuffer, cancellationToken).ConfigureAwait(false);
-                            // Loop on read.
-                            continue;
                         }
-
-                        if (status.ErrorCode == SecurityStatusPalErrorCode.ContextExpired)
+                        else if (status.ErrorCode == SecurityStatusPalErrorCode.ContextExpired)
                         {
                             _receivedEOF = true;
                             break;
                         }
-
-                        throw new IOException(SR.net_io_decrypt, SslStreamPal.GetException(status));
+                        else
+                        {
+                            throw new IOException(SR.net_io_decrypt, SslStreamPal.GetException(status));
+                        }
                     }
 
                     if (_buffer.DecryptedLength > 0)