Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5ecfd94

Browse filesBrowse files
lundibundiaddaleax
authored andcommitted
test: update and harden http2-reset-flood
* use new maxSessionInvalidFrames to lower the needed frames * slow down requests to generate less redundant after-session-close requests PR-URL: #30534 Fixes: #30505 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 092a3c2 commit 5ecfd94
Copy full SHA for 5ecfd94

File tree

Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http2-reset-flood.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-reset-flood.js
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { Worker, parentPort } = require('worker_threads');
1313
// the two event loops intermixing, as we are writing in a busy loop here.
1414

1515
if (process.env.HAS_STARTED_WORKER) {
16-
const server = http2.createServer();
16+
const server = http2.createServer({ maxSessionInvalidFrames: 100 });
1717
server.on('stream', (stream) => {
1818
stream.respond({
1919
'content-type': 'text/plain',
@@ -59,19 +59,22 @@ const worker = new Worker(__filename).on('message', common.mustCall((port) => {
5959
});
6060

6161
let gotError = false;
62+
let streamId = 1;
6263

6364
function writeRequests() {
64-
for (let i = 1; !gotError; i += 2) {
65+
for (let i = 1; i < 10 && !gotError; i++) {
6566
h2header[3] = 1; // HEADERS
6667
h2header[4] = 0x5; // END_HEADERS|END_STREAM
6768
h2header.writeIntBE(1, 0, 3); // Length: 1
68-
h2header.writeIntBE(i, 5, 4); // Stream ID
69+
h2header.writeIntBE(streamId, 5, 4); // Stream ID
70+
streamId += 2;
6971
// 0x88 = :status: 200
7072
if (!conn.write(Buffer.concat([h2header, Buffer.from([0x88])]))) {
71-
process.nextTick(writeRequests);
7273
break;
7374
}
7475
}
76+
if (!gotError)
77+
setImmediate(writeRequests);
7578
}
7679

7780
conn.once('error', common.mustCall(() => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.