diff options
author | André Cruz <andre@cabine.org> | 2018-09-28 15:07:11 +0100 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-10-03 08:25:27 +0200 |
commit | 1bfd03565b943ea56e4bf7a1ca440b2bbfeb6454 (patch) | |
tree | a15c04f1ce92a07102b6bebb35d929db39d2dfe5 /lib | |
parent | b25e6abc6874dbfdc44f98ce93df3f94004a2318 (diff) | |
download | android-node-v8-1bfd03565b943ea56e4bf7a1ca440b2bbfeb6454.tar.gz android-node-v8-1bfd03565b943ea56e4bf7a1ca440b2bbfeb6454.tar.bz2 android-node-v8-1bfd03565b943ea56e4bf7a1ca440b2bbfeb6454.zip |
http2: don't send trailers on a closed connection
There is a race condition between onStreamCloseResponse(), which
removes the wantTrailers listener, and Http2Stream.close(), which
will invalidate the connection. IE, sendTrailers can be called on
a closed connection which would crash with a:
Error [ERR_HTTP2_INVALID_STREAM]: The stream has been destroyed
PR-URL: https://github.com/nodejs/node/pull/23146
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/http2/core.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 487bbe4f3b..a772fb277d 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -330,7 +330,7 @@ function tryClose(fd) { function onStreamTrailers() { const stream = this[kOwner]; stream[kState].trailersReady = true; - if (stream.destroyed) + if (stream.destroyed || stream.closed) return; if (!stream.emit('wantTrailers')) { // There are no listeners, send empty trailing HEADERS frame and close. |