|
@@ -53,7 +53,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
|
|
var connectionFeatures = new FeatureCollection();
|
|
var connectionFeatures = new FeatureCollection();
|
|
|
connectionFeatures.Set(Mock.Of<IConnectionLifetimeFeature>());
|
|
connectionFeatures.Set(Mock.Of<IConnectionLifetimeFeature>());
|
|
|
|
|
|
|
|
- _serviceContext = new TestServiceContext();
|
|
|
|
|
|
|
+ _serviceContext = new TestServiceContext()
|
|
|
|
|
+ {
|
|
|
|
|
+ Scheduler = PipeScheduler.Inline
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
_timeoutControl = new Mock<ITimeoutControl>();
|
|
_timeoutControl = new Mock<ITimeoutControl>();
|
|
|
_http1ConnectionContext = new HttpConnectionContext
|
|
_http1ConnectionContext = new HttpConnectionContext
|
|
|
{
|
|
{
|
|
@@ -724,6 +728,27 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
|
|
Assert.False(_http1Connection.RequestAborted.IsCancellationRequested);
|
|
Assert.False(_http1Connection.RequestAborted.IsCancellationRequested);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ [Fact]
|
|
|
|
|
+ public void RequestAbortedTokenIsUsableAfterCancellation()
|
|
|
|
|
+ {
|
|
|
|
|
+ var originalToken = _http1Connection.RequestAborted;
|
|
|
|
|
+ var originalRegistration = originalToken.Register(() => { });
|
|
|
|
|
+
|
|
|
|
|
+ _http1Connection.Abort(new ConnectionAbortedException());
|
|
|
|
|
+
|
|
|
|
|
+ // The following line will throw an ODE because the original CTS backing the token has been diposed.
|
|
|
|
|
+ // See https://github.com/aspnet/AspNetCore/pull/4447 for the history behind this test.
|
|
|
|
|
+ //Assert.True(originalToken.WaitHandle.WaitOne(TestConstants.DefaultTimeout));
|
|
|
|
|
+ Assert.True(_http1Connection.RequestAborted.WaitHandle.WaitOne(TestConstants.DefaultTimeout));
|
|
|
|
|
+
|
|
|
|
|
+#if NETCOREAPP2_2
|
|
|
|
|
+ Assert.Equal(originalToken, originalRegistration.Token);
|
|
|
|
|
+#elif NET461
|
|
|
|
|
+#else
|
|
|
|
|
+#error Target framework needs to be updated
|
|
|
|
|
+#endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
[Fact]
|
|
[Fact]
|
|
|
public async Task ExceptionDetailNotIncludedWhenLogLevelInformationNotEnabled()
|
|
public async Task ExceptionDetailNotIncludedWhenLogLevelInformationNotEnabled()
|
|
|
{
|
|
{
|