1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Force to IPv4

This commit is contained in:
Lloyd Sparkes 2016-04-24 17:01:01 +01:00
parent d68abc746c
commit f807e44a39

View File

@ -32,13 +32,16 @@ public HttpResponse GetResponse(HttpRequest request, CookieContainer cookies)
if (request.Proxy != null && !request.Proxy.ShouldProxyBeBypassed(new Uri(request.Url.FullUri))) if (request.Proxy != null && !request.Proxy.ShouldProxyBeBypassed(new Uri(request.Url.FullUri)))
{ {
var proxyHost = request.Proxy.Host; var addresses = Dns.GetHostAddresses(request.Proxy.Host);
if(request.Proxy.Host == "localhost")
{
proxyHost = "127.0.0.1";
}
var addresses = Dns.GetHostAddresses(proxyHost); if(addresses.Length > 1)
{
var ipv4Only = addresses.Where(a => a.AddressFamily == AddressFamily.InterNetwork);
if (ipv4Only.Any())
{
addresses = ipv4Only.ToArray();
}
}
var socksUsername = request.Proxy.Username == null ? string.Empty : request.Proxy.Username; var socksUsername = request.Proxy.Username == null ? string.Empty : request.Proxy.Username;
var socksPassword = request.Proxy.Password == null ? string.Empty : request.Proxy.Password; var socksPassword = request.Proxy.Password == null ? string.Empty : request.Proxy.Password;