diff --git a/Directory.Build.targets b/Directory.Build.targets index 78626b773e..73b97f2807 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,5 @@ - $(MicrosoftNETCoreApp20PackageVersion) $(MicrosoftNETCoreApp21PackageVersion) $(MicrosoftNETCoreApp22PackageVersion) $(NETStandardLibrary20PackageVersion) diff --git a/benchmarks/Kestrel.Performance/Kestrel.Performance.csproj b/benchmarks/Kestrel.Performance/Kestrel.Performance.csproj index 0fb7d5af0a..8be37d2c9c 100644 --- a/benchmarks/Kestrel.Performance/Kestrel.Performance.csproj +++ b/benchmarks/Kestrel.Performance/Kestrel.Performance.csproj @@ -4,7 +4,7 @@ Kestrel.Performance Microsoft.AspNetCore.Server.Kestrel.Performance - netcoreapp2.0 + netcoreapp2.1 Exe true true diff --git a/benchmarks/Kestrel.Performance/README.md b/benchmarks/Kestrel.Performance/README.md index 50418ef343..47ff9b906d 100644 --- a/benchmarks/Kestrel.Performance/README.md +++ b/benchmarks/Kestrel.Performance/README.md @@ -4,10 +4,10 @@ build /t:compile /p:Configuration=Release ``` To run a specific benchmark add it as parameter ``` -dotnet run -f netcoreapp2.0 -c Release RequestParsing +dotnet run -f netcoreapp2.1 -c Release RequestParsing ``` To run all use `All` as parameter ``` -dotnet run -f netcoreapp2.0 -c Release All +dotnet run -f netcoreapp2.1 -c Release All ``` Using no parameter will list all available benchmarks diff --git a/build/dependencies.props b/build/dependencies.props index 52e476ce07..e3034e59f7 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -29,7 +29,6 @@ 3.0.0-alpha1-10605 3.0.0-alpha1-10605 2.1.1 - 2.0.9 2.1.3 2.2.0-preview2-26905-02 3.0.0-alpha1-10605 diff --git a/build/repo.props b/build/repo.props index fb1ef593d7..9a2f9c7fad 100644 --- a/build/repo.props +++ b/build/repo.props @@ -9,7 +9,6 @@ - diff --git a/samples/Http2SampleApp/Http2SampleApp.csproj b/samples/Http2SampleApp/Http2SampleApp.csproj index bba5c00453..115aaa9365 100644 --- a/samples/Http2SampleApp/Http2SampleApp.csproj +++ b/samples/Http2SampleApp/Http2SampleApp.csproj @@ -14,10 +14,4 @@ - - - PreserveNewest - - - diff --git a/samples/Http2SampleApp/Program.cs b/samples/Http2SampleApp/Program.cs index 0825c6e3d5..f1fc2223cf 100644 --- a/samples/Http2SampleApp/Program.cs +++ b/samples/Http2SampleApp/Program.cs @@ -42,7 +42,7 @@ namespace Http2SampleApp options.Listen(IPAddress.Any, basePort + 1, listenOptions => { listenOptions.Protocols = HttpProtocols.Http1AndHttp2; - listenOptions.UseHttps("testCert.pfx", "testPassword"); + listenOptions.UseHttps(); listenOptions.ConnectionAdapters.Add(new TlsFilterAdapter()); }); diff --git a/samples/Http2SampleApp/testCert.pfx b/samples/Http2SampleApp/testCert.pfx deleted file mode 100644 index 7118908c2d..0000000000 Binary files a/samples/Http2SampleApp/testCert.pfx and /dev/null differ diff --git a/samples/SampleApp/SampleApp.csproj b/samples/SampleApp/SampleApp.csproj index 391d54420e..6ccac54b77 100644 --- a/samples/SampleApp/SampleApp.csproj +++ b/samples/SampleApp/SampleApp.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.2;net461 @@ -17,12 +17,6 @@ - - - PreserveNewest - - - PreserveNewest diff --git a/samples/SampleApp/Startup.cs b/samples/SampleApp/Startup.cs index 6cc37cc58a..ad38e3920d 100644 --- a/samples/SampleApp/Startup.cs +++ b/samples/SampleApp/Startup.cs @@ -106,7 +106,7 @@ namespace SampleApp options.Listen(IPAddress.Loopback, basePort + 1, listenOptions => { - listenOptions.UseHttps("testCert.pfx", "testPassword"); + listenOptions.UseHttps(); listenOptions.UseConnectionLogging(); }); diff --git a/samples/SampleApp/appsettings.Production.json b/samples/SampleApp/appsettings.Production.json index 8719fb89b7..71c9c03be0 100644 --- a/samples/SampleApp/appsettings.Production.json +++ b/samples/SampleApp/appsettings.Production.json @@ -4,10 +4,6 @@ "NamedEndpoint": { "Url": "http://*:6000" }, "NamedHttpsEndpoint": { "Url": "https://*:6443", - "Certificate": { - "Path": "testCert.pfx", - "Password": "testPassword" - } } } } diff --git a/samples/SampleApp/testCert.pfx b/samples/SampleApp/testCert.pfx deleted file mode 100644 index 7118908c2d..0000000000 Binary files a/samples/SampleApp/testCert.pfx and /dev/null differ diff --git a/samples/SystemdTestApp/Startup.cs b/samples/SystemdTestApp/Startup.cs index 0b3c5e05de..e91322a827 100644 --- a/samples/SystemdTestApp/Startup.cs +++ b/samples/SystemdTestApp/Startup.cs @@ -64,7 +64,7 @@ namespace SystemdTestApp options.Listen(IPAddress.Loopback, basePort + 1, listenOptions => { - listenOptions.UseHttps("testCert.pfx", "testPassword"); + listenOptions.UseHttps(); listenOptions.UseConnectionLogging(); }); diff --git a/samples/SystemdTestApp/SystemdTestApp.csproj b/samples/SystemdTestApp/SystemdTestApp.csproj index 3ebca42550..3f8e753d37 100644 --- a/samples/SystemdTestApp/SystemdTestApp.csproj +++ b/samples/SystemdTestApp/SystemdTestApp.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.2;net461 @@ -15,10 +15,4 @@ - - - PreserveNewest - - - diff --git a/samples/SystemdTestApp/testCert.pfx b/samples/SystemdTestApp/testCert.pfx deleted file mode 100644 index 7118908c2d..0000000000 Binary files a/samples/SystemdTestApp/testCert.pfx and /dev/null differ diff --git a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs index 3d71d253d3..1b94337efc 100644 --- a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2StreamTests.cs @@ -1218,7 +1218,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await StartStreamAsync(1, headers, endStream: false); await SendDataAsync(1, new byte[6], endStream: false); await SendDataAsync(1, new byte[6], endStream: false); - await SendDataAsync(1, new byte[6], endStream: true); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 59, @@ -1229,6 +1228,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests withFlags: (byte)Http2DataFrameFlags.END_STREAM, withStreamId: 1); + await WaitForStreamErrorAsync(1, Http2ErrorCode.NO_ERROR, null); + // Logged without an exception. + Assert.Contains(TestApplicationErrorLogger.Messages, m => m.Message.Contains("the application completed without reading the entire request body.")); + await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); _hpackDecoder.Decode(headersFrame.PayloadSequence, endHeaders: false, handler: this); @@ -1277,7 +1280,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await StartStreamAsync(1, headers, endStream: false); await SendDataAsync(1, new byte[6], endStream: false); await SendDataAsync(1, new byte[6], endStream: false); - await SendDataAsync(1, new byte[6], endStream: true); + await SendDataAsync(1, new byte[6], endStream: false); var headersFrame = await ExpectAsync(Http2FrameType.HEADERS, withLength: 59, @@ -1287,6 +1290,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests withLength: 0, withFlags: (byte)Http2DataFrameFlags.END_STREAM, withStreamId: 1); + await WaitForStreamErrorAsync(1, Http2ErrorCode.NO_ERROR, null); + // Logged without an exception. + Assert.Contains(TestApplicationErrorLogger.Messages, m => m.Message.Contains("the application completed without reading the entire request body.")); await StopConnectionAsync(expectedLastStreamId: 1, ignoreNonGoAwayFrames: false); diff --git a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs index 147c153226..563837bcfb 100644 --- a/test/Kestrel.InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; +using Microsoft.AspNetCore.Testing; using Microsoft.Net.Http.Headers; using Moq; using Xunit; @@ -16,6 +17,31 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests { public class Http2TimeoutTests : Http2TestBase { + [Fact] + public async Task Preamble_NotReceivedInitially_WithinKeepAliveTimeout_ClosesConnection() + { + var mockSystemClock = _serviceContext.MockSystemClock; + var limits = _serviceContext.ServerOptions.Limits; + + _timeoutControl.Initialize(mockSystemClock.UtcNow); + + CreateConnection(); + + _connectionTask = _connection.ProcessRequestsAsync(new DummyApplication(_noopApplication)); + + mockSystemClock.UtcNow += limits.KeepAliveTimeout + Heartbeat.Interval; + _timeoutControl.Tick(mockSystemClock.UtcNow); + + _mockTimeoutHandler.Verify(h => h.OnTimeout(It.IsAny()), Times.Never); + + mockSystemClock.UtcNow += TimeSpan.FromTicks(1); + _timeoutControl.Tick(mockSystemClock.UtcNow); + + _mockTimeoutHandler.Verify(h => h.OnTimeout(TimeoutReason.KeepAlive), Times.Once); + + await WaitForConnectionStopAsync(expectedLastStreamId: 0, ignoreNonGoAwayFrames: false); + } + [Fact] public async Task HEADERS_NotReceivedInitially_WithinKeepAliveTimeout_ClosesConnection() { @@ -66,9 +92,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests }); // Send continuation frame to verify intermediate request header timeout doesn't interfere with keep-alive timeout. - await SendHeadersAsync(1, Http2HeadersFrameFlags.NONE, _browserRequestHeaders); + await SendHeadersAsync(1, Http2HeadersFrameFlags.END_STREAM, _browserRequestHeaders); await SendEmptyContinuationFrameAsync(1, Http2ContinuationFrameFlags.END_HEADERS); - await SendDataAsync(1, new Memory(), endStream: true); _mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny(), TimeoutReason.RequestHeaders), Times.Once); @@ -106,7 +131,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await InitializeConnectionAsync(_noopApplication); - await SendHeadersAsync(1, Http2HeadersFrameFlags.NONE, _browserRequestHeaders); + await SendHeadersAsync(1, Http2HeadersFrameFlags.END_STREAM, _browserRequestHeaders); await SendEmptyContinuationFrameAsync(1, Http2ContinuationFrameFlags.NONE); diff --git a/tools/CodeGenerator/CodeGenerator.csproj b/tools/CodeGenerator/CodeGenerator.csproj index 6931838ffe..484d758e7c 100644 --- a/tools/CodeGenerator/CodeGenerator.csproj +++ b/tools/CodeGenerator/CodeGenerator.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + netcoreapp2.2 Exe false true