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: add test-http2-large-file sequential test · nodejs/node@a414b07

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/sequential
    • test-http2-large-file.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/sequential/test-http2-large-file.js‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
// Test to ensure sending a large stream with a large initial window size works
4+
// See: https://github.com/nodejs/node/issues/19141
5+
6+
const common = require('../common');
7+
if (!common.hasCrypto)
8+
common.skip('missing crypto');
9+
10+
const http2 = require('http2');
11+
12+
const server = http2.createServer({ settings: { initialWindowSize: 6553500 } });
13+
server.on('stream', (stream) => {
14+
stream.resume();
15+
stream.respond();
16+
stream.end('ok');
17+
});
18+
19+
server.listen(0, common.mustCall(() => {
20+
let remaining = 1e8;
21+
const chunk = 1e6;
22+
const client = http2.connect(`http://localhost:${server.address().port}`,
23+
{ settings: { initialWindowSize: 6553500 } });
24+
const request = client.request({ ':method': 'POST' });
25+
function writeChunk() {
26+
if (remaining > 0) {
27+
remaining -= chunk;
28+
request.write(Buffer.alloc(chunk, 'a'), writeChunk);
29+
} else {
30+
request.end();
31+
}
32+
}
33+
writeChunk();
34+
request.on('close', common.mustCall(() => {
35+
client.close();
36+
server.close();
37+
}));
38+
request.resume();
39+
}));

0 commit comments

Comments
0 (0)
You are visitor 01402775 — 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.