From a1c95a4f9686e2bb7a83c474b89ee629e824b090 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Sat, 15 Sep 2018 10:36:55 -0700 Subject: [PATCH] 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. --- lib/internal/http2/core.js | 1 + test/parallel/test-http2-server-push-stream.js | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index f2a298b6e5df69..b734ac3917f89e 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -275,6 +275,7 @@ function onSessionHeaders(handle, id, cat, flags, headers) { } } else { stream = new ClientHttp2Stream(session, handle, id, opts); + stream.end(); } process.nextTick(emit, session, 'stream', stream, obj, flags, headers); } else { diff --git a/test/parallel/test-http2-server-push-stream.js b/test/parallel/test-http2-server-push-stream.js index 69e74349475c42..74d41ba4b9c672 100644 --- a/test/parallel/test-http2-server-push-stream.js +++ b/test/parallel/test-http2-server-push-stream.js @@ -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 = '';