Skip to content

Commit

Permalink
fix: using default match
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevsr committed Dec 1, 2024
1 parent 89b51b1 commit 83d29d9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions system/HTTP/CURLRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,12 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
}

// Resolve IP
if (array_key_exists('force_ip_resolve', $config) && is_string($config['force_ip_resolve']) && $config['force_ip_resolve'] !== '') {
$protocolVersion = $config['force_ip_resolve'];

if ($protocolVersion === 'v4') {
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
} elseif ($protocolVersion === 'v6') {
$curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6;
}
if (array_key_exists('force_ip_resolve', $config)) {
$curlOptions[CURLOPT_IPRESOLVE] = match ($config['force_ip_resolve']) {
'v4' => CURL_IPRESOLVE_V4,
'v6' => CURL_IPRESOLVE_V6,
default => CURL_IPRESOLVE_WHATEVER
};
}

// version
Expand Down

0 comments on commit 83d29d9

Please sign in to comment.