From a2f63e7ca606c733998e7477a5074d93202e9f7f Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Fri, 8 Nov 2024 07:18:31 +0000 Subject: [PATCH] h2: do not emit data after goaway (#3811) Signed-off-by: Matteo Collina --- lib/dispatcher/client-h2.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/dispatcher/client-h2.js b/lib/dispatcher/client-h2.js index 7d619fac4f6..ef6d47a0c9c 100644 --- a/lib/dispatcher/client-h2.js +++ b/lib/dispatcher/client-h2.js @@ -510,16 +510,18 @@ function writeH2 (client, request) { }) stream.once('error', function (err) { + stream.removeAllListeners('data') abort(err) }) stream.once('frameError', (type, code) => { + stream.removeAllListeners('data') abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`)) }) - // stream.on('aborted', () => { - // // TODO(HTTP/2): Support aborted - // }) + stream.on('aborted', () => { + stream.removeAllListeners('data') + }) // stream.on('timeout', () => { // // TODO(HTTP/2): Support timeout