fix parameter url decoding
This commit is contained in:
@@ -187,14 +187,15 @@ public sealed class HttpServer {
|
|||||||
|
|
||||||
private async Task ProcessRequestAsync(HttpListenerContext ctx) {
|
private async Task ProcessRequestAsync(HttpListenerContext ctx) {
|
||||||
using RequestContext rc = new RequestContext(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()));
|
var reqPath = NormalizeUrlPath(WebUtility.UrlDecode(splitted.First()));
|
||||||
string requestMethod = ctx.Request.HttpMethod.ToUpperInvariant();
|
string requestMethod = ctx.Request.HttpMethod.ToUpperInvariant();
|
||||||
bool wasStaticlyServed = false;
|
bool wasStaticlyServed = false;
|
||||||
|
|
||||||
void LogRequest() {
|
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 {
|
try {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user