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.

Backport-PR-URL: #22850
PR-URL: #22878
Fixes: #22851
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
apapirovski authored and BethGriggs committed Oct 16, 2018
1 parent 49f44f3 commit ca933ce
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 @@ -220,6 +220,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 ca933ce

Please sign in to comment.