Skip to content

Commit

Permalink
http2: do not falsely emit 'aborted' on push
Browse files Browse the repository at this point in the history
A push stream should have its writable side closed upon receipt,
to avoid emitting the 'aborted' event when the readable side
is closed.

PR-URL: #22878
Fixes: #22851
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
apapirovski authored and addaleax committed Sep 22, 2018
1 parent e758d4a commit e72c6af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ function onSessionHeaders(handle, id, cat, flags, headers) {
}
} else {
stream = new ClientHttp2Stream(session, handle, id, opts);
stream.end();
}
if (endOfStream)
stream[kState].endAfterHeaders = true;
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-http2-server-push-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ server.listen(0, common.mustCall(() => {
assert.strictEqual(headers['content-type'], 'text/html');
assert.strictEqual(headers['x-push-data'], 'pushed by server');
}));
stream.on('aborted', common.mustNotCall());
}));

let data = '';
Expand Down

0 comments on commit e72c6af

Please sign in to comment.