Don't ACK ACKs (#2767)

This commit is contained in:
Stephen Halter 2018-07-30 12:25:32 -07:00 committed by GitHub
parent 47e643f20a
commit 6d46410a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -541,9 +541,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
throw new Http2ConnectionErrorException(CoreStrings.FormatHttp2ErrorStreamIdNotZero(_incomingFrame.Type), Http2ErrorCode.PROTOCOL_ERROR);
}
if ((_incomingFrame.SettingsFlags & Http2SettingsFrameFlags.ACK) == Http2SettingsFrameFlags.ACK && _incomingFrame.Length != 0)
if ((_incomingFrame.SettingsFlags & Http2SettingsFrameFlags.ACK) == Http2SettingsFrameFlags.ACK)
{
throw new Http2ConnectionErrorException(CoreStrings.Http2ErrorSettingsAckLengthNotZero, Http2ErrorCode.FRAME_SIZE_ERROR);
if (_incomingFrame.Length != 0)
{
throw new Http2ConnectionErrorException(CoreStrings.Http2ErrorSettingsAckLengthNotZero, Http2ErrorCode.FRAME_SIZE_ERROR);
}
return Task.CompletedTask;
}
if (_incomingFrame.Length % 6 != 0)

View File

@ -2203,6 +2203,18 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
await StopConnectionAsync(expectedLastStreamId: 0, ignoreNonGoAwayFrames: false);
}
[Fact]
public async Task SETTINGS_ACK_Received_DoesNotSend_ACK()
{
await InitializeConnectionAsync(_noopApplication);
var frame = new Http2Frame();
frame.PrepareSettings(Http2SettingsFrameFlags.ACK);
await SendAsync(frame.Raw);
await StopConnectionAsync(expectedLastStreamId: 0, ignoreNonGoAwayFrames: false);
}
[Fact]
public async Task SETTINGS_Received_StreamIdNotZero_ConnectionError()
{