mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
@@ -99,7 +99,7 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|||||||
AddRequestHeaders(requestMessage, request.Headers);
|
AddRequestHeaders(requestMessage, request.Headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
var httpClient = GetClient(request.Url);
|
var httpClient = GetClient(request.Url, request.ProxySettings);
|
||||||
|
|
||||||
var sw = new Stopwatch();
|
var sw = new Stopwatch();
|
||||||
|
|
||||||
@@ -154,9 +154,9 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual System.Net.Http.HttpClient GetClient(HttpUri uri)
|
protected virtual System.Net.Http.HttpClient GetClient(HttpUri uri, HttpProxySettings requestProxy)
|
||||||
{
|
{
|
||||||
var proxySettings = _proxySettingsProvider.GetProxySettings(uri);
|
var proxySettings = requestProxy ?? _proxySettingsProvider.GetProxySettings(uri);
|
||||||
|
|
||||||
var key = proxySettings?.Key ?? NO_PROXY_KEY;
|
var key = proxySettings?.Key ?? NO_PROXY_KEY;
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ using System.Net.Http;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Common.Http.Proxy;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Http
|
namespace NzbDrone.Common.Http
|
||||||
{
|
{
|
||||||
@@ -37,7 +38,7 @@ namespace NzbDrone.Common.Http
|
|||||||
public HttpMethod Method { get; set; }
|
public HttpMethod Method { get; set; }
|
||||||
public HttpHeader Headers { get; set; }
|
public HttpHeader Headers { get; set; }
|
||||||
public Encoding Encoding { get; set; }
|
public Encoding Encoding { get; set; }
|
||||||
public IWebProxy Proxy { get; set; }
|
public HttpProxySettings ProxySettings { get; set; }
|
||||||
public byte[] ContentData { get; set; }
|
public byte[] ContentData { get; set; }
|
||||||
public string ContentSummary { get; set; }
|
public string ContentSummary { get; set; }
|
||||||
public ICredentials Credentials { get; set; }
|
public ICredentials Credentials { get; set; }
|
||||||
|
@@ -3,7 +3,9 @@ using NLog;
|
|||||||
using NzbDrone.Common.Cloud;
|
using NzbDrone.Common.Cloud;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Common.Http.Proxy;
|
||||||
using NzbDrone.Core.Localization;
|
using NzbDrone.Core.Localization;
|
||||||
|
using NzbDrone.Core.Notifications.Prowl;
|
||||||
|
|
||||||
namespace NzbDrone.Core.IndexerProxies.Http
|
namespace NzbDrone.Core.IndexerProxies.Http
|
||||||
{
|
{
|
||||||
@@ -18,14 +20,13 @@ namespace NzbDrone.Core.IndexerProxies.Http
|
|||||||
|
|
||||||
public override HttpRequest PreRequest(HttpRequest request)
|
public override HttpRequest PreRequest(HttpRequest request)
|
||||||
{
|
{
|
||||||
if (Settings.Username.IsNotNullOrWhiteSpace() && Settings.Password.IsNotNullOrWhiteSpace())
|
request.ProxySettings = new HttpProxySettings(ProxyType.Http,
|
||||||
{
|
Settings.Host,
|
||||||
request.Proxy = new WebProxy(Settings.Host + ":" + Settings.Port, false, null, new NetworkCredential(Settings.Username, Settings.Password));
|
Settings.Port,
|
||||||
}
|
null,
|
||||||
else
|
false,
|
||||||
{
|
Settings.Username,
|
||||||
request.Proxy = new WebProxy(Settings.Host + ":" + Settings.Port, false, null);
|
Settings.Password);
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Debug("Applying HTTP(S) Proxy {0} to request {1}", Name, request.Url);
|
_logger.Debug("Applying HTTP(S) Proxy {0} to request {1}", Name, request.Url);
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ using NLog;
|
|||||||
using NzbDrone.Common.Cloud;
|
using NzbDrone.Common.Cloud;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Common.Http.Proxy;
|
||||||
using NzbDrone.Core.Localization;
|
using NzbDrone.Core.Localization;
|
||||||
|
|
||||||
namespace NzbDrone.Core.IndexerProxies.Socks4
|
namespace NzbDrone.Core.IndexerProxies.Socks4
|
||||||
@@ -25,14 +26,13 @@ namespace NzbDrone.Core.IndexerProxies.Socks4
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Username.IsNotNullOrWhiteSpace() && Settings.Password.IsNotNullOrWhiteSpace())
|
request.ProxySettings = new HttpProxySettings(ProxyType.Socks4,
|
||||||
{
|
Settings.Host,
|
||||||
request.Proxy = new WebProxy(uri, false, null, new NetworkCredential(Settings.Username, Settings.Password));
|
Settings.Port,
|
||||||
}
|
null,
|
||||||
else
|
false,
|
||||||
{
|
Settings.Username,
|
||||||
request.Proxy = new WebProxy(uri);
|
Settings.Password);
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Debug("Applying Socks4 Proxy {0} to request {1}", Name, request.Url);
|
_logger.Debug("Applying Socks4 Proxy {0} to request {1}", Name, request.Url);
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ using NLog;
|
|||||||
using NzbDrone.Common.Cloud;
|
using NzbDrone.Common.Cloud;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Common.Http.Proxy;
|
||||||
using NzbDrone.Core.Localization;
|
using NzbDrone.Core.Localization;
|
||||||
|
|
||||||
namespace NzbDrone.Core.IndexerProxies.Socks5
|
namespace NzbDrone.Core.IndexerProxies.Socks5
|
||||||
@@ -26,14 +27,13 @@ namespace NzbDrone.Core.IndexerProxies.Socks5
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Username.IsNotNullOrWhiteSpace() && Settings.Password.IsNotNullOrWhiteSpace())
|
request.ProxySettings = new HttpProxySettings(ProxyType.Socks5,
|
||||||
{
|
Settings.Host,
|
||||||
request.Proxy = new WebProxy(uri, false, null, new NetworkCredential(Settings.Username, Settings.Password));
|
Settings.Port,
|
||||||
}
|
null,
|
||||||
else
|
false,
|
||||||
{
|
Settings.Username,
|
||||||
request.Proxy = new WebProxy(uri);
|
Settings.Password);
|
||||||
}
|
|
||||||
|
|
||||||
_logger.Debug("Applying Socks5 Proxy {0} to request {1}", Name, request.Url);
|
_logger.Debug("Applying Socks5 Proxy {0} to request {1}", Name, request.Url);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user