diff options
| author | Tommaso Stocchi <tommasostocchi@outlook.com> | 2020-12-15 21:06:47 +0100 |
|---|---|---|
| committer | Tommaso Stocchi <tommasostocchi@outlook.com> | 2020-12-15 21:06:47 +0100 |
| commit | 7c7f2316faa36fbdd6044ae27e05823e317d167f (patch) | |
| tree | 155fdc7b7d019cede3cd3a861d68ac38b86d6411 | |
| parent | c6eefaac0975c351cfb20ace1c67d837dc0b7393 (diff) | |
Added comments
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index 74a678aa6..855c61682 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -285,6 +285,11 @@ namespace Emby.Server.Implementations.HttpServer.Security return string.IsNullOrEmpty(value) ? value : WebUtility.UrlDecode(value); } + /// <summary> + /// Get the authorization header components. + /// </summary> + /// <param name="authtorizationHeader">The authorization header.</param> + /// <returns>string</returns> public static string[] GetParts(string authtorizationHeader) { var result = new List<string>(); @@ -301,6 +306,7 @@ namespace Emby.Server.Implementations.HttpServer.Security } else { + // Applying a XOR logic to evaluate wether it is opening or closing a value escaped = (!escaped) == (authtorizationHeaderChars[i] == '"'); if(authtorizationHeaderChars[i] == ',') { @@ -310,6 +316,7 @@ namespace Emby.Server.Implementations.HttpServer.Security } else { + // Meeting a comma after a closing escape char means the value is complete result.Add(new string(value.ToArray())); value = new List<char>(); } |
