http2: do not falsely emit 'aborted' on push

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: https://github.com/nodejs/node/pull/22878
Fixes: https://github.com/nodejs/node/issues/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>
This commit is contained in:
Anatoli Papirovski 2018-09-15 10:36:55 -07:00 committed by Anna Henningsen
parent e758d4ab0a
commit e72c6af6c8
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
2 changed files with 2 additions and 0 deletions

View File

@ -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;

View File

@ -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 = '';