Skip to content

Commit 279df7a

Browse files
authored
http: fix SYSLIB0057 warning for X509Certificate2Collection.Import (git-ecosystem#2326)
Use `ImportFromPemFile` on modern .NET to resolve the `SYSLIB0057` deprecation warning, while keeping the original `Import` call on .NET Framework where the new API is not available. We know this is always a PEM file since this is a Git defined option, and it is passed to libcurl via `CURLINFO_CAINFO` which expects PEM format.
2 parents 2fa6482 + bb00416 commit 279df7a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/shared/Core/HttpClientFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ public HttpClient CreateClient()
130130

131131
// Import the custom certs
132132
X509Certificate2Collection certBundle = new X509Certificate2Collection();
133+
#if NETFRAMEWORK
133134
certBundle.Import(certBundlePath);
135+
#else
136+
certBundle.ImportFromPemFile(certBundlePath);
137+
#endif
134138

135139
try
136140
{

0 commit comments

Comments
 (0)