Skip to content
Merged
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
4 changes: 3 additions & 1 deletion lib/internal/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ class ProxyConfig {
const { host, hostname, port, protocol, username, password } = new URL(proxyUrl);
this.href = proxyUrl; // Full URL of the proxy server.
this.host = host; // Full host including port, e.g. 'localhost:8080'.
this.hostname = hostname.replace(/^\[|\]$/g, ''); // Trim off the brackets from IPv6 addresses.
// Trim off the brackets from IPv6 addresses. As it's parsed from a valid URL, an opening
// "[" Must already have a matching "]" at the end.
this.hostname = hostname[0] === '[' ? hostname.slice(1, -1) : hostname;
this.port = port ? NumberParseInt(port, 10) : (protocol === 'https:' ? 443 : 80);
this.protocol = protocol; // Protocol of the proxy server, e.g. 'http:' or 'https:'.

Expand Down
Loading