http,https: fix double ERR_PROXY_TUNNEL emission

Fixes: https://github.com/nodejs/node/issues/60697
PR-URL: https://github.com/nodejs/node/pull/60699
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
This commit is contained in:
Shima Ryuhei
2025-11-15 18:29:08 +09:00
committed by GitHub
parent 44ed25a94b
commit 2e944d7de1
6 changed files with 7 additions and 7 deletions

View File

@@ -284,9 +284,8 @@ function handleSocketAfterProxy(err, req) {
if (err.code === 'ERR_PROXY_TUNNEL') {
if (err.proxyTunnelTimeout) {
req.emit('timeout'); // Propagate the timeout from the tunnel to the request.
} else {
req.emit('error', err);
}
req.emit('error', err);
}
}

View File

@@ -958,7 +958,8 @@ function onSocketNT(req, socket, err) {
if (!req.aborted && !err) {
err = new ConnResetException('socket hang up');
}
if (err) {
// ERR_PROXY_TUNNEL is handled by the proxying logic
if (err && err.code !== 'ERR_PROXY_TUNNEL') {
emitErrorEvent(req, err);
}
req._closed = true;