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 — http2: fix error stream write followed by destroy · nodejs/node@92bd7b5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/http2
    • core.js
  • test/parallel
    • test-http2-destroy-after-write.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/http2/core.js‎

Copy file name to clipboardExpand all lines: lib/internal/http2/core.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ function debugStream(id, sessionType, message, ...args) {
167167
}
168168

169169
function debugStreamObj(stream, message, ...args) {
170-
debugStream(stream[kID], stream[kSession][kType], message, ...args);
170+
const session = stream[kSession];
171+
const type = session ? session[kType] : undefined;
172+
debugStream(stream[kID], type, message, ...args);
171173
}
172174

173175
function debugSession(sessionType, message, ...args) {
Collapse file

‎test/parallel/test-http2-destroy-after-write.js‎

Copy file name to clipboard
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
}
6+
7+
const http2 = require('http2');
8+
const assert = require('assert');
9+
10+
const server = http2.createServer();
11+
12+
server.on('session', common.mustCall(function(session) {
13+
session.on('stream', common.mustCall(function(stream) {
14+
stream.on('end', common.mustCall(function() {
15+
this.respond({
16+
':status': 200
17+
});
18+
this.write('foo');
19+
this.destroy();
20+
}));
21+
stream.resume();
22+
}));
23+
}));
24+
25+
server.listen(0, function() {
26+
const client = http2.connect(`http://localhost:${server.address().port}`);
27+
const stream = client.request({ ':method': 'POST' });
28+
stream.on('response', common.mustCall(function(headers) {
29+
assert.strictEqual(headers[':status'], 200);
30+
}));
31+
stream.on('close', common.mustCall(() => {
32+
client.close();
33+
server.close();
34+
}));
35+
stream.resume();
36+
stream.end();
37+
});

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.