Skip to content

Commit

Permalink
Add certificate in http fallback handler
Browse files Browse the repository at this point in the history
  • Loading branch information
w1am committed Feb 28, 2024
1 parent e65f330 commit 6bb1999
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/EventStore.Client/HttpFallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ internal HttpFallback (EventStoreClientSettings settings) {
_defaultCredentials = settings.DefaultCredentials;

var handler = new HttpClientHandler();
if (!settings.ConnectivitySettings.Insecure && !settings.ConnectivitySettings.TlsVerifyCert) {
if (!settings.ConnectivitySettings.Insecure) {
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ServerCertificateCustomValidationCallback = (_, _, _, _) => true;

if (settings.ConnectivitySettings.TlsCaFile != null)
handler.ClientCertificates.Add(settings.ConnectivitySettings.TlsCaFile);

if (!settings.ConnectivitySettings.TlsVerifyCert)
handler.ServerCertificateCustomValidationCallback = (_, _, _, _) => true;
}

_httpClient = new HttpClient(handler);
if (settings.DefaultDeadline.HasValue) {
_httpClient.Timeout = settings.DefaultDeadline.Value;
Expand Down

0 comments on commit 6bb1999

Please sign in to comment.