Skip to content
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ await connection.ReceiveEnd(
}

[Fact]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/58086")]
public async Task Http1Connection_ServerAbort_HasErrorType()
{
var testMeterFactory = new TestMeterFactory();
Expand All @@ -399,17 +400,25 @@ public async Task Http1Connection_ServerAbort_HasErrorType()
var serviceContext = new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory));

var sendString = "POST / HTTP/1.0\r\nContent-Length: 12\r\n\r\nHello World?";
var finishedSendingTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);

await using var server = new TestServer(c =>
await using var server = new TestServer(async c =>
{
await c.Request.Body.ReadUntilEndAsync();

// An extra check to ensure that client is done sending before the server aborts.
// This might not be necessary since we're reading to the end of the request body, but it doesn't hurt.
await finishedSendingTcs.Task;

c.Abort();
return Task.CompletedTask;
}, serviceContext);

using (var connection = server.CreateConnection())
{
await connection.Send(sendString).DefaultTimeout();

finishedSendingTcs.SetResult();

await connection.ReceiveEnd().DefaultTimeout();

await connection.WaitForConnectionClose().DefaultTimeout();
Expand Down
Loading