From 025741e8ffdf873382214e5b6cd26fdb39d10425 Mon Sep 17 00:00:00 2001 From: ami-GS <1991.daiki@gmail.com> Date: Fri, 15 Nov 2024 11:50:06 -0800 Subject: [PATCH] Remove string hardcoding --- src/cs/tool/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cs/tool/Program.cs b/src/cs/tool/Program.cs index 4b4f7f2763..b77b570163 100644 --- a/src/cs/tool/Program.cs +++ b/src/cs/tool/Program.cs @@ -32,6 +32,7 @@ static unsafe void Main(string[] args) } var ApiTable = MsQuic.Open(); + const string DomainName = "google.com"; QUIC_HANDLE* registration = null; QUIC_HANDLE* configuration = null; QUIC_HANDLE* connection = null; @@ -55,7 +56,7 @@ static unsafe void Main(string[] args) MsQuic.ThrowIfFailure(ApiTable->ConfigurationLoadCredential(configuration, &config)); MsQuic.ThrowIfFailure(ApiTable->ConnectionOpen(registration, &NativeCallback, ApiTable, &connection)); sbyte* google = stackalloc sbyte[50]; - int written = Encoding.UTF8.GetBytes("google.com", new Span(google, 50)); + int written = Encoding.UTF8.GetBytes(DomainName, new Span(google, 50)); google[written] = 0; MsQuic.ThrowIfFailure(ApiTable->ConnectionStart(connection, configuration, 0, google, 443)); Thread.Sleep(1000);