fix: fixing use of new c# in 2020 (#3507)

* fix: fixing use of new c# in 2020

* fixing doc comment
This commit is contained in:
James Frowen 2023-06-09 19:09:16 +01:00 committed by GitHub
parent 176a2d3b66
commit bd66be3d1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,6 @@ public override string ToString()
/// Gets the address based on the <see cref="request"/> and RemoteEndPoint
/// <para>Called after ServerHandShake is accepted</para>
/// </summary>
/// <exception cref="NotImplementedException"></exception>
internal string CalculateAddress()
{
if (request.Headers.TryGetValue("X-Forwarded-For", out string forwardFor))

View File

@ -10,6 +10,7 @@ namespace Mirror.SimpleWeb
public class Request
{
private static readonly char[] lineSplitChars = new char[] { '\r', '\n' };
private static readonly char[] headerSplitChars = new char[] { ':' };
public string RequestLine;
public Dictionary<string, string> Headers = new Dictionary<string, string>();
@ -18,7 +19,7 @@ public Request(string message)
string[] all = message.Split(lineSplitChars, StringSplitOptions.RemoveEmptyEntries);
RequestLine = all.First();
Headers = all.Skip(1)
.Select(header => header.Split(':', 2, StringSplitOptions.RemoveEmptyEntries))
.Select(header => header.Split(headerSplitChars, 2, StringSplitOptions.RemoveEmptyEntries))
.ToDictionary(split => split[0].Trim(), split => split[1].Trim());
}
}