Fixed: (Indexer Proxy) Socks4 and Socks5 not using Credentials

pull/429/head
Qstick 3 years ago
parent 7c1f5f769d
commit b7731faedc

@ -7,9 +7,13 @@ using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.IndexerProxies;
using NzbDrone.Core.Localization;
using NzbDrone.Core.ThingiProvider.Events;
namespace NzbDrone.Core.HealthCheck.Checks
{
[CheckOn(typeof(ProviderDeletedEvent<IIndexerProxy>))]
[CheckOn(typeof(ProviderAddedEvent<IIndexerProxy>))]
[CheckOn(typeof(ProviderUpdatedEvent<IIndexerProxy>))]
public class IndexerProxyCheck : HealthCheckBase
{
private readonly Logger _logger;
@ -37,7 +41,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
var badProxies = enabledProviders.Where(p => !IsProxyWorking(p)).ToList();
if (enabledProviders.Empty())
if (enabledProviders.Empty() || badProxies.Count == 0)
{
return new HealthCheck(GetType());
}

@ -40,19 +40,19 @@ namespace NzbDrone.Core.IndexerProxies
try
{
var response = _httpClient.Execute(request);
var response = PostResponse(_httpClient.Execute(request));
// We only care about 400 responses, other error codes can be ignored
if (response.StatusCode == HttpStatusCode.BadRequest)
{
_logger.Error("Proxy Health Check failed: {0}", response.StatusCode);
failures.Add(new NzbDroneValidationFailure("Host", "ProxyCheckBadRequestMessage"));
failures.Add(new NzbDroneValidationFailure("Host", string.Format("Failed to test proxy. StatusCode: {0}", response.StatusCode)));
}
}
catch (Exception ex)
{
_logger.Error(ex, "Proxy Health Check failed");
failures.Add(new NzbDroneValidationFailure("Host", "ProxyCheckFailedToTestMessage"));
failures.Add(new NzbDroneValidationFailure("Host", string.Format("Failed to test proxy: {0}", request.Url)));
}
return new ValidationResult(failures);

@ -36,17 +36,5 @@ namespace NzbDrone.Core.IndexerProxies
{
return null;
}
private bool HasConcreteImplementation(string methodName)
{
var method = GetType().GetMethod(methodName);
if (method == null)
{
throw new MissingMethodException(GetType().Name, Name);
}
return !method.DeclaringType.IsAbstract;
}
}
}

@ -23,11 +23,11 @@ namespace NzbDrone.Core.IndexerProxies.Socks4
{
if (Settings.Username.IsNotNullOrWhiteSpace() && Settings.Password.IsNotNullOrWhiteSpace())
{
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Four), false);
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Four, Settings.Username, Settings.Password), false);
}
else
{
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Four, Settings.Username, Settings.Password), false);
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Four), false);
}
_logger.Debug("Applying Socks4 Proxy {0} to request {1}", Name, request.Url);

@ -24,11 +24,11 @@ namespace NzbDrone.Core.IndexerProxies.Socks5
{
if (Settings.Username.IsNotNullOrWhiteSpace() && Settings.Password.IsNotNullOrWhiteSpace())
{
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Five), false);
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Five, Settings.Username, Settings.Password), false);
}
else
{
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Five, Settings.Username, Settings.Password), false);
request.Proxy = new SocksWebProxy(new ProxyConfig(IPAddress.Loopback, GetNextFreePort(), GetProxyIpAddress(Settings.Host), Settings.Port, ProxyConfig.SocksVersion.Five), false);
}
_logger.Debug("Applying Socks5 Proxy {0} to request {1}", Name, request.Url);

Loading…
Cancel
Save