Merge pull request #5602 from Ullmie02/IP-string-IP

This commit is contained in:
Bond-009
2021-04-03 00:32:43 +02:00
committed by GitHub
9 changed files with 92 additions and 42 deletions

View File

@@ -25,7 +25,7 @@ namespace MediaBrowser.Common.Extensions
/// </summary>
/// <param name="context">The HTTP context.</param>
/// <returns>The remote caller IP address.</returns>
public static string GetNormalizedRemoteIp(this HttpContext context)
public static IPAddress GetNormalizedRemoteIp(this HttpContext context)
{
// Default to the loopback address if no RemoteIpAddress is specified (i.e. during integration tests)
var ip = context.Connection.RemoteIpAddress ?? IPAddress.Loopback;
@@ -35,7 +35,7 @@ namespace MediaBrowser.Common.Extensions
ip = ip.MapToIPv4();
}
return ip.ToString();
return ip;
}
}
}