Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Http3 test
  • Loading branch information
MihaZupan committed Aug 15, 2022
commit 4426774844c81c93f8425ae76ff84f612010a205
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override Task InitializeConnectionAsync()
throw new NotImplementedException();
}

private Task EnsureControlStreamAcceptedAsync()
public Task EnsureControlStreamAcceptedAsync()
{
if (_inboundControlStream != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,50 @@ public abstract class HttpClientHandler_MaxResponseHeadersLength_Test : HttpClie
{
public HttpClientHandler_MaxResponseHeadersLength_Test(ITestOutputHelper output) : base(output) { }

[Theory]
[InlineData(null)]
[InlineData(1)]
[InlineData(16)]
[InlineData(64)]
[InlineData(256)]
[InlineData(1024)]
[InlineData(10240)]
public async Task Http3Test(int? maxResponseHeadersLength)
{
if (UseVersion.Major != 3) return;

var requestCts = new CancellationTokenSource();
var controlStreamEstablishedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);

await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
{
using HttpClientHandler handler = CreateHttpClientHandler();
using HttpClient client = CreateHttpClient(handler);

if (maxResponseHeadersLength.HasValue)
{
handler.MaxResponseHeadersLength = maxResponseHeadersLength.Value;
}

await Assert.ThrowsAnyAsync<Exception>(() => client.GetAsync(uri, requestCts.Token));

await controlStreamEstablishedTcs.Task.WaitAsync(TestHelper.PassingTestTimeout);
},
async server =>
{
await server.AcceptConnectionAsync(async connection =>
{
requestCts.Cancel();

var http3Connection = (Http3LoopbackConnection)connection;

await http3Connection.EnsureControlStreamAcceptedAsync().WaitAsync(TestHelper.PassingTestTimeout);

controlStreamEstablishedTcs.SetResult();
});
});
}

[Theory]
[InlineData(0)]
[InlineData(-1)]
Expand Down