Add Windows support for the IgnoreSslErrors option (#594)

This commit is contained in:
kaso17 2016-11-09 18:26:32 +01:00 committed by GitHub
parent 6b253178b6
commit e7918bddbc
3 changed files with 8 additions and 2 deletions

View File

@ -57,7 +57,7 @@ namespace Jackett.Console
[Option('f', "SSLFix", HelpText = "[true/false] Linux Libcurl NSS Missing ECC Ciphers workaround (Use if you can't access some trackers) .")]
public bool? SSLFix { get; set; }
[Option('n', "IgnoreSslErrors", HelpText = "[true/false] Linux Libcurl - Ignores invalid SSL certificates")]
[Option('n', "IgnoreSslErrors", HelpText = "[true/false] Ignores invalid SSL certificates")]
public bool? IgnoreSslErrors { get; set; }
[Option('d', "DataFolder", HelpText = "Specify the location of the data folder (Must be admin on Windows) eg. --DataFolder=\"D:\\Your Data\\Jackett\\\"")]

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
@ -96,7 +97,7 @@ namespace JackettConsole
Startup.IgnoreSslErrors = options.IgnoreSslErrors;
if (options.IgnoreSslErrors == true)
{
Engine.Logger.Info("Curl will ignore SSL certificate errors.");
Engine.Logger.Info("Jackett will ignore SSL certificate errors.");
}
// Choose Data Folder

View File

@ -27,6 +27,11 @@ namespace Jackett.Utils.Clients
public void Init()
{
if (Startup.IgnoreSslErrors == true)
{
logger.Info(string.Format("WindowsWebClient: Disabling certificate validation"));
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return true; };
}
}
public async Task<WebClientByteResult> GetBytes(WebRequest request)