Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/contributing/using-devcontainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 1 addition & 15 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
55 changes: 0 additions & 55 deletions test/parallel/test-http-client-complete-response-reset.js

This file was deleted.

48 changes: 13 additions & 35 deletions test/parallel/test-tls-psk-alpn-callback-exception-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -113,7 +110,7 @@ describe('TLS callback exception handling', () => {
}),
});

client.on('error', () => {});
client.on('error', common.mustCall());

await promise;
});
Expand Down Expand Up @@ -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));

Expand All @@ -324,7 +318,7 @@ describe('TLS callback exception handling', () => {
}),
});

client.on('error', () => {});
client.on('error', common.mustCall());

await promise;
});
Expand Down Expand Up @@ -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));

Expand All @@ -368,7 +359,7 @@ describe('TLS callback exception handling', () => {
ALPNProtocols: ['http/1.1', 'h2'],
});

client.on('error', () => {});
client.on('error', common.mustCall());

await promise;
});
Expand Down Expand Up @@ -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));

Expand All @@ -411,7 +399,7 @@ describe('TLS callback exception handling', () => {
ALPNProtocols: ['http/1.1'],
});

client.on('error', () => {});
client.on('error', common.mustCall());

await promise;
});
Expand All @@ -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));

Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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));

Expand All @@ -541,7 +522,7 @@ describe('TLS callback exception handling', () => {
rejectUnauthorized: false,
});

client.on('error', () => {});
client.on('error', common.mustCall());

await promise;
});
Expand Down Expand Up @@ -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));

Expand All @@ -588,7 +566,7 @@ describe('TLS callback exception handling', () => {
rejectUnauthorized: false,
});

client.on('error', () => {});
client.on('error', common.mustCall());

await promise;
});
Expand Down
Loading