mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-12-29 09:05:28 +01:00
Fixed: Falls back to IP address when DNS resolution is not possible
This commit is contained in:
@@ -165,9 +165,16 @@ namespace Prowlarr.Http.Extensions
|
||||
{
|
||||
string ip = request.GetRemoteIP();
|
||||
IPAddress myIP = IPAddress.Parse(ip);
|
||||
IPHostEntry getIPHost = Dns.GetHostEntry(myIP);
|
||||
List<string> compName = getIPHost.HostName.ToString().Split('.').ToList();
|
||||
return compName.First();
|
||||
try
|
||||
{
|
||||
IPHostEntry getIPHost = Dns.GetHostEntry(myIP);
|
||||
List<string> compName = getIPHost.HostName.ToString().Split('.').ToList();
|
||||
return compName.First();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetServerUrl(this HttpRequest request)
|
||||
|
||||
Reference in New Issue
Block a user