Files
node/lib
RajeshKumar11 b75073d5aa http: attach error handler to socket synchronously in onSocket
Between onSocket and onSocketNT, the socket had no error handler,
meaning any errors emitted during that window (e.g. from a blocklist
check or custom lookup) would be unhandled even if the user had set up
a request error handler.

Fix this by attaching socketErrorListener synchronously in onSocket,
setting socket._httpMessage so the listener can forward errors to the
request. The _destroy path in onSocketNT is also guarded to prevent
double-firing if socketErrorListener already emitted the error.

Fixes: https://github.com/nodejs/node/issues/48771
Refs: https://github.com/nodejs/node/pull/61658
PR-URL: https://github.com/nodejs/node/pull/61770
Refs: https://github.com/nodejs/node/issues/48771
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-07-19 17:30:42 -05:00
..
2020-02-18 22:15:50 -08:00
2020-10-21 01:26:34 +02:00
2025-08-26 11:22:39 +02:00
2024-01-12 16:09:48 +00:00
2024-07-16 12:01:14 +02:00
2025-10-18 20:35:56 +02:00
2026-02-24 00:37:08 +01:00
2024-11-27 11:03:39 -05:00
2024-11-27 11:03:39 -05:00
2025-09-20 06:16:51 +00:00
2025-10-07 17:29:36 +02:00
2026-02-24 08:38:58 +01:00
2025-04-17 10:51:20 -03:00
2025-09-20 03:32:52 +00:00