Skip to content

Commit 21c24f2

Browse files
authored
Merge pull request #191 from sgmoore/master
Added Patch to try to use TLS 1.2 when checking for new releases.
2 parents 79f7e7a + 34514a3 commit 21c24f2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Source/Terminals/Updates/UpdateManager.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ private static string DownloadReleases()
2424
{
2525
using (var client = new WebClient())
2626
{
27+
// Try to enable TLS1.2. If the operating system does not support, then we won't be able to connect to Github which requires it.
28+
var oldValue = ServicePointManager.SecurityProtocol;
29+
ServicePointManager.SecurityProtocol = oldValue | (SecurityProtocolType)3072; // 3072 = System.Net.SecurityProtocolType.Tls12
30+
2731
const string agent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident / 6.0)";
2832
client.Headers.Add("Accept", "application/json");
2933
client.Headers.Add("User-Agent", agent);
30-
return client.DownloadString(Settings.Default.ReleasesUrl);
34+
var releases = client.DownloadString(Settings.Default.ReleasesUrl);
35+
36+
ServicePointManager.SecurityProtocol = oldValue;
37+
return releases;
3138
}
3239
}
3340

0 commit comments

Comments
 (0)