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 authored and Michaël Zasso committed 2018-09-23 16:53:45 +02:00
1 parent b6cd18517c
commit badc38f305
2 files changed
+2

No files matched your search

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