Skip to content

Commit ada4abf

Browse files
authored
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 <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent bc09144 commit ada4abf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/node_http2.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ int Http2Session::OnFrameNotSent(nghttp2_session* handle,
12111211
// closed but the Http2Session will still be up causing a memory leak.
12121212
// Therefore, if the GOAWAY frame couldn't be send due to
12131213
// ERR_SESSION_CLOSING we should force close from our side.
1214-
if (frame->hd.type != 0x03) {
1214+
if (frame->hd.type != NGHTTP2_GOAWAY) {
12151215
return 0;
12161216
}
12171217
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ async function requestAndClose(server) {
2929
// Send a valid HEADERS frame
3030
const headersFrame = 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)