Still send 100 Continue with null MinRequestBodyDataRate (#31568)
This commit is contained in:
parent
dec60c8e37
commit
9facd9b193
|
|
@ -172,14 +172,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
|
||||
protected ValueTask<ReadResult> StartTimingReadAsync(ValueTask<ReadResult> readAwaitable, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
if (!readAwaitable.IsCompleted && _timingEnabled)
|
||||
if (!readAwaitable.IsCompleted)
|
||||
{
|
||||
TryProduceContinue();
|
||||
|
||||
if (_timingEnabled)
|
||||
{
|
||||
_backpressure = true;
|
||||
_context.TimeoutControl.StartTimingRead();
|
||||
}
|
||||
}
|
||||
|
||||
return readAwaitable;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -846,6 +846,42 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
}
|
||||
}
|
||||
|
||||
[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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue