Remove conversion from IPAddress to string to IPAddress

This commit is contained in:
David
2021-03-23 17:16:10 +01:00
parent 8410a9a266
commit 19e4ef82dd
7 changed files with 28 additions and 15 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;
}
}
}