Skip to content

Commit e8735e8

Browse files
committed
http: remove TODO and add condition
1 parent 397aac8 commit e8735e8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/internal/http.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,16 @@ class ProxyConfig {
192192
if (entry.startsWith('*.') && host.endsWith(entry.substring(1))) return false;
193193

194194
// Handle IP ranges (simple format like 192.168.1.0-192.168.1.255)
195-
// TODO(joyeecheung): support IPv6.
196195
if (entry.includes('-')) {
197196
let { 0: startIP, 1: endIP } = entry.split('-');
198197
startIP = startIP.trim();
199198
endIP = endIP.trim();
200-
if (isIPv4(startIP) && isIPv4(endIP) && isIPv4(host)) {
199+
if (startIP && endIP && isIPv4(startIP) && isIPv4(endIP) && isIPv4(host)) {
201200
const hostInt = ipToInt(host);
202201
const startInt = ipToInt(startIP);
203202
const endInt = ipToInt(endIP);
204203
if (hostInt >= startInt && hostInt <= endInt) return false;
205-
} else if (isIPv6(startIP) && isIPv6(endIP) && isIPv6(host)) {
204+
} else if (startIP && endIP && isIPv6(startIP) && isIPv6(endIP) && isIPv6(host)) {
206205
const hostInt = ipv6ToBigInt(host);
207206
const startInt = ipv6ToBigInt(startIP);
208207
const endInt = ipv6ToBigInt(endIP);

0 commit comments

Comments
 (0)