2
0

Fix HandleRequest trying to send more than one response

This commit is contained in:
Glax 2024-08-10 21:52:14 +02:00
parent 960d3f7c62
commit fc884adc9f

View File

@ -114,9 +114,15 @@ public partial class Server : GlobalBase, IDisposable
HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response;
if (request.HttpMethod == "OPTIONS")
SendResponse(HttpStatusCode.OK, context.Response); //Response always contains all valid Request-Methods
{
SendResponse(HttpStatusCode.NoContent, response);//Response always contains all valid Request-Methods
return;
}
if (request.Url!.LocalPath.Contains("favicon"))
{
SendResponse(HttpStatusCode.NoContent, response);
return;
}
string path = Regex.Match(request.Url.LocalPath, @"\/[a-zA-Z0-9\.+/=-]+(\/[a-zA-Z0-9\.+/=-]+)*").Value; //Local Path
if (!Regex.IsMatch(path, "/v2(/.*)?")) //Use only v2 API