1
0
Fork 0

Allow verify_peer/verify_peer_name http options to be handled by curl downloader

pull/9063/head
Jordi Boggiano 2020-07-17 17:22:41 +02:00
parent c3d40ae79a
commit 8cec8bd546
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 7 additions and 1 deletions

View File

@ -56,6 +56,8 @@ class CurlDownloader
'ssl' => array(
'cafile' => CURLOPT_CAINFO,
'capath' => CURLOPT_CAPATH,
'verify_peer' => CURLOPT_SSL_VERIFYPEER,
'verify_peer_name' => CURLOPT_SSL_VERIFYHOST,
),
);
@ -178,10 +180,14 @@ class CurlDownloader
foreach (self::$options as $type => $curlOptions) {
foreach ($curlOptions as $name => $curlOption) {
if (isset($options[$type][$name])) {
if ($type === 'ssl' && $name === 'verify_peer_name') {
curl_setopt($curlHandle, $curlOption, $options[$type][$name] === true ? 2 : $options[$type][$name]);
} else {
curl_setopt($curlHandle, $curlOption, $options[$type][$name]);
}
}
}
}
$progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);