diff --git a/SimpleHttpServer/HttpServer.cs b/SimpleHttpServer/HttpServer.cs index eff0d0b..a084aa7 100644 --- a/SimpleHttpServer/HttpServer.cs +++ b/SimpleHttpServer/HttpServer.cs @@ -187,14 +187,15 @@ public sealed class HttpServer { private async Task ProcessRequestAsync(HttpListenerContext ctx) { using RequestContext rc = new RequestContext(ctx); - var decUri = WebUtility.UrlDecode(ctx.Request.RawUrl)!; // TODO add path escape countermeasure-unittests - var splitted = decUri.Split('?', 2, StringSplitOptions.None); + + // TODO add path escape countermeasure-unittests + var splitted = (ctx.Request.RawUrl ?? "").Split('?', 2, StringSplitOptions.None); var reqPath = NormalizeUrlPath(WebUtility.UrlDecode(splitted.First())); string requestMethod = ctx.Request.HttpMethod.ToUpperInvariant(); bool wasStaticlyServed = false; void LogRequest() { - requestLogger.Information($"{rc.ListenerContext.Response.StatusCode} {(wasStaticlyServed ? "static" : "endpnt")} {requestMethod} {decUri}"); + requestLogger.Information($"{rc.ListenerContext.Response.StatusCode} {(wasStaticlyServed ? "static" : "endpnt")} {requestMethod} {ctx.Request.Url}"); } try {