This commit is contained in:
Mateleo 2024-11-22 21:35:36 +01:00
parent 890834d849
commit 39cbd2d1da

View File

@ -355,19 +355,12 @@ namespace DiIiS_NA.LoginServer.Base
private static string GetWebSocketLocation(IChannelPipeline cp, IHttpRequest req, string path) private static string GetWebSocketLocation(IChannelPipeline cp, IHttpRequest req, string path)
{ {
string str = "ws"; string protocol = cp.Get<TlsHandler>() != null ? "wss" : "ws";
if (cp.Get<TlsHandler>() != null)
{
str = "wss";
}
string str2 = null; // Ignore the Host header and default to a placeholder or IP address
if (req.Headers.TryGet(HttpHeaderNames.Host, out ICharSequence value)) string host = "192.168.1.100"; // Replace with your desired default host, e.g., the server's IP or DNS.
{
str2 = value.ToString();
}
return str + "://" + str2 + path; return $"{protocol}://{host}{path}";
} }
} }
} }