diff --git a/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs b/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs index 14cea7f48a..68cc2b216e 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs @@ -733,7 +733,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests } } - [Fact] + [ConditionalFact] + [Flaky("https://github.com/aspnet/AspNetCore-Internal/issues/2181", FlakyOn.All)] public async Task ConnectionNotClosedWhenClientSatisfiesMinimumDataRateGivenLargeResponseChunks() { var chunkSize = 64 * 128 * 1024; diff --git a/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.cs b/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.cs index a2fd1a61fd..421af402d8 100644 --- a/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.cs +++ b/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.cs @@ -89,6 +89,14 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests Assert.Same(httpOptions.Credentials, httpClientHandler.Credentials); } + [Fact] + public void HttpOptionsCannotSetNullCookieContainer() + { + var httpOptions = new HttpConnectionOptions(); + Assert.NotNull(httpOptions.Cookies); + Assert.Throws(() => httpOptions.Cookies = null); + } + [Fact] public async Task HttpRequestAndErrorResponseLogged() { diff --git a/src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs b/src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs index e014061f50..acfdce1010 100644 --- a/src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs +++ b/src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs @@ -517,13 +517,14 @@ namespace Microsoft.AspNetCore.Http.Connections.Client { httpClientHandler.Proxy = _httpConnectionOptions.Proxy; } - if (_httpConnectionOptions.Cookies != null) + + // Only access HttpClientHandler.ClientCertificates and HttpClientHandler.CookieContainer + // if the user has configured those options + // Some variants of Mono do not support client certs or cookies and will throw NotImplementedException + if (_httpConnectionOptions.Cookies.Count > 0) { httpClientHandler.CookieContainer = _httpConnectionOptions.Cookies; } - - // 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)