add ipv6 listener prefix

This commit is contained in:
GHXX 2024-01-31 05:00:27 +01:00
parent 0bfe34ab6b
commit f14294387e

View File

@ -24,12 +24,13 @@ public sealed class HttpServer {
conf = configuration; conf = configuration;
listener = new HttpListener(); listener = new HttpListener();
listener.Prefixes.Add($"http://localhost:{port}/"); listener.Prefixes.Add($"http://localhost:{port}/");
listener.Prefixes.Add($"http://[::1]:{port}/");
mainLogger = new(LogOutputTopic.Main, conf); mainLogger = new(LogOutputTopic.Main, conf);
requestLogger = new(LogOutputTopic.Request, conf); requestLogger = new(LogOutputTopic.Request, conf);
} }
public void Start() { public void Start() {
mainLogger.Information($"Starting on port {Port}..."); mainLogger.Information($"Starting on port {Port} (IPv4+IPv6)...");
Assert(listenerTask == null, "Server was already started!"); Assert(listenerTask == null, "Server was already started!");
listener.Start(); listener.Start();
listenerTask = Task.Run(GetContextLoopAsync); listenerTask = Task.Run(GetContextLoopAsync);