Skip to content

Commit d0bc38a

Browse files
committed
fix cacert not being found for curl
1 parent 0eba093 commit d0bc38a

4 files changed

Lines changed: 8 additions & 11 deletions

File tree

LibCurlImpersonate/CurlHttp.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ public class CurlHttp : IDisposable
77
{
88
static CurlHttp() => LibCurl.curl_global_init(LibCurl.CURL_GLOBAL_DEFAULT);
99

10+
private static readonly string CurDir = Path.Join(
11+
Path.GetDirectoryName(AppContext.BaseDirectory)
12+
);
13+
14+
private static readonly string PathToCacert = Path.Join(CurDir, "cacert.pem");
15+
1016
public static IEnumerable<string> FetchLines(
1117
string url,
1218
Action<double>? onSpeed = null,
@@ -47,7 +53,7 @@ public static string Fetch(
4753
GCHandle.ToIntPtr(writePin)
4854
);
4955
LibCurl.curl_easy_setopt_long(handle, LibCurl.CURLOPT_FOLLOWLOCATION, 1L);
50-
LibCurl.curl_easy_setopt_str(handle, LibCurl.CURLOPT_CAINFO, "cacert.pem");
56+
LibCurl.curl_easy_setopt_str(handle, LibCurl.CURLOPT_CAINFO, PathToCacert);
5157
if (http3)
5258
LibCurl.curl_easy_setopt_long(
5359
handle,
@@ -100,7 +106,7 @@ public static Dictionary<string, string> GetHeaders(
100106
GCHandle.ToIntPtr(headerPin)
101107
);
102108
LibCurl.curl_easy_setopt_long(handle, LibCurl.CURLOPT_NOBODY, 1L);
103-
LibCurl.curl_easy_setopt_str(handle, LibCurl.CURLOPT_CAINFO, "cacert.pem");
109+
LibCurl.curl_easy_setopt_str(handle, LibCurl.CURLOPT_CAINFO, PathToCacert);
104110
if (http3)
105111
LibCurl.curl_easy_setopt_long(
106112
handle,

Stalker.Gamma/Models/StalkerGammaSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ public class StalkerGammaSettings
2121
public int DownloadThreads { get; set; } = 2;
2222
public string PathToUnzip = "unzip";
2323
public string PathTo7Z = OperatingSystem.IsWindows() ? "7zz.exe" : "7zz";
24-
public string PathToCurl = OperatingSystem.IsWindows() ? "curl.exe" : "curl-impersonate";
2524
public string PathToTar = "tar";
2625
}

stalker-gamma-cli/Commands/Anomaly.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ public async Task<int> AnomalyInstall(
6161
var anomaly = _cliSettings.ActiveProfile!.Anomaly;
6262
var cache = _cliSettings.ActiveProfile!.Cache;
6363
var resourcesPath = Path.Join(Path.GetDirectoryName(AppContext.BaseDirectory), "resources");
64-
stalkerGammaSettings.PathToCurl = Path.Join(
65-
resourcesPath,
66-
OperatingSystem.IsWindows() ? "curl.exe" : "curl-impersonate"
67-
);
6864
stalkerGammaSettings.PathTo7Z = Path.Join(
6965
resourcesPath,
7066
OperatingSystem.IsWindows() ? "7zz.exe" : "7zz"

stalker-gamma-cli/Services/SetupUtilitiesService.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ public class SetupUtilitiesService(StalkerGammaSettings settings)
66
{
77
public void Setup()
88
{
9-
settings.PathToCurl = Path.Join(
10-
ResourcesPath,
11-
OperatingSystem.IsWindows() ? "curl.exe" : "curl-impersonate"
12-
);
139
settings.PathTo7Z = Path.Join(
1410
ResourcesPath,
1511
OperatingSystem.IsWindows() ? "7zz.exe" : "7zz"

0 commit comments

Comments
 (0)