mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 17:24:46 +03:00
authorizationheader as readonlyspan<char> instead of string
This commit is contained in:
@@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||||||
|
|
||||||
// Remove up until the first space
|
// Remove up until the first space
|
||||||
authorizationHeader = authorizationHeader[(firstSpace + 1)..];
|
authorizationHeader = authorizationHeader[(firstSpace + 1)..];
|
||||||
return GetParts(authorizationHeader.ToString());
|
return GetParts(authorizationHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -273,7 +273,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="authorizationHeader">The authorization header.</param>
|
/// <param name="authorizationHeader">The authorization header.</param>
|
||||||
/// <returns>string</returns>
|
/// <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 result = new Dictionary<string, string>();
|
||||||
var escaped = false;
|
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
|
// Meeting a comma after a closing escape char means the value is complete
|
||||||
if (start < i)
|
if (start < i)
|
||||||
{
|
{
|
||||||
result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"'));
|
result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"').ToString());
|
||||||
key = string.Empty;
|
key = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||||||
}
|
}
|
||||||
else if (!escaped && token == '=')
|
else if (!escaped && token == '=')
|
||||||
{
|
{
|
||||||
key = authorizationHeader[start.. i];
|
key = authorizationHeader[start.. i].ToString();
|
||||||
start = i + 1;
|
start = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||||||
// Add last value
|
// Add last value
|
||||||
if (start < i)
|
if (start < i)
|
||||||
{
|
{
|
||||||
result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"'));
|
result[key] = WebUtility.UrlDecode(authorizationHeader[start..i].Trim('"').ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user