This commit is contained in:
Michael Becker 2024-11-19 22:36:56 -05:00
parent 0054320a0e
commit e6b974f651
3 changed files with 13 additions and 4 deletions

View File

@ -52,7 +52,7 @@ public class WebRequest
{ {
Query[key] = new List<string>(); Query[key] = new List<string>();
} }
Query[key].Add(nameValue[1].UrlDecode()); Query[key].Add(UrlAndFormDecode(nameValue[1]));
} }
else else
{ {
@ -69,4 +69,11 @@ public class WebRequest
PathVariables = pathVariables; PathVariables = pathVariables;
Form = new ReadOnlyDictionary<string, string>(form); Form = new ReadOnlyDictionary<string, string>(form);
} }
private string UrlAndFormDecode(string v)
{
v = v.Replace('+', ' '); // must be done first to not decode '%..' => ' '
v = v.UrlDecode();
return v;
}
} }

View File

@ -197,7 +197,7 @@ public class WebServer
} }
else else
{ {
Console.WriteLine("MBS.Web.WebServer: !! NOT using SSL !!"); // Console.WriteLine("MBS.Web.WebServer: !! NOT using SSL !!");
} }
StreamReader sr = new StreamReader(st); StreamReader sr = new StreamReader(st);
@ -371,7 +371,7 @@ public class WebServer
{ {
if (parm is System.Net.Sockets.TcpClient client) if (parm is System.Net.Sockets.TcpClient client)
{ {
Console.WriteLine("Client connected"); // Console.WriteLine("Client connected");
try try
{ {
@ -431,7 +431,7 @@ public class WebServer
} }
else else
{ {
Console.WriteLine("MBS.Web.WebServer: !! NOT using SSL !!"); // Console.WriteLine("MBS.Web.WebServer: !! NOT using SSL !!");
} }
tServer = new Thread(tServer_ThreadStart); tServer = new Thread(tServer_ThreadStart);

View File

@ -8,12 +8,14 @@ namespace MBS.Web;
public class WebServerProcessRequestEventArgs : EventArgs public class WebServerProcessRequestEventArgs : EventArgs
{ {
public WebServer Server { get; } public WebServer Server { get; }
public System.Net.Sockets.TcpClient Client { get; }
public WebContext Context { get; } public WebContext Context { get; }
public bool Handled { get; set; } = false; public bool Handled { get; set; } = false;
public WebServerProcessRequestEventArgs(WebServer server, System.Net.Sockets.TcpClient client, WebContext context) public WebServerProcessRequestEventArgs(WebServer server, System.Net.Sockets.TcpClient client, WebContext context)
{ {
Server = server; Server = server;
Client = client;
Context = context; Context = context;
} }