Skip to content

Commit 9baf580

Browse files
hgqxjjaduh95
authored andcommitted
http2: fix check for frame->hd.type
According to the comment, this should be checking whether `frame->hd.type` is `NGHTTP2_GOAWAY`, i.e. `0x07` and not `0x03`. PR-URL: #57644 Refs: 1b693fa Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 44c5718 commit 9baf580

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎src/node_http2.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ int Http2Session::OnFrameNotSent(nghttp2_session* handle,
12131213
// closed but the Http2Session will still be up causing a memory leak.
12141214
// Therefore, if the GOAWAY frame couldn't be send due to
12151215
// ERR_SESSION_CLOSING we should force close from our side.
1216-
if (frame->hd.type != 0x03) {
1216+
if (frame->hd.type != NGHTTP2_GOAWAY) {
12171217
return0;
12181218
}
12191219
}

‎test/parallel/test-http2-premature-close.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ async function requestAndClose(server) {
2929
// Send a valid HEADERS frame
3030
constheadersFrame=Buffer.concat([
3131
Buffer.from([
32-
0x00,0x00,0x0c,// Length: 12 bytes
32+
0x00,0x00,0x0e,// Length: 14 bytes
3333
0x01,// Type: HEADERS
34-
0x05,// Flags: END_HEADERS + END_STREAM
34+
0x04,// Flags: END_HEADERS
3535
(streamId>>24)&0xFF,// Stream ID: high byte
3636
(streamId>>16)&0xFF,
3737
(streamId>>8)&0xFF,
@@ -41,7 +41,7 @@ async function requestAndClose(server) {
4141
0x82,// Indexed Header Field Representation (Predefined ":method: GET")
4242
0x84,// Indexed Header Field Representation (Predefined ":path: /")
4343
0x86,// Indexed Header Field Representation (Predefined ":scheme: http")
44-
0x44,0x0a,// Custom ":authority: localhost"
44+
0x41,0x09,// ":authority: localhost" Length: 9 bytes
4545
0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74,
4646
]),
4747
]);

0 commit comments

Comments
 (0)