Skip to content

Commit c9ac10d

Browse files
committed
nits and bad merge conflict resolution
1 parent 1f35f3a commit c9ac10d

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

src/Servers/Kestrel/Core/src/Internal/Http/Http1ContentLengthMessageBody.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override async ValueTask<ReadResult> ReadAsync(CancellationToken cancella
4545
// We internally track an int for that.
4646
while (true)
4747
{
48-
// _context.RequestTimedOut The issue is that TryRead can get a canceled read result
48+
// The issue is that TryRead can get a canceled read result
4949
// which is unknown to StartTimingReadAsync.
5050
if (_context.RequestTimedOut)
5151
{

src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport;
1919
using Microsoft.AspNetCore.Testing;
2020
using Microsoft.Extensions.Logging.Testing;
21-
using Moq;
2221
using Xunit;
2322

2423
namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
@@ -731,9 +730,11 @@ await connection.ReceiveEnd(
731730
[Fact]
732731
public async Task ConnectionClosesWhenFinReceivedBeforeRequestCompletes()
733732
{
734-
var testContext = new TestServiceContext(LoggerFactory);
735-
// FIN callbacks are scheduled so run inline to make this test more reliable
736-
testContext.Scheduler = PipeScheduler.Inline;
733+
var testContext = new TestServiceContext(LoggerFactory)
734+
{
735+
// FIN callbacks are scheduled so run inline to make this test more reliable
736+
Scheduler = PipeScheduler.Inline
737+
};
737738

738739
using (var server = new TestServer(TestApp.EchoAppChunked, testContext))
739740
{
@@ -1317,7 +1318,24 @@ public async Task SynchronousReadsCanBeAllowedGlobally()
13171318

13181319
Assert.Equal(0, await context.Request.Body.ReadAsync(new byte[1], 0, 1));
13191320
Assert.Equal("Hello", Encoding.ASCII.GetString(buffer, 0, 5));
1320-
}));
1321+
}, testContext))
1322+
{
1323+
using (var connection = server.CreateConnection())
1324+
{
1325+
await connection.Send(
1326+
"POST / HTTP/1.1",
1327+
"Host:",
1328+
"Content-Length: 5",
1329+
"",
1330+
"Hello");
1331+
await connection.Receive(
1332+
"HTTP/1.1 200 OK",
1333+
$"Date: {server.Context.DateHeaderValue}",
1334+
"Content-Length: 0",
1335+
"",
1336+
"");
1337+
}
1338+
}
13211339
}
13221340

13231341
[Fact]
@@ -1394,6 +1412,7 @@ public async Task ContentLengthRequestCallCompleteThrowsExceptionOnRead()
13941412
response.Headers["Content-Length"] = new[] { "11" };
13951413

13961414
await response.BodyPipe.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello World"), 0, 11));
1415+
13971416
}, testContext))
13981417
{
13991418
using (var connection = server.CreateConnection())
@@ -1404,12 +1423,6 @@ await connection.Send(
14041423
"Content-Length: 5",
14051424
"",
14061425
"Hello");
1407-
await connection.Receive(
1408-
"HTTP/1.1 200 OK",
1409-
$"Date: {server.Context.DateHeaderValue}",
1410-
"Content-Length: 0",
1411-
"",
1412-
"");
14131426

14141427
await connection.Receive(
14151428
"HTTP/1.1 200 OK",

0 commit comments

Comments
 (0)