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: check endless loop while writing empty string · nodejs/node@bac9344

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-http2-client-write-empty-string.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-http2-client-write-empty-string.js‎

Copy file name to clipboard
+54Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict';
2+
3+
const assert = require('assert');
4+
const http2 = require('http2');
5+
6+
const common = require('../common');
7+
if (!common.hasCrypto)
8+
common.skip('missing crypto');
9+
10+
for (const chunkSequence of [
11+
[ '' ],
12+
[ '', '' ]
13+
]) {
14+
const server = http2.createServer();
15+
server.on('stream', common.mustCall((stream, headers, flags) => {
16+
stream.respond({ 'content-type': 'text/html' });
17+
18+
let data = '';
19+
stream.on('data', common.mustNotCall((chunk) => {
20+
data += chunk.toString();
21+
}));
22+
stream.on('end', common.mustCall(() => {
23+
stream.end(`"${data}"`);
24+
}));
25+
}));
26+
27+
server.listen(0, common.mustCall(() => {
28+
const port = server.address().port;
29+
const client = http2.connect(`http://localhost:${port}`);
30+
31+
const req = client.request({
32+
':method': 'POST',
33+
':path': '/'
34+
});
35+
36+
req.on('response', common.mustCall((headers) => {
37+
assert.strictEqual(headers[':status'], 200);
38+
assert.strictEqual(headers['content-type'], 'text/html');
39+
}));
40+
41+
let data = '';
42+
req.setEncoding('utf8');
43+
req.on('data', common.mustCallAtLeast((d) => data += d));
44+
req.on('end', common.mustCall(() => {
45+
assert.strictEqual(data, '""');
46+
server.close();
47+
client.close();
48+
}));
49+
50+
for (const chunk of chunkSequence)
51+
req.write(chunk);
52+
req.end();
53+
}));
54+
}

0 commit comments

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