diff options
| author | Tommaso Stocchi <tommasostocchi@outlook.com> | 2021-06-03 17:43:50 +0200 |
|---|---|---|
| committer | Tommaso Stocchi <tommasostocchi@outlook.com> | 2021-06-03 17:43:50 +0200 |
| commit | 2a72c33ba6ef257aff23c5281c9276d7a0258024 (patch) | |
| tree | 035311cb2e3c17aef7dd41643165dca05ad547a7 | |
| parent | d1b34a1e9797f4d6bbfe104bed5c42bdc953a692 (diff) | |
authorizationheader as readonlyspan<char> instead of string
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index f0a706ff5..7b9f72efd 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.HttpServer.Security // Remove up until the first space authorizationHeader = authorizationHeader[(firstSpace + 1)..]; - return GetParts(authorizationHeader.ToString()); + return GetParts(authorizationHeader); } /// <summary> @@ -273,7 +273,7 @@ namespace Emby.Server.Implementations.HttpServer.Security /// </summary> /// <param name="authorizationHeader">The authorization header.</param> /// <returns>string</returns> - public static Dictionary<string, string> GetParts(string authorizationHeader) + public static Dictionary<string, string> GetParts(ReadOnlySpan<char> authorizationHeader) { var result = new Dictionary<string, string>(); var escaped = false; @@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.HttpServer.Security // Meeting a comma after a closing escape char means the value is complete if (start < i) { - result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"')); + result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"').ToString()); key = string.Empty; } @@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.HttpServer.Security } else if (!escaped && token == '=') { - key = authorizationHeader[start.. i]; + key = authorizationHeader[start.. i].ToString(); start = i + 1; } } @@ -310,7 +310,7 @@ namespace Emby.Server.Implementations.HttpServer.Security // Add last value if (start < i) { - result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"')); + result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"').ToString()); } return result; |
