mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Check for BTLS support before using it
This commit is contained in:
@@ -55,7 +55,27 @@ namespace Jackett
|
|||||||
var monoVersionO = new Version(monoVersion.Split(' ')[0]);
|
var monoVersionO = new Version(monoVersion.Split(' ')[0]);
|
||||||
if (monoVersionO.Major >= 4 && monoVersionO.Minor >= 8)
|
if (monoVersionO.Major >= 4 && monoVersionO.Minor >= 8)
|
||||||
{
|
{
|
||||||
usehttpclient = true;
|
// check if btls is supported
|
||||||
|
var monoSecurity = Assembly.Load("Mono.Security");
|
||||||
|
Type monoTlsProviderFactory = monoSecurity.GetType("Mono.Security.Interface.MonoTlsProviderFactory");
|
||||||
|
if (monoTlsProviderFactory != null)
|
||||||
|
{
|
||||||
|
MethodInfo isProviderSupported = monoTlsProviderFactory.GetMethod("IsProviderSupported");
|
||||||
|
if(isProviderSupported != null)
|
||||||
|
{
|
||||||
|
var btlsSupported = (bool)isProviderSupported.Invoke(null, new string[] { "btls" });
|
||||||
|
if (btlsSupported)
|
||||||
|
{
|
||||||
|
// initialize btls
|
||||||
|
MethodInfo initialize = monoTlsProviderFactory.GetMethod("Initialize", new[] { typeof(string) });
|
||||||
|
if (initialize != null)
|
||||||
|
{
|
||||||
|
initialize.Invoke(null, new string[] { "btls" });
|
||||||
|
usehttpclient = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user