1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-27 23:06:29 -04:00

Build Sonarr on Net6

Co-Authored-By: ta264 <ta264@users.noreply.github.com>
This commit is contained in:
Qstick
2021-07-30 00:47:53 -04:00
committed by Mark McDowall
parent f79ae77a3a
commit 878d1561aa
222 changed files with 3643 additions and 5311 deletions
@@ -105,10 +105,23 @@ namespace Sonarr.Http.Extensions
}
var remoteAddress = context.Request.UserHostAddress;
IPAddress remoteIP;
IPAddress.TryParse(remoteAddress, out IPAddress remoteIP);
if (remoteIP == null)
{
return remoteAddress;
}
if (remoteIP.IsIPv4MappedToIPv6)
{
remoteIP = remoteIP.MapToIPv4();
}
remoteAddress = remoteIP.ToString();
// Only check if forwarded by a local network reverse proxy
if (IPAddress.TryParse(remoteAddress, out remoteIP) && remoteIP.IsLocalAddress())
if (remoteIP.IsLocalAddress())
{
var realIPHeader = context.Request.Headers["X-Real-IP"];
if (realIPHeader.Any())