Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit e1a22b3

Browse files
JamesNKanalogrelay
authored andcommitted
Android HttpClientHandler.ClientCertificates fix (#2270)
1 parent 95f5438 commit e1a22b3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Microsoft.AspNetCore.Http.Connections.Client/HttpConnection.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,16 @@ private HttpClient CreateHttpClient()
486486
{
487487
httpClientHandler.CookieContainer = _httpConnectionOptions.Cookies;
488488
}
489-
if (_httpConnectionOptions.ClientCertificates != null)
489+
490+
// Only access HttpClientHandler.ClientCertificates if the user has configured client certs
491+
// Mono does not support client certs and will throw NotImplementedException
492+
// https://github.com/aspnet/SignalR/issues/2232
493+
var clientCertificates = _httpConnectionOptions.ClientCertificates;
494+
if (clientCertificates?.Count > 0)
490495
{
491-
httpClientHandler.ClientCertificates.AddRange(_httpConnectionOptions.ClientCertificates);
496+
httpClientHandler.ClientCertificates.AddRange(clientCertificates);
492497
}
498+
493499
if (_httpConnectionOptions.UseDefaultCredentials != null)
494500
{
495501
httpClientHandler.UseDefaultCredentials = _httpConnectionOptions.UseDefaultCredentials.Value;

0 commit comments

Comments
 (0)