From 824bc6616fde8a6438b07f9e6c96b62e62652710 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 15 Jul 2026 12:59:57 +0200 Subject: [PATCH 1/3] test: copyedit `test-tls-psk-alpn-callback-exception-handling` Signed-off-by: Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/63485 Reviewed-By: Matteo Collina --- ...ls-psk-alpn-callback-exception-handling.js | 48 +++++-------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/test/parallel/test-tls-psk-alpn-callback-exception-handling.js b/test/parallel/test-tls-psk-alpn-callback-exception-handling.js index 31d7802931fb36..0ba55f9153b947 100644 --- a/test/parallel/test-tls-psk-alpn-callback-exception-handling.js +++ b/test/parallel/test-tls-psk-alpn-callback-exception-handling.js @@ -95,10 +95,7 @@ describe('TLS callback exception handling', () => { reject(e); } })); - - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -113,7 +110,7 @@ describe('TLS callback exception handling', () => { }), }); - client.on('error', () => {}); + client.on('error', common.mustCall()); await promise; }); @@ -307,9 +304,6 @@ describe('TLS callback exception handling', () => { } })); - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); await new Promise((res) => server.listen(0, res)); @@ -324,7 +318,7 @@ describe('TLS callback exception handling', () => { }), }); - client.on('error', () => {}); + client.on('error', common.mustCall()); await promise; }); @@ -354,10 +348,7 @@ describe('TLS callback exception handling', () => { reject(e); } })); - - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -368,7 +359,7 @@ describe('TLS callback exception handling', () => { ALPNProtocols: ['http/1.1', 'h2'], }); - client.on('error', () => {}); + client.on('error', common.mustCall()); await promise; }); @@ -397,10 +388,7 @@ describe('TLS callback exception handling', () => { reject(e); } })); - - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -411,7 +399,7 @@ describe('TLS callback exception handling', () => { ALPNProtocols: ['http/1.1'], }); - client.on('error', () => {}); + client.on('error', common.mustCall()); await promise; }); @@ -430,9 +418,7 @@ describe('TLS callback exception handling', () => { const { promise, resolve, reject } = createTestPromise(); - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -474,9 +460,7 @@ describe('TLS callback exception handling', () => { const { promise, resolve, reject } = createTestPromise(); - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -527,10 +511,7 @@ describe('TLS callback exception handling', () => { reject(e); } })); - - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -541,7 +522,7 @@ describe('TLS callback exception handling', () => { rejectUnauthorized: false, }); - client.on('error', () => {}); + client.on('error', common.mustCall()); await promise; }); @@ -574,10 +555,7 @@ describe('TLS callback exception handling', () => { reject(e); } })); - - server.on('secureConnection', () => { - reject(new Error('secureConnection should not fire')); - }); + server.on('secureConnection', common.mustNotCall('secureConnection listener')); await new Promise((res) => server.listen(0, res)); @@ -588,7 +566,7 @@ describe('TLS callback exception handling', () => { rejectUnauthorized: false, }); - client.on('error', () => {}); + client.on('error', common.mustCall()); await promise; }); From b4dfc784f946c50f5b6ba6d54b644a0b97cc3743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=9C=EB=A7=8C=EC=9A=B1?= <98882987+manNomi@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:18:14 +0900 Subject: [PATCH 2/3] doc: fix spelling in devcontainer guide Signed-off-by: manNomi PR-URL: https://github.com/nodejs/node/pull/64459 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/contributing/using-devcontainer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/contributing/using-devcontainer.md b/doc/contributing/using-devcontainer.md index bd118d03d027d5..77483b87c4abb6 100644 --- a/doc/contributing/using-devcontainer.md +++ b/doc/contributing/using-devcontainer.md @@ -2,7 +2,7 @@ Node.js publishes a [nightly image on DockerHub](https://hub.docker.com/r/nodejs/devcontainer) for [Dev Containers](https://containers.dev/) that can be used to spin up a -development container that comes with pre-installed build dependencies and pre-genreated build cache. +development container that comes with pre-installed build dependencies and pre-generated build cache. When you need to test a few changes in the main branch and do not need to change the V8 headers (which is rare), using the nightly image will allow you to compile your From 34c28d5a69f4f00cd599adcbe57834435d3a683b Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Wed, 15 Jul 2026 16:04:02 +0200 Subject: [PATCH 3/3] Revert "http: do not emit socket errors after complete response" This reverts commit 17163ead3326a2eda3253c392474c777405a04c7. Signed-off-by: Matteo Collina PR-URL: https://github.com/nodejs/node/pull/64511 Reviewed-By: Tim Perry Reviewed-By: Paolo Insogna Reviewed-By: Luigi Pinca --- lib/_http_client.js | 16 +----- ...est-http-client-complete-response-reset.js | 55 ------------------- 2 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 test/parallel/test-http-client-complete-response-reset.js diff --git a/lib/_http_client.js b/lib/_http_client.js index d202a28f03502f..9eb3c10547d520 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -752,24 +752,10 @@ function socketErrorListener(err) { debug('SOCKET ERROR:', err.message, err.stack); if (req) { - const res = req.res; - const isUserDestroyError = err === req[kError] || err === res?.errored; - // For Safety. Some additional errors might fire later on // and we need to make sure we don't double-fire the error event. socket._hadError = true; - // Before a response exists, the request itself failed. Once a response - // exists, socket teardown belongs to the IncomingMessage and is finalized - // by socketCloseListener. Preserve errors explicitly used to destroy the - // request or response, which have historically been emitted on the request. - if (!res || isUserDestroyError) { - emitErrorEvent(req, err); - } - - if (res) { - socket.destroy(); - return; - } + emitErrorEvent(req, err); } const parser = socket.parser; diff --git a/test/parallel/test-http-client-complete-response-reset.js b/test/parallel/test-http-client-complete-response-reset.js deleted file mode 100644 index aa9337dbcc5206..00000000000000 --- a/test/parallel/test-http-client-complete-response-reset.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const http = require('http'); - -const BODY = Buffer.alloc(2 * 1024 * 1024); - -const server = http.createServer(common.mustCall((request, response) => { - let received = 0; - - request.on('data', function onData(chunk) { - received += chunk.length; - request.off('data', onData); - request.destroy(); - }); - - response.writeHead(413, { 'content-length': 0 }); - response.end(); - - request.on('end', common.mustNotCall()); - request.on('close', common.mustCall(() => { - assert.strictEqual(request.complete, false); - assert.ok(received > 0); - })); -})); - -server.listen(0, common.mustCall(() => { - let response; - const req = http.request({ - method: 'POST', - port: server.address().port, - headers: { - 'content-type': 'application/json', - 'content-length': BODY.length, - }, - }, common.mustCall((res) => { - response = res; - assert.strictEqual(res.statusCode, 413); - // Deliberately do not consume the response body. A response that has - // already been received should not be followed by a late ClientRequest - // socket error. - req.write(BODY); - req.end(); - })); - - req.on('error', common.mustNotCall()); - req.on('close', common.mustCall(() => { - assert(response); - assert.strictEqual(response.complete, true); - server.close(); - })); - - req.flushHeaders(); -}));