mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
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:
1 parent
44ed25a94b
commit
2e944d7de1
6 files changed
+7
-7
No files matched your search
+1
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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;
|
||||
|
||||
@@ -43,7 +43,7 @@ const { code, signal, stderr, stdout } = await runProxiedRequest({
|
||||
});
|
||||
|
||||
// The proxy client should get an error from failure in establishing the tunnel.
|
||||
assert.match(stderr, /ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* NOT-HTTP MALFORMED RESPONSE/);
|
||||
assert.strictEqual(stderr.match(/ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* NOT-HTTP MALFORMED RESPONSE*/g).length, 1);
|
||||
assert.strictEqual(stdout.trim(), '');
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
|
||||
@@ -43,7 +43,7 @@ const { code, signal, stderr, stdout } = await runProxiedRequest({
|
||||
});
|
||||
|
||||
// The proxy client should get an error from failure in establishing the tunnel.
|
||||
assert.match(stderr, /ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* HTTP\/1\.1 404 Not Found/);
|
||||
assert.strictEqual(stderr.match(/ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* HTTP\/1\.1 404 Not Found/g).length, 1);
|
||||
assert.strictEqual(stdout.trim(), '');
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
|
||||
@@ -44,7 +44,7 @@ const { code, signal, stderr, stdout } = await runProxiedRequest({
|
||||
});
|
||||
|
||||
// The proxy client should get an error from failure in establishing the tunnel.
|
||||
assert.match(stderr, /ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* HTTP\/1\.1 500 Connection Error/);
|
||||
assert.strictEqual(stderr.match(/ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* HTTP\/1\.1 500 Connection Error/g).length, 1);
|
||||
assert.strictEqual(stdout.trim(), '');
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
|
||||
@@ -42,7 +42,7 @@ const { code, signal, stderr, stdout } = await runProxiedRequest({
|
||||
});
|
||||
|
||||
// The proxy client should get an error from failure in establishing the tunnel.
|
||||
assert.match(stderr, /ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* HTTP\/1\.1 502 Bad Gateway/);
|
||||
assert.strictEqual(stderr.match(/ERR_PROXY_TUNNEL.*Failed to establish tunnel to .* HTTP\/1\.1 502 Bad Gateway/g).length, 1);
|
||||
assert.strictEqual(stdout.trim(), '');
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
|
||||
Reference in new issue
Block a user