Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Put a try catch around setting ServicePointManager.SecurityProtcol
If setting those fail, then downloading resources from 123dmwm.com will fail. But that's better than the server not starting at all.
  • Loading branch information
UnknownShadow200 committed Dec 3, 2019
1 parent 3983182 commit d4967e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fCraft/System/Server.cs
Expand Up @@ -130,6 +130,11 @@ public static partial class Server {
}

ServicePointManager.Expect100Continue = false;
try {
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00 | 0x3000);
} catch( Exception ex ) {
Logger.Log( LogType.Error, "Could not force enable TLS 1.2/1.3: {0}", ex );
}

// try to parse arguments
foreach( string arg in rawArgs ) {
Expand Down Expand Up @@ -480,7 +485,6 @@ public static partial class Server {

static void DownloadResource(string url, string file) {
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00 | 0x3000);
if (File.Exists(file)) return;

try {
Expand Down

0 comments on commit d4967e8

Please sign in to comment.