summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2023-01-18 09:38:01 +0100
committerJuan José Arboleda <soyjuanarbol@gmail.com>2023-03-04 23:03:34 -0500
commit73a8f46c4dd993d722b1cb8ab4c8a2053c833af7 (patch)
treeaf739da2f6d3123c858c8e579264a0681b22dea6
parent1ef3c53e24c6fdac5533c83e643a6a618d0168c9 (diff)
downloadnode-new-73a8f46c4dd993d722b1cb8ab4c8a2053c833af7.tar.gz
Revert "src: let http2 streams end after session close"
This reverts commit dee882e94f4caa4e1cd608013f90f6a14629403f. Moved the test that demonstrated what this commit was fixing to the `known_issues` folder. Fixes: https://github.com/nodejs/node/issues/46234 PR-URL: https://github.com/nodejs/node/pull/46721 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
-rw-r--r--src/node_http2.cc11
-rw-r--r--test/known_issues/test-http2-trailers-after-session-close.js (renamed from test/parallel/test-http2-trailers-after-session-close.js)9
2 files changed, 7 insertions, 13 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc
index f2a4d83a3b..63e0fd3975 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -1124,17 +1124,6 @@ int Http2Session::OnStreamClose(nghttp2_session* handle,
if (!stream || stream->is_destroyed())
return 0;
- // Don't close synchronously in case there's pending data to be written. This
- // may happen when writing trailing headers.
- if (code == NGHTTP2_NO_ERROR && nghttp2_session_want_write(handle) &&
- env->can_call_into_js()) {
- env->SetImmediate([handle, id, code, user_data](Environment* env) {
- OnStreamClose(handle, id, code, user_data);
- });
-
- return 0;
- }
-
stream->Close(code);
// It is possible for the stream close to occur before the stream is
diff --git a/test/parallel/test-http2-trailers-after-session-close.js b/test/known_issues/test-http2-trailers-after-session-close.js
index d08f875494..3d5be11e5b 100644
--- a/test/parallel/test-http2-trailers-after-session-close.js
+++ b/test/known_issues/test-http2-trailers-after-session-close.js
@@ -1,8 +1,13 @@
'use strict';
+// Fixes: https://github.com/nodejs/node/issues/42713
const common = require('../common');
-if (!common.hasCrypto)
+if (!common.hasCrypto) {
+ // Remove require('assert').fail when issue is fixed and test
+ // is moved out of the known_issues directory.
+ require('assert').fail('missing crypto');
common.skip('missing crypto');
+}
const assert = require('assert');
const http2 = require('http2');
@@ -31,7 +36,7 @@ server.listen(0, common.mustCall(() => {
client.socket.on('close', common.mustCall());
const req = client.request({
[HTTP2_HEADER_PATH]: '/',
- [HTTP2_HEADER_METHOD]: 'POST'
+ [HTTP2_HEADER_METHOD]: 'POST',
});
req.end();
req.on('response', common.mustCall());