Skip to content

Commit 71267ab

Browse files
committed
feat: CURL option force_ip_resolve
1 parent a6374de commit 71267ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

system/HTTP/CURLRequest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,17 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
649649
$this->setHeader('Content-Length', (string) strlen($json));
650650
}
651651

652+
// Resolve IP
653+
if (! empty($config['force_ip_resolve'])) {
654+
$protocolVersion = $config['force_ip_resolve'];
655+
656+
if ($protocolVersion === 'v4') {
657+
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
658+
} elseif ($protocolVersion === 'v6') {
659+
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6;
660+
}
661+
}
662+
652663
// version
653664
if (! empty($config['version'])) {
654665
$version = sprintf('%.1F', $config['version']);

0 commit comments

Comments
 (0)