File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments