|
@@ 345-347 (lines=3) @@
|
| 342 |
|
if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { |
| 343 |
|
if ('v4' === $options['force_ip_resolve']) { |
| 344 |
|
$records = dns_get_record($uri->getHost(), DNS_A); |
| 345 |
|
if (!isset($records[0]['ip'])) { |
| 346 |
|
throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); |
| 347 |
|
} |
| 348 |
|
$uri = $uri->withHost($records[0]['ip']); |
| 349 |
|
} elseif ('v6' === $options['force_ip_resolve']) { |
| 350 |
|
$records = dns_get_record($uri->getHost(), DNS_AAAA); |
|
@@ 351-353 (lines=3) @@
|
| 348 |
|
$uri = $uri->withHost($records[0]['ip']); |
| 349 |
|
} elseif ('v6' === $options['force_ip_resolve']) { |
| 350 |
|
$records = dns_get_record($uri->getHost(), DNS_AAAA); |
| 351 |
|
if (!isset($records[0]['ipv6'])) { |
| 352 |
|
throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); |
| 353 |
|
} |
| 354 |
|
$uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); |
| 355 |
|
} |
| 356 |
|
} |