This commit is contained in:
BaronGreenback 2021-01-19 19:29:51 +00:00
parent 9db8a4d88d
commit ab632b96fe

View File

@ -200,7 +200,7 @@ namespace Jellyfin.Server.Extensions
} }
else else
{ {
ParseList(config, config.KnownProxies, options); AddProxyAddresses(config, config.KnownProxies, options);
} }
// Only set forward limit if we have some known proxies or some known networks. // Only set forward limit if we have some known proxies or some known networks.
@ -322,20 +322,20 @@ namespace Jellyfin.Server.Extensions
} }
/// <summary> /// <summary>
/// Sets up the proxy configuration based on the addresses in <paramref name="userList"/>. /// Sets up the proxy configuration based on the addresses in <paramref name="allowedProxies"/>.
/// </summary> /// </summary>
/// <param name="config">The <see cref="NetworkConfiguration"/> containing the config settings.</param> /// <param name="config">The <see cref="NetworkConfiguration"/> containing the config settings.</param>
/// <param name="userList">The string array to parse.</param> /// <param name="allowedProxies">The string array to parse.</param>
/// <param name="options">The <see cref="ForwardedHeadersOptions"/> instance.</param> /// <param name="options">The <see cref="ForwardedHeadersOptions"/> instance.</param>
internal static void ParseList(NetworkConfiguration config, string[] userList, ForwardedHeadersOptions options) internal static void AddProxyAddresses(NetworkConfiguration config, string[] allowedProxies, ForwardedHeadersOptions options)
{ {
for (var i = 0; i < userList.Length; i++) for (var i = 0; i < allowedProxies.Length; i++)
{ {
if (IPNetAddress.TryParse(userList[i], out var addr)) if (IPNetAddress.TryParse(allowedProxies[i], out var addr))
{ {
AddIpAddress(config, options, addr.Address, addr.PrefixLength); AddIpAddress(config, options, addr.Address, addr.PrefixLength);
} }
else if (IPHost.TryParse(userList[i], out var host)) else if (IPHost.TryParse(allowedProxies[i], out var host))
{ {
foreach (var address in host.GetAddresses()) foreach (var address in host.GetAddresses())
{ {