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: deflake test-http2-misbehaving-multiplex · nodejs/node@2efec62

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http2-misbehaving-multiplex.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http2-misbehaving-multiplex.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-misbehaving-multiplex.js
+21-18Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,30 @@ const h2 = require('http2');
1111
const net = require('net');
1212
const { NghttpError } = require('internal/http2/util');
1313
const h2test = require('../common/http2');
14+
let client;
1415

1516
const server = h2.createServer();
1617
server.on('stream', common.mustCall((stream) => {
1718
stream.respond();
18-
stream.end('ok');
1919

20-
stream.on('error', common.expectsError({
21-
code: 'ERR_HTTP2_ERROR',
22-
constructor: NghttpError,
23-
message: 'Stream was already closed or invalid'
24-
}));
25-
stream.on('close', common.mustCall());
20+
if (stream.id === 3) {
21+
stream.on('close', () => {
22+
// A second Stream ID 1 frame should fail.
23+
// This will cause an error to occur because the client is
24+
// attempting to reuse an already closed stream. This must
25+
// cause the server session to be torn down.
26+
client.write(id1.data);
27+
// This Stream ID 5 frame will never make it to the server.
28+
client.write(id5.data);
29+
});
30+
stream.end('ok');
31+
} else {
32+
stream.on('error', common.expectsError({
33+
code: 'ERR_HTTP2_ERROR',
34+
constructor: NghttpError,
35+
message: 'Stream was already closed or invalid'
36+
}));
37+
}
2638

2739
// Stream ID 5 should never reach the server
2840
assert.notStrictEqual(stream.id, 5);
@@ -45,23 +57,14 @@ const id3 = new h2test.HeadersFrame(3, h2test.kFakeRequestHeaders, 0, true);
4557
const id5 = new h2test.HeadersFrame(5, h2test.kFakeRequestHeaders, 0, true);
4658

4759
server.listen(0, () => {
48-
const client = net.connect(server.address().port, () => {
60+
client = net.connect(server.address().port, () => {
4961
client.write(h2test.kClientMagic, () => {
5062
client.write(settings.data, () => {
5163
client.write(settingsAck.data);
5264
// Stream ID 1 frame will make it OK.
5365
client.write(id1.data, () => {
5466
// Stream ID 3 frame will make it OK.
55-
client.write(id3.data, () => {
56-
// A second Stream ID 1 frame should fail.
57-
// This will cause an error to occur because the client is
58-
// attempting to reuse an already closed stream. This must
59-
// cause the server session to be torn down.
60-
client.write(id1.data, () => {
61-
// This Stream ID 5 frame will never make it to the server
62-
client.write(id5.data);
63-
});
64-
});
67+
client.write(id3.data);
6568
});
6669
});
6770
});

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.