1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

Fixed: RestClient does not use global proxy settings

This commit is contained in:
Петр Шургалин
2020-01-16 13:38:26 +03:00
committed by Taloth
parent 10dc884fa8
commit b19d665817
11 changed files with 88 additions and 33 deletions
@@ -17,18 +17,9 @@ namespace NzbDrone.Core.Http
public HttpProxySettings GetProxySettings(HttpRequest request)
{
if (!_configService.ProxyEnabled)
{
var proxySettings = GetProxySettings();
if (proxySettings == null)
return null;
}
var proxySettings = new HttpProxySettings(_configService.ProxyType,
_configService.ProxyHostname,
_configService.ProxyPort,
_configService.ProxyBypassFilter,
_configService.ProxyBypassLocalAddresses,
_configService.ProxyUsername,
_configService.ProxyPassword);
if (ShouldProxyBeBypassed(proxySettings, request.Url))
{
@@ -38,6 +29,22 @@ namespace NzbDrone.Core.Http
return proxySettings;
}
public HttpProxySettings GetProxySettings()
{
if (!_configService.ProxyEnabled)
{
return null;
}
return new HttpProxySettings(_configService.ProxyType,
_configService.ProxyHostname,
_configService.ProxyPort,
_configService.ProxyBypassFilter,
_configService.ProxyBypassLocalAddresses,
_configService.ProxyUsername,
_configService.ProxyPassword);
}
public bool ShouldProxyBeBypassed(HttpProxySettings proxySettings, HttpUri url)
{
//We are utilising the WebProxy implementation here to save us having to reimplement it. This way we use Microsofts implementation