Fix proxy in all cases (#7631) resolves #7411

Co-authored-by: Diego Heras <ngosang@hotmail.es>
This commit is contained in:
Cory
2020-03-14 17:53:16 -05:00
committed by GitHub
parent 594959c858
commit 5b6c9fee49
4 changed files with 12 additions and 24 deletions

View File

@@ -54,12 +54,9 @@ namespace Jackett.Common.Utils.Clients
public static void InitProxy(ServerConfig serverConfig) public static void InitProxy(ServerConfig serverConfig)
{ {
// dispose old SocksWebProxy // dispose old SocksWebProxy
if (webProxy != null && webProxy is SocksWebProxy) if (webProxy is SocksWebProxy proxy)
{ proxy.Dispose();
((SocksWebProxy)webProxy).Dispose(); webProxy = null;
webProxy = null;
}
webProxyUrl = serverConfig.GetProxyUrl(); webProxyUrl = serverConfig.GetProxyUrl();
if (!string.IsNullOrWhiteSpace(webProxyUrl)) if (!string.IsNullOrWhiteSpace(webProxyUrl))
{ {

View File

@@ -61,12 +61,9 @@ namespace Jackett.Common.Utils.Clients
public static void InitProxy(ServerConfig serverConfig) public static void InitProxy(ServerConfig serverConfig)
{ {
// dispose old SocksWebProxy // dispose old SocksWebProxy
if (webProxy != null && webProxy is SocksWebProxy) if (webProxy is SocksWebProxy proxy)
{ proxy.Dispose();
((SocksWebProxy)webProxy).Dispose(); webProxy = null;
webProxy = null;
}
webProxyUrl = serverConfig.GetProxyUrl(); webProxyUrl = serverConfig.GetProxyUrl();
if (!string.IsNullOrWhiteSpace(webProxyUrl)) if (!string.IsNullOrWhiteSpace(webProxyUrl))
{ {

View File

@@ -57,12 +57,9 @@ namespace Jackett.Common.Utils.Clients
public static void InitProxy(ServerConfig serverConfig) public static void InitProxy(ServerConfig serverConfig)
{ {
// dispose old SocksWebProxy // dispose old SocksWebProxy
if (webProxy != null && webProxy is SocksWebProxy) if (webProxy is SocksWebProxy proxy)
{ proxy.Dispose();
((SocksWebProxy)webProxy).Dispose(); webProxy = null;
webProxy = null;
}
webProxyUrl = serverConfig.GetProxyUrl(); webProxyUrl = serverConfig.GetProxyUrl();
if (!string.IsNullOrWhiteSpace(webProxyUrl)) if (!string.IsNullOrWhiteSpace(webProxyUrl))
{ {

View File

@@ -53,12 +53,9 @@ namespace Jackett.Common.Utils.Clients
public static void InitProxy(ServerConfig serverConfig) public static void InitProxy(ServerConfig serverConfig)
{ {
// dispose old SocksWebProxy // dispose old SocksWebProxy
if (webProxy != null && webProxy is SocksWebProxy) if (webProxy is SocksWebProxy proxy)
{ proxy.Dispose();
((SocksWebProxy)webProxy).Dispose(); webProxy = null;
webProxy = null;
}
webProxyUrl = serverConfig.GetProxyUrl(); webProxyUrl = serverConfig.GetProxyUrl();
if (!string.IsNullOrWhiteSpace(webProxyUrl)) if (!string.IsNullOrWhiteSpace(webProxyUrl))
{ {