Skip to content

Commit

Permalink
Disable SSL check when downloading mods
Browse files Browse the repository at this point in the history
Following Horcrux's previous workaround described in KSP-CKAN#2142, disable SSL certificate verification when downloading mods.

PLEASE USE THIS WITH EXTREME CAUTION - SSL CHECKS PROTECT YOUR COMPUTER
  • Loading branch information
mister-walter committed Jan 14, 2018
1 parent 26ff29b commit c950cda
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Core/Net/Net.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Text;
using System.Text.RegularExpressions;
using ChinhDo.Transactions;
Expand Down Expand Up @@ -50,6 +51,22 @@ public static string Download(string url, string filename = null, IUser user = n

var agent = MakeDefaultHttpClient();

// WARNING: this disables all SSL checks. DANGER!!!
// from https://stackoverflow.com/a/1301221
try
{
//Change SSL checks so that all checks pass
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(
delegate
{ return true; }
);
}
catch (Exception ex)
{
//ActivityLog.InsertSyncActivity(ex);
}

try
{
agent.DownloadFile(url, filename);
Expand Down

0 comments on commit c950cda

Please sign in to comment.