HTTP/2: close the connection with PROTOCOL_ERROR when a PUSH_PROMISE frame is received.
This commit is contained in:
parent
9687079723
commit
e2af346733
|
|
@ -208,6 +208,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
|
||||||
return ProcessRstStreamFrameAsync();
|
return ProcessRstStreamFrameAsync();
|
||||||
case Http2FrameType.SETTINGS:
|
case Http2FrameType.SETTINGS:
|
||||||
return ProcessSettingsFrameAsync();
|
return ProcessSettingsFrameAsync();
|
||||||
|
case Http2FrameType.PUSH_PROMISE:
|
||||||
|
throw new Http2ConnectionErrorException(Http2ErrorCode.PROTOCOL_ERROR);
|
||||||
case Http2FrameType.PING:
|
case Http2FrameType.PING:
|
||||||
return ProcessPingFrameAsync();
|
return ProcessPingFrameAsync();
|
||||||
case Http2FrameType.GOAWAY:
|
case Http2FrameType.GOAWAY:
|
||||||
|
|
|
||||||
|
|
@ -852,6 +852,16 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
await WaitForConnectionErrorAsync(expectedLastStreamId: 0, expectedErrorCode: Http2ErrorCode.FRAME_SIZE_ERROR, ignoreNonGoAwayFrames: false);
|
await WaitForConnectionErrorAsync(expectedLastStreamId: 0, expectedErrorCode: Http2ErrorCode.FRAME_SIZE_ERROR, ignoreNonGoAwayFrames: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task PUSH_PROMISE_Received_ConnectionError()
|
||||||
|
{
|
||||||
|
await InitializeConnectionAsync(_noopApplication);
|
||||||
|
|
||||||
|
await SendPushPromiseFrameAsync();
|
||||||
|
|
||||||
|
await WaitForConnectionErrorAsync(expectedLastStreamId: 0, expectedErrorCode: Http2ErrorCode.PROTOCOL_ERROR, ignoreNonGoAwayFrames: false);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task PING_Received_Sends_ACK()
|
public async Task PING_Received_Sends_ACK()
|
||||||
{
|
{
|
||||||
|
|
@ -1280,6 +1290,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
|
||||||
return SendAsync(frame.Raw);
|
return SendAsync(frame.Raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task SendPushPromiseFrameAsync()
|
||||||
|
{
|
||||||
|
var frame = new Http2Frame();
|
||||||
|
frame.Length = 0;
|
||||||
|
frame.Type = Http2FrameType.PUSH_PROMISE;
|
||||||
|
frame.StreamId = 1;
|
||||||
|
return SendAsync(frame.Raw);
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<bool> SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, IEnumerable<KeyValuePair<string, string>> headers)
|
private async Task<bool> SendHeadersAsync(int streamId, Http2HeadersFrameFlags flags, IEnumerable<KeyValuePair<string, string>> headers)
|
||||||
{
|
{
|
||||||
var frame = new Http2Frame();
|
var frame = new Http2Frame();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue