Skip to content

Commit adf0d70

Browse files
authored
Merge pull request #39 from gandarez/master
Check for SSL flag when downloading
2 parents bf3b494 + f5607a1 commit adf0d70

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ History
33
-------
44

55

6+
4.2.1 (2020-10-11)
7+
++++++++++++++++++
8+
9+
- Check for SSL flag before download cli from web.
10+
11+
612
4.2.0 (2020-10-10)
713
++++++++++++++++++
814

WakaTime/Dependencies.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ private static string PythonDownloadUrl
2020
return string.Format("https://www.python.org/ftp/python/{0}/python-{0}-embed-{1}.zip", CurrentPythonVersion, arch);
2121
}
2222
}
23-
public static string AppDataDirectory {
23+
public static string AppDataDirectory
24+
{
2425
get
2526
{
2627
var roamingFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
@@ -37,7 +38,7 @@ public static string AppDataDirectory {
3738

3839
public static void DownloadAndInstallCli()
3940
{
40-
Logger.Debug("Downloading wakatime-cli...");
41+
Logger.Debug("Downloading wakatime-cli...");
4142
var destinationDir = AppDataDirectory;
4243
var localZipFile = Path.Combine(destinationDir, "wakatime-cli.zip");
4344

@@ -71,8 +72,7 @@ public static void DownloadAndInstallPython()
7172
var extractToDir = Path.Combine(destinationDir, "python");
7273

7374
// Download python
74-
var proxy = WakaTimePackage.GetProxy();
75-
var client = new WebClient { Proxy = proxy };
75+
var client = GetWebClient();
7676
client.DownloadFile(url, localZipFile);
7777
Logger.Debug("Finished downloading python.");
7878

@@ -110,6 +110,16 @@ internal static string GetPython()
110110
return PythonBinaryLocation;
111111
}
112112

113+
private static WebClient GetWebClient()
114+
{
115+
if (!ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12))
116+
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
117+
118+
var proxy = WakaTimePackage.GetProxy();
119+
120+
return new WebClient { Proxy = proxy };
121+
}
122+
113123
internal static string GetPythonPathFromMicrosoftRegistry()
114124
{
115125
try

WakaTime/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("4.2.0")]
36-
[assembly: AssemblyFileVersion("4.2.0")]
35+
[assembly: AssemblyVersion("4.2.1")]
36+
[assembly: AssemblyFileVersion("4.2.1")]

0 commit comments

Comments
 (0)