aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
diff options
context:
space:
mode:
authorTommaso Stocchi <tommasostocchi@outlook.com>2021-06-03 17:10:19 +0200
committerTommaso Stocchi <tommasostocchi@outlook.com>2021-06-03 17:10:19 +0200
commit3c019d1324c6ec29bf96aab28b94208924bb317f (patch)
treefc34a1b859a4e1bcc79b623a4c9aa4216d0514e0 /Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
parent414e918c01a2458aa28c654332a8bad4f79cfa90 (diff)
Using for instead of while
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs')
-rw-r--r--Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
index 7a83b7213..26f3b8d68 100644
--- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
@@ -276,16 +276,15 @@ namespace Emby.Server.Implementations.HttpServer.Security
public static Dictionary<string, string> GetParts(string authtorizationHeader)
{
var result = new Dictionary<string, string>();
- var escapeChars = new[] { '"', ',' };
var escaped = false;
int start = 0;
- int i = 0;
string key = string.Empty;
- while (i < authtorizationHeader.Length)
+ int i;
+ for (i = 0; i < authtorizationHeader.Length; i++)
{
var token = authtorizationHeader[i];
- if (escapeChars.Contains(token))
+ if (token == '"' || token == ',')
{
// Applying a XOR logic to evaluate whether it is opening or closing a value
escaped = (!escaped) == (token == '"');
@@ -306,8 +305,6 @@ namespace Emby.Server.Implementations.HttpServer.Security
key = authtorizationHeader[start.. i];
start = i + 1;
}
-
- i++;
}
// Add last value