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 9cd1f53

Browse filesBrowse files
kumarakBethGriggs
authored andcommitted
http2: add tests for cancel event while client is paused reading
Backport-PR-URL: #39659 PR-URL: #39622 Refs: #39423 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
1 parent 2008c97 commit 9cd1f53
Copy full SHA for 9cd1f53

1 file changed

+36Lines changed: 36 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
const common = require('../common');
3+
const fixtures = require('../common/fixtures');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
}
7+
8+
const http2 = require('http2');
9+
const key = fixtures.readKey('agent1-key.pem', 'binary');
10+
const cert = fixtures.readKey('agent1-cert.pem', 'binary');
11+
12+
const server = http2.createSecureServer({ key, cert });
13+
14+
let client_stream;
15+
16+
server.on('stream', common.mustCall(function(stream) {
17+
stream.resume();
18+
stream.on('data', function(chunk) {
19+
stream.write(chunk);
20+
client_stream.pause();
21+
client_stream.close(http2.constants.NGHTTP2_CANCEL);
22+
});
23+
}));
24+
25+
server.listen(0, function() {
26+
const client = http2.connect(`https://localhost:${server.address().port}`,
27+
{ rejectUnauthorized: false }
28+
);
29+
client_stream = client.request({ ':method': 'POST' });
30+
client_stream.on('close', common.mustCall(() => {
31+
client.close();
32+
server.close();
33+
}));
34+
client_stream.resume();
35+
client_stream.write(Buffer.alloc(1024 * 1024));
36+
});

0 commit comments

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