Skip to content

Commit 9291a78

Browse files
authored
skip unnecesary ALPN processing on Windows (#69103)
1 parent 6c12de6 commit 9291a78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static SecurityStatusPal AcceptSecurityContext(
6565
inputBuffers.SetNextBuffer(new InputSecurityBuffer(inputBuffer, SecurityBufferType.SECBUFFER_TOKEN));
6666
inputBuffers.SetNextBuffer(new InputSecurityBuffer(default, SecurityBufferType.SECBUFFER_EMPTY));
6767

68-
if (sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0)
68+
if (context == null && sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0)
6969
{
7070
byte[] alpnBytes = ConvertAlpnProtocolListToByteArray(sslAuthenticationOptions.ApplicationProtocols);
7171
inputBuffers.SetNextBuffer(new InputSecurityBuffer(new ReadOnlySpan<byte>(alpnBytes), SecurityBufferType.SECBUFFER_APPLICATION_PROTOCOLS));
@@ -101,7 +101,7 @@ public static SecurityStatusPal InitializeSecurityContext(
101101
InputSecurityBuffers inputBuffers = default;
102102
inputBuffers.SetNextBuffer(new InputSecurityBuffer(inputBuffer, SecurityBufferType.SECBUFFER_TOKEN));
103103
inputBuffers.SetNextBuffer(new InputSecurityBuffer(default, SecurityBufferType.SECBUFFER_EMPTY));
104-
if (sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0)
104+
if (context == null && sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0)
105105
{
106106
byte[] alpnBytes = ConvertAlpnProtocolListToByteArray(sslAuthenticationOptions.ApplicationProtocols);
107107
inputBuffers.SetNextBuffer(new InputSecurityBuffer(new ReadOnlySpan<byte>(alpnBytes), SecurityBufferType.SECBUFFER_APPLICATION_PROTOCOLS));

0 commit comments

Comments
 (0)