|
@@ -5,6 +5,7 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
using System.Net.Http;
|
|
using System.Net.Http;
|
|
|
|
|
+using System.Reflection.PortableExecutable;
|
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
|
using Microsoft.AspNetCore.Connections;
|
|
using Microsoft.AspNetCore.Connections;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
@@ -15,27 +16,29 @@ using Microsoft.AspNetCore.Testing;
|
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Moq;
|
|
using Moq;
|
|
|
using Xunit;
|
|
using Xunit;
|
|
|
|
|
+using Xunit.Sdk;
|
|
|
|
|
|
|
|
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests;
|
|
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests;
|
|
|
|
|
|
|
|
public class Http3TimeoutTests : Http3TestBase
|
|
public class Http3TimeoutTests : Http3TestBase
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
[Fact]
|
|
[Fact]
|
|
|
public async Task HEADERS_IncompleteFrameReceivedWithinRequestHeadersTimeout_StreamError()
|
|
public async Task HEADERS_IncompleteFrameReceivedWithinRequestHeadersTimeout_StreamError()
|
|
|
{
|
|
{
|
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
|
|
|
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication).DefaultTimeout();
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, null).DefaultTimeout();
|
|
|
|
|
|
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
|
await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
|
|
|
|
|
|
- await requestStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
|
|
+ await requestStream.SendHeadersPartialAsync().DefaultTimeout();
|
|
|
|
|
|
|
|
- var serverRequestStream = Http3Api.Connection._streams[requestStream.StreamId];
|
|
|
|
|
|
|
+ await requestStream.OnStreamCreatedTask;
|
|
|
|
|
|
|
|
- await requestStream.SendHeadersPartialAsync().DefaultTimeout();
|
|
|
|
|
|
|
+ var serverRequestStream = Http3Api.Connection._streams[requestStream.StreamId];
|
|
|
|
|
|
|
|
Http3Api.TriggerTick(now);
|
|
Http3Api.TriggerTick(now);
|
|
|
Http3Api.TriggerTick(now + limits.RequestHeadersTimeout);
|
|
Http3Api.TriggerTick(now + limits.RequestHeadersTimeout);
|
|
@@ -50,9 +53,13 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
CoreStrings.BadRequest_RequestHeadersTimeout);
|
|
CoreStrings.BadRequest_RequestHeadersTimeout);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- [Fact]
|
|
|
|
|
- public async Task HEADERS_HeaderFrameReceivedWithinRequestHeadersTimeout_Success()
|
|
|
|
|
|
|
+ [Theory]
|
|
|
|
|
+ [InlineData(true)]
|
|
|
|
|
+ [InlineData(false)]
|
|
|
|
|
+ public async Task HEADERS_HeaderFrameReceivedWithinRequestHeadersTimeout_Success(bool pendingStreamsEnabled)
|
|
|
{
|
|
{
|
|
|
|
|
+ Http3Api._serviceContext.ServerOptions.EnableWebTransportAndH3Datagrams = pendingStreamsEnabled;
|
|
|
|
|
+
|
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
|
var headers = new[]
|
|
var headers = new[]
|
|
@@ -63,14 +70,25 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Authority, "localhost:80"),
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Authority, "localhost:80"),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication).DefaultTimeout();
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_noopApplication, null).DefaultTimeout();
|
|
|
|
|
|
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
|
await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
|
|
|
|
|
|
- await requestStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
|
|
+ dynamic serverRequestStream;
|
|
|
|
|
|
|
|
- var serverRequestStream = Http3Api.Connection._streams[requestStream.StreamId];
|
|
|
|
|
|
|
+ if (pendingStreamsEnabled)
|
|
|
|
|
+ {
|
|
|
|
|
+ await requestStream.OnUnidentifiedStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
+
|
|
|
|
|
+ serverRequestStream = Http3Api.Connection._unidentifiedStreams[requestStream.StreamId];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ await requestStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
+
|
|
|
|
|
+ serverRequestStream = Http3Api.Connection._streams[requestStream.StreamId];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Http3Api.TriggerTick(now);
|
|
Http3Api.TriggerTick(now);
|
|
|
Http3Api.TriggerTick(now + limits.RequestHeadersTimeout);
|
|
Http3Api.TriggerTick(now + limits.RequestHeadersTimeout);
|
|
@@ -90,9 +108,37 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
await requestStream.ExpectReceiveEndOfStream();
|
|
await requestStream.ExpectReceiveEndOfStream();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ [Fact]
|
|
|
|
|
+ public async Task ControlStream_HeaderNotReceivedWithinRequestHeadersTimeout_StreamError_PendingStreamsEnabled()
|
|
|
|
|
+ {
|
|
|
|
|
+ Http3Api._serviceContext.ServerOptions.EnableWebTransportAndH3Datagrams = true;
|
|
|
|
|
+
|
|
|
|
|
+ var now = _serviceContext.MockSystemClock.UtcNow;
|
|
|
|
|
+ var limits = _serviceContext.ServerOptions.Limits;
|
|
|
|
|
+
|
|
|
|
|
+ await Http3Api.InitializeConnectionAsync(_noopApplication).DefaultTimeout();
|
|
|
|
|
+
|
|
|
|
|
+ var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
|
|
|
+ await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
|
|
|
+
|
|
|
|
|
+ var outboundControlStream = await Http3Api.CreateControlStream(id: null);
|
|
|
|
|
+
|
|
|
|
|
+ await outboundControlStream.OnUnidentifiedStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
+ var serverInboundControlStream = Http3Api.Connection._unidentifiedStreams[outboundControlStream.StreamId];
|
|
|
|
|
+
|
|
|
|
|
+ Http3Api.TriggerTick(now);
|
|
|
|
|
+ Http3Api.TriggerTick(now + limits.RequestHeadersTimeout);
|
|
|
|
|
+
|
|
|
|
|
+ Assert.Equal((now + limits.RequestHeadersTimeout).Ticks, serverInboundControlStream.StreamTimeoutTicks);
|
|
|
|
|
+
|
|
|
|
|
+ Http3Api.TriggerTick(now + limits.RequestHeadersTimeout + TimeSpan.FromTicks(1));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
[Fact]
|
|
[Fact]
|
|
|
public async Task ControlStream_HeaderNotReceivedWithinRequestHeadersTimeout_StreamError()
|
|
public async Task ControlStream_HeaderNotReceivedWithinRequestHeadersTimeout_StreamError()
|
|
|
{
|
|
{
|
|
|
|
|
+ Http3Api._serviceContext.ServerOptions.EnableWebTransportAndH3Datagrams = false;
|
|
|
|
|
+
|
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
|
var headers = new[]
|
|
var headers = new[]
|
|
@@ -132,48 +178,33 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
{
|
|
{
|
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
|
- var headers = new[]
|
|
|
|
|
- {
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Method, "Custom"),
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Path, "/"),
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Scheme, "http"),
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Authority, "localhost:80"),
|
|
|
|
|
- };
|
|
|
|
|
|
|
|
|
|
await Http3Api.InitializeConnectionAsync(_noopApplication).DefaultTimeout();
|
|
await Http3Api.InitializeConnectionAsync(_noopApplication).DefaultTimeout();
|
|
|
|
|
|
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
|
await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
await controlStream.ExpectSettingsAsync().DefaultTimeout();
|
|
|
|
|
|
|
|
- var outboundControlStream = await Http3Api.CreateControlStream(id: null);
|
|
|
|
|
-
|
|
|
|
|
- await outboundControlStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
-
|
|
|
|
|
Http3Api.TriggerTick(now);
|
|
Http3Api.TriggerTick(now);
|
|
|
- Http3Api.TriggerTick(now + limits.RequestHeadersTimeout);
|
|
|
|
|
|
|
+ Http3Api.TriggerTick(now + limits.RequestHeadersTimeout + TimeSpan.FromTicks(1));
|
|
|
|
|
|
|
|
- await outboundControlStream.WriteStreamIdAsync(id: 0);
|
|
|
|
|
|
|
+ var outboundControlStream = await Http3Api.CreateControlStream(id: 0);
|
|
|
|
|
|
|
|
- await outboundControlStream.OnHeaderReceivedTask.DefaultTimeout();
|
|
|
|
|
|
|
+ await outboundControlStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
|
|
|
Http3Api.TriggerTick(now + limits.RequestHeadersTimeout + TimeSpan.FromTicks(1));
|
|
Http3Api.TriggerTick(now + limits.RequestHeadersTimeout + TimeSpan.FromTicks(1));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- [Fact]
|
|
|
|
|
- public async Task ControlStream_RequestHeadersTimeoutMaxValue_ExpirationIsMaxValue()
|
|
|
|
|
|
|
+ [Theory]
|
|
|
|
|
+ [InlineData(true)]
|
|
|
|
|
+ [InlineData(false)]
|
|
|
|
|
+ public async Task ControlStream_RequestHeadersTimeoutMaxValue_ExpirationIsMaxValue(bool pendingStreamEnabled)
|
|
|
{
|
|
{
|
|
|
|
|
+ Http3Api._serviceContext.ServerOptions.EnableWebTransportAndH3Datagrams = pendingStreamEnabled;
|
|
|
|
|
+
|
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
var now = _serviceContext.MockSystemClock.UtcNow;
|
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
var limits = _serviceContext.ServerOptions.Limits;
|
|
|
limits.RequestHeadersTimeout = TimeSpan.MaxValue;
|
|
limits.RequestHeadersTimeout = TimeSpan.MaxValue;
|
|
|
|
|
|
|
|
- var headers = new[]
|
|
|
|
|
- {
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Method, "Custom"),
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Path, "/"),
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Scheme, "http"),
|
|
|
|
|
- new KeyValuePair<string, string>(PseudoHeaderNames.Authority, "localhost:80"),
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
await Http3Api.InitializeConnectionAsync(_noopApplication).DefaultTimeout();
|
|
await Http3Api.InitializeConnectionAsync(_noopApplication).DefaultTimeout();
|
|
|
|
|
|
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
var controlStream = await Http3Api.GetInboundControlStream().DefaultTimeout();
|
|
@@ -181,9 +212,17 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
|
|
|
|
|
var outboundControlStream = await Http3Api.CreateControlStream(id: null);
|
|
var outboundControlStream = await Http3Api.CreateControlStream(id: null);
|
|
|
|
|
|
|
|
- await outboundControlStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
-
|
|
|
|
|
- var serverInboundControlStream = Http3Api.Connection._streams[outboundControlStream.StreamId];
|
|
|
|
|
|
|
+ dynamic serverInboundControlStream;
|
|
|
|
|
+ if (pendingStreamEnabled)
|
|
|
|
|
+ {
|
|
|
|
|
+ await outboundControlStream.OnUnidentifiedStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
+ serverInboundControlStream = Http3Api.Connection._unidentifiedStreams[outboundControlStream.StreamId];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ await outboundControlStream.OnStreamCreatedTask.DefaultTimeout();
|
|
|
|
|
+ serverInboundControlStream = Http3Api.Connection._streams[outboundControlStream.StreamId];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Http3Api.TriggerTick(now);
|
|
Http3Api.TriggerTick(now);
|
|
|
|
|
|
|
@@ -201,13 +240,13 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
|
|
|
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
|
|
|
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_readRateApplication);
|
|
|
|
|
|
|
+ await Http3Api.InitializeConnectionAsync(_readRateApplication);
|
|
|
|
|
|
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
|
|
|
|
|
|
// _helloWorldBytes is 12 bytes, and 12 bytes / 240 bytes/sec = .05 secs which is far below the grace period.
|
|
// _helloWorldBytes is 12 bytes, and 12 bytes / 240 bytes/sec = .05 secs which is far below the grace period.
|
|
|
- await requestStream.SendHeadersAsync(ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
|
|
|
await requestStream.SendDataAsync(_helloWorldBytes, endStream: false);
|
|
await requestStream.SendDataAsync(_helloWorldBytes, endStream: false);
|
|
|
|
|
|
|
|
await requestStream.ExpectHeadersAsync();
|
|
await requestStream.ExpectHeadersAsync();
|
|
@@ -247,17 +286,13 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
|
|
|
|
|
|
- var requestStream = await Http3Api.CreateRequestStream();
|
|
|
|
|
-
|
|
|
|
|
- requestStream.StartStreamDisposeTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
|
|
|
|
-
|
|
|
|
|
- await requestStream.SendHeadersAsync(new[]
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.CreateRequestStream(new[]
|
|
|
{
|
|
{
|
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Path, "/"),
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Path, "/"),
|
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Scheme, "http"),
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Scheme, "http"),
|
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Method, "GET"),
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Method, "GET"),
|
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Authority, "localhost:80"),
|
|
new KeyValuePair<string, string>(PseudoHeaderNames.Authority, "localhost:80"),
|
|
|
- }, endStream: true);
|
|
|
|
|
|
|
+ }, null, true, new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously));
|
|
|
|
|
|
|
|
await requestStream.OnDisposingTask.DefaultTimeout();
|
|
await requestStream.OnDisposingTask.DefaultTimeout();
|
|
|
|
|
|
|
@@ -318,9 +353,7 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
|
|
|
|
|
|
var app = new EchoAppWithNotification();
|
|
var app = new EchoAppWithNotification();
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(app.RunApp);
|
|
|
|
|
-
|
|
|
|
|
- await requestStream.SendHeadersAsync(_browserRequestHeaders, endStream: false);
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(app.RunApp, _browserRequestHeaders, endStream: false);
|
|
|
await requestStream.SendDataAsync(_helloWorldBytes, endStream: true);
|
|
await requestStream.SendDataAsync(_helloWorldBytes, endStream: true);
|
|
|
|
|
|
|
|
await requestStream.ExpectHeadersAsync();
|
|
await requestStream.ExpectHeadersAsync();
|
|
@@ -362,9 +395,7 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
|
|
|
|
|
|
var app = new EchoAppWithNotification();
|
|
var app = new EchoAppWithNotification();
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(app.RunApp);
|
|
|
|
|
-
|
|
|
|
|
- await requestStream.SendHeadersAsync(_browserRequestHeaders, endStream: false);
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(app.RunApp, _browserRequestHeaders, endStream: false);
|
|
|
await requestStream.SendDataAsync(_maxData, endStream: true);
|
|
await requestStream.SendDataAsync(_maxData, endStream: true);
|
|
|
|
|
|
|
|
await requestStream.ExpectHeadersAsync();
|
|
await requestStream.ExpectHeadersAsync();
|
|
@@ -403,13 +434,13 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
|
|
|
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
|
|
|
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(_readRateApplication);
|
|
|
|
|
|
|
+ await Http3Api.InitializeConnectionAsync(_readRateApplication);
|
|
|
|
|
|
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
|
|
|
|
|
|
// _maxData is 16 KiB, and 16 KiB / 240 bytes/sec ~= 68 secs which is far above the grace period.
|
|
// _maxData is 16 KiB, and 16 KiB / 240 bytes/sec ~= 68 secs which is far above the grace period.
|
|
|
- await requestStream.SendHeadersAsync(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
await requestStream.SendDataAsync(_maxData, endStream: false);
|
|
await requestStream.SendDataAsync(_maxData, endStream: false);
|
|
|
|
|
|
|
|
await requestStream.ExpectHeadersAsync();
|
|
await requestStream.ExpectHeadersAsync();
|
|
@@ -454,18 +485,14 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
|
|
|
|
|
|
- var requestStream1 = await Http3Api.CreateRequestStream();
|
|
|
|
|
-
|
|
|
|
|
// _maxData is 16 KiB, and 16 KiB / 240 bytes/sec ~= 68 secs which is far above the grace period.
|
|
// _maxData is 16 KiB, and 16 KiB / 240 bytes/sec ~= 68 secs which is far above the grace period.
|
|
|
- await requestStream1.SendHeadersAsync(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream1 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
await requestStream1.SendDataAsync(_maxData, endStream: false);
|
|
await requestStream1.SendDataAsync(_maxData, endStream: false);
|
|
|
|
|
|
|
|
await requestStream1.ExpectHeadersAsync();
|
|
await requestStream1.ExpectHeadersAsync();
|
|
|
await requestStream1.ExpectDataAsync();
|
|
await requestStream1.ExpectDataAsync();
|
|
|
|
|
|
|
|
- var requestStream2 = await Http3Api.CreateRequestStream();
|
|
|
|
|
-
|
|
|
|
|
- await requestStream2.SendHeadersAsync(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream2 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
await requestStream2.SendDataAsync(_maxData, endStream: false);
|
|
await requestStream2.SendDataAsync(_maxData, endStream: false);
|
|
|
|
|
|
|
|
await requestStream2.ExpectHeadersAsync();
|
|
await requestStream2.ExpectHeadersAsync();
|
|
@@ -514,10 +541,9 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
|
|
|
|
|
|
Logger.LogInformation("Sending first request");
|
|
Logger.LogInformation("Sending first request");
|
|
|
- var requestStream1 = await Http3Api.CreateRequestStream();
|
|
|
|
|
|
|
|
|
|
// _maxData is 16 KiB, and 16 KiB / 240 bytes/sec ~= 68 secs which is far above the grace period.
|
|
// _maxData is 16 KiB, and 16 KiB / 240 bytes/sec ~= 68 secs which is far above the grace period.
|
|
|
- await requestStream1.SendHeadersAsync(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream1 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
await requestStream1.SendDataAsync(_maxData, endStream: true);
|
|
await requestStream1.SendDataAsync(_maxData, endStream: true);
|
|
|
|
|
|
|
|
await requestStream1.ExpectHeadersAsync();
|
|
await requestStream1.ExpectHeadersAsync();
|
|
@@ -526,9 +552,7 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
await requestStream1.ExpectReceiveEndOfStream();
|
|
await requestStream1.ExpectReceiveEndOfStream();
|
|
|
|
|
|
|
|
Logger.LogInformation("Sending second request");
|
|
Logger.LogInformation("Sending second request");
|
|
|
- var requestStream2 = await Http3Api.CreateRequestStream();
|
|
|
|
|
-
|
|
|
|
|
- await requestStream2.SendHeadersAsync(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream2 = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_maxData.Length), endStream: false);
|
|
|
await requestStream2.SendDataAsync(_maxData, endStream: false);
|
|
await requestStream2.SendDataAsync(_maxData, endStream: false);
|
|
|
|
|
|
|
|
await requestStream2.ExpectHeadersAsync();
|
|
await requestStream2.ExpectHeadersAsync();
|
|
@@ -567,7 +591,7 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
|
|
|
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
Http3Api._timeoutControl.Initialize(mockSystemClock.UtcNow.Ticks);
|
|
|
|
|
|
|
|
- var requestStream = await Http3Api.InitializeConnectionAndStreamsAsync(context =>
|
|
|
|
|
|
|
+ await Http3Api.InitializeConnectionAsync(context =>
|
|
|
{
|
|
{
|
|
|
// Completely disable rate limiting for this stream.
|
|
// Completely disable rate limiting for this stream.
|
|
|
context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = null;
|
|
context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = null;
|
|
@@ -577,8 +601,10 @@ public class Http3TimeoutTests : Http3TestBase
|
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
var inboundControlStream = await Http3Api.GetInboundControlStream();
|
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
await inboundControlStream.ExpectSettingsAsync();
|
|
|
|
|
|
|
|
|
|
+ Http3Api.OutboundControlStream = await Http3Api.CreateControlStream();
|
|
|
|
|
+
|
|
|
// _helloWorldBytes is 12 bytes, and 12 bytes / 240 bytes/sec = .05 secs which is far below the grace period.
|
|
// _helloWorldBytes is 12 bytes, and 12 bytes / 240 bytes/sec = .05 secs which is far below the grace period.
|
|
|
- await requestStream.SendHeadersAsync(ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
|
|
|
|
|
|
|
+ var requestStream = await Http3Api.CreateRequestStream(ReadRateRequestHeaders(_helloWorldBytes.Length), endStream: false);
|
|
|
await requestStream.SendDataAsync(_helloWorldBytes, endStream: false);
|
|
await requestStream.SendDataAsync(_helloWorldBytes, endStream: false);
|
|
|
|
|
|
|
|
await requestStream.ExpectHeadersAsync();
|
|
await requestStream.ExpectHeadersAsync();
|