Ack settings before window updates #2772

This commit is contained in:
Chris Ross (ASP.NET) 2018-08-08 09:46:00 -07:00
parent c73d513289
commit 5378900e0c
3 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,6 @@ namespace Http2SampleApp
options.Listen(IPAddress.Any, basePort, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1;
listenOptions.UseConnectionLogging();
});
// TLS Http/1.1 or HTTP/2 endpoint negotiated via ALPN
@ -44,7 +43,6 @@ namespace Http2SampleApp
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
listenOptions.UseHttps("testCert.pfx", "testPassword");
// listenOptions.UseConnectionLogging();
listenOptions.ConnectionAdapters.Add(new TlsFilterAdapter());
});
@ -53,7 +51,6 @@ namespace Http2SampleApp
options.Listen(IPAddress.Any, basePort + 5, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
// listenOptions.UseConnectionLogging();
});
})
.UseContentRoot(Directory.GetCurrentDirectory())

View File

@ -608,6 +608,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
_clientSettings.ParseFrame(_incomingFrame);
var ackTask = _frameWriter.WriteSettingsAckAsync(); // Ack before we update the windows, they could send data immediately.
// This difference can be negative.
var windowSizeDifference = (int)_clientSettings.InitialWindowSize - previousInitialWindowSize;
@ -625,7 +627,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
}
}
return _frameWriter.WriteSettingsAckAsync();
return ackTask;
}
catch (Http2SettingsParameterOutOfRangeException ex)
{

View File

@ -2328,6 +2328,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
_clientSettings.InitialWindowSize += 1;
await SendSettingsAsync();
await ExpectAsync(Http2FrameType.SETTINGS,
withLength: 0,
withFlags: (byte)Http2SettingsFrameFlags.ACK,
withStreamId: 0);
await WaitForConnectionErrorAsync<Http2ConnectionErrorException>(
ignoreNonGoAwayFrames: false,
expectedLastStreamId: 1,