diff --git a/Program.cs b/Program.cs index fbc499a..de49e70 100644 --- a/Program.cs +++ b/Program.cs @@ -1729,8 +1729,29 @@ namespace TYTD } public static void RootPath(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary args) { - string p = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0]; - string path = $"WebSite/{p}"; + string[] p0 = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries); + string p = p0[0]; + args.Clear(); + if (p0.Length >= 2) + { + foreach (var item in p0[1].Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries)) + { + var sub = item.Split(new char[] { '=' }); + if (sub.Length == 2) + { + if (!args.ContainsKey(sub[0])) + args.Add(sub[0], sub[1]); + } + else + { + if (!args.ContainsKey(sub[0])) + args.Add(sub[0], ""); + } + } + } + + + string path =$"WebSite/{p}"; if (Directory.Exists(path)) { string indexHtml = Path.Combine(path, "index.html");