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
3 changes: 1 addition & 2 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading