GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: update and harden http2-reset-flood · nodejs/node@518fd8f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http2-reset-flood.js
Expand file treeCollapse file tree
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-3Lines changed: 7 additions & 3 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,16 +59,20 @@ 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
conn.write(Buffer.concat([h2header, Buffer.from([0x88])]));
7173
}
74+
if (!gotError)
75+
setImmediate(writeRequests);
7276
}
7377

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

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.