Force to IPv4

pull/4/head
Lloyd Sparkes 9 years ago
parent d68abc746c
commit f807e44a39

@ -32,14 +32,17 @@ namespace NzbDrone.Common.Http.Dispatchers
if (request.Proxy != null && !request.Proxy.ShouldProxyBeBypassed(new Uri(request.Url.FullUri)))
{
var proxyHost = request.Proxy.Host;
if(request.Proxy.Host == "localhost")
var addresses = Dns.GetHostAddresses(request.Proxy.Host);
if(addresses.Length > 1)
{
proxyHost = "127.0.0.1";
var ipv4Only = addresses.Where(a => a.AddressFamily == AddressFamily.InterNetwork);
if (ipv4Only.Any())
{
addresses = ipv4Only.ToArray();
}
}
var addresses = Dns.GetHostAddresses(proxyHost);
var socksUsername = request.Proxy.Username == null ? string.Empty : request.Proxy.Username;
var socksPassword = request.Proxy.Password == null ? string.Empty : request.Proxy.Password;

Loading…
Cancel
Save