System.Security.Cryptography fails on WASM (#25285)
This commit is contained in:
parent
80662903a2
commit
a73ae505a2
|
|
@ -82,11 +82,10 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
|
||||||
// Internal for testing
|
// Internal for testing
|
||||||
internal static HttpConnectionOptions ShallowCopyHttpConnectionOptions(HttpConnectionOptions options)
|
internal static HttpConnectionOptions ShallowCopyHttpConnectionOptions(HttpConnectionOptions options)
|
||||||
{
|
{
|
||||||
return new HttpConnectionOptions
|
var newOptions = new HttpConnectionOptions
|
||||||
{
|
{
|
||||||
HttpMessageHandlerFactory = options.HttpMessageHandlerFactory,
|
HttpMessageHandlerFactory = options.HttpMessageHandlerFactory,
|
||||||
Headers = options.Headers,
|
Headers = options.Headers,
|
||||||
ClientCertificates = options.ClientCertificates,
|
|
||||||
Cookies = options.Cookies,
|
Cookies = options.Cookies,
|
||||||
Url = options.Url,
|
Url = options.Url,
|
||||||
Transports = options.Transports,
|
Transports = options.Transports,
|
||||||
|
|
@ -99,6 +98,14 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
|
||||||
DefaultTransferFormat = options.DefaultTransferFormat,
|
DefaultTransferFormat = options.DefaultTransferFormat,
|
||||||
WebSocketConfiguration = options.WebSocketConfiguration,
|
WebSocketConfiguration = options.WebSocketConfiguration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// WASM doesn't support Crypto APIs and our setter throws if you try to assign null
|
||||||
|
if (options.ClientCertificates != null)
|
||||||
|
{
|
||||||
|
newOptions.ClientCertificates = options.ClientCertificates;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newOptions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Connections;
|
using Microsoft.AspNetCore.Connections;
|
||||||
|
using Microsoft.AspNetCore.Http.Connections.Client.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Http.Connections.Client
|
namespace Microsoft.AspNetCore.Http.Connections.Client
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +29,13 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
|
||||||
public HttpConnectionOptions()
|
public HttpConnectionOptions()
|
||||||
{
|
{
|
||||||
_headers = new Dictionary<string, string>();
|
_headers = new Dictionary<string, string>();
|
||||||
_clientCertificates = new X509CertificateCollection();
|
|
||||||
|
// System.Security.Cryptography isn't supported on WASM currently
|
||||||
|
if (!Utils.IsRunningInBrowser())
|
||||||
|
{
|
||||||
|
_clientCertificates = new X509CertificateCollection();
|
||||||
|
}
|
||||||
|
|
||||||
_cookies = new CookieContainer();
|
_cookies = new CookieContainer();
|
||||||
|
|
||||||
Transports = HttpTransports.All;
|
Transports = HttpTransports.All;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue