diff options
author | Matteo Collina <hello@matteocollina.com> | 2018-11-29 14:33:20 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-12-02 21:39:45 -0800 |
commit | 32fed93aee30be5401ff99cfde3360ce037e294a (patch) | |
tree | e9a0cac22706369cfc4a0a6cd0c95fb860da56ae /lib | |
parent | 175164e5d12829b46f91137a01dac72f236a37be (diff) | |
download | android-node-v8-32fed93aee30be5401ff99cfde3360ce037e294a.tar.gz android-node-v8-32fed93aee30be5401ff99cfde3360ce037e294a.tar.bz2 android-node-v8-32fed93aee30be5401ff99cfde3360ce037e294a.zip |
http2: make compat writeHead not crash if the stream is destroyed
Fixes: https://github.com/nodejs/node/issues/24470
PR-URL: https://github.com/nodejs/node/pull/24723
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/http2/compat.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 464f114106..adf6b1da62 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -568,6 +568,11 @@ class Http2ServerResponse extends Stream { if (this[kStream].headersSent) throw new ERR_HTTP2_HEADERS_SENT(); + // If the stream is destroyed, we return false, + // like require('http'). + if (this.stream.destroyed) + return false; + if (typeof statusMessage === 'string') statusMessageWarn(); |