Merge pull request #2287 from aspnet/release/2.1

Android HttpClientHandler.ClientCertificates fix (#2270)
This commit is contained in:
Andrew Stanton-Nurse 2018-05-16 12:39:50 -07:00 committed by GitHub
commit 2388dd3a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -486,10 +486,16 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
{
httpClientHandler.CookieContainer = _httpConnectionOptions.Cookies;
}
if (_httpConnectionOptions.ClientCertificates != null)
// Only access HttpClientHandler.ClientCertificates if the user has configured client certs
// Mono does not support client certs and will throw NotImplementedException
// https://github.com/aspnet/SignalR/issues/2232
var clientCertificates = _httpConnectionOptions.ClientCertificates;
if (clientCertificates?.Count > 0)
{
httpClientHandler.ClientCertificates.AddRange(_httpConnectionOptions.ClientCertificates);
httpClientHandler.ClientCertificates.AddRange(clientCertificates);
}
if (_httpConnectionOptions.UseDefaultCredentials != null)
{
httpClientHandler.UseDefaultCredentials = _httpConnectionOptions.UseDefaultCredentials.Value;