Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,15 @@ protected void AddAndCheckObservedBytes(long observedBytes)

protected ValueTask<ReadResult> StartTimingReadAsync(ValueTask<ReadResult> readAwaitable, CancellationToken cancellationToken)
{

if (!readAwaitable.IsCompleted && _timingEnabled)
if (!readAwaitable.IsCompleted)
{
TryProduceContinue();

_backpressure = true;
_context.TimeoutControl.StartTimingRead();
if (_timingEnabled)
{
_backpressure = true;
_context.TimeoutControl.StartTimingRead();
}
}

return readAwaitable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,42 @@ await connection.ReceiveEnd(
}
}

[Fact]
public async Task Expect100ContinueHonoredWhenMinRequestBodyDataRateIsDisabled()
{
var testContext = new TestServiceContext(LoggerFactory);

// This may seem unrelated, but this is a regression test for
// https://github.com/dotnet/aspnetcore/issues/30449
testContext.ServerOptions.Limits.MinRequestBodyDataRate = null;

await using (var server = new TestServer(TestApp.EchoAppChunked, testContext))
{
using (var connection = server.CreateConnection())
{
await connection.Send(
"POST / HTTP/1.1",
"Host:",
"Expect: 100-continue",
"Connection: close",
"Content-Length: 11",
"\r\n");
await connection.Receive(
"HTTP/1.1 100 Continue",
"",
"");
await connection.Send("Hello World");
await connection.ReceiveEnd(
"HTTP/1.1 200 OK",
"Connection: close",
$"Date: {testContext.DateHeaderValue}",
"Content-Length: 11",
"",
"Hello World");
}
}
}

[Fact]
public async Task ZeroContentLengthAssumedOnNonKeepAliveRequestsWithoutContentLengthOrTransferEncodingHeader()
{
Expand Down