镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ private async ValueTask FinishConnectAsync(QuicClientConnectionOptions options,

// RFC 6066 forbids IP literals.
// IDN mapping is handled by MsQuic.
string sni = (TargetHostNameHelper.IsValidAddress(options.ClientAuthenticationOptions.TargetHost) ? null : options.ClientAuthenticationOptions.TargetHost) ?? host ?? string.Empty;
string? sni = (TargetHostNameHelper.IsValidAddress(options.ClientAuthenticationOptions.TargetHost) ? null : options.ClientAuthenticationOptions.TargetHost) ?? host;

IntPtr targetHostPtr = Marshal.StringToCoTaskMemUTF8(sni);
IntPtr targetHostPtr = !string.IsNullOrEmpty(sni) ? Marshal.StringToCoTaskMemUTF8(sni) : IntPtr.Zero;
try
{
unsafe
Expand All @@ -421,7 +421,10 @@ private async ValueTask FinishConnectAsync(QuicClientConnectionOptions options,
}
finally
{
Marshal.FreeCoTaskMem(targetHostPtr);
if (targetHostPtr != IntPtr.Zero)
{
Marshal.FreeCoTaskMem(targetHostPtr);
}
}
}

Expand Down
Loading