Skip to content

Commit 6a4edeb

Browse files
liveansCopilot
andcommitted
Use EnumerateSupportedProtocols mask overload to filter Ssl3 on macOS
The helper already accepts a mask, so express the macOS Ssl3 filter as ~SslProtocols.Ssl3 instead of an open-coded if inside the loop. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 092d7f4 commit 6a4edeb

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamAlertsTest.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,14 @@ private bool FailClientCertificate(object sender, X509Certificate certificate, X
380380

381381
public static IEnumerable<object[]> SupportedSslProtocolsExcludingMacOSSsl3()
382382
{
383-
foreach (SslProtocols protocol in SslProtocolSupport.EnumerateSupportedProtocols())
384-
{
385383
#pragma warning disable 0618 // SSL2/3 are deprecated
386-
if (PlatformDetection.IsOSX && protocol == SslProtocols.Ssl3)
387-
{
388-
// SecureTransport on modern macOS no longer negotiates SSL 3.0; skip rather
389-
// than silently pass so the xunit runner reports the data point as filtered.
390-
continue;
391-
}
384+
// SecureTransport on modern macOS won't negotiate SSL 3.0, so handshakes hang
385+
// until they time out. Mask Ssl3 out on macOS so xunit reports the data point
386+
// as filtered rather than silently passing.
387+
SslProtocols mask = PlatformDetection.IsOSX ? ~SslProtocols.Ssl3 : (SslProtocols)~0;
392388
#pragma warning restore 0618
389+
foreach (SslProtocols protocol in SslProtocolSupport.EnumerateSupportedProtocols(mask))
390+
{
393391
yield return new object[] { protocol };
394392
}
395393
}

0 commit comments

Comments
 (0)