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

main
Jordi Boggiano 4 years ago
parent c3d40ae79a
commit 8cec8bd546
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -56,6 +56,8 @@ class CurlDownloader
'ssl' => array( 'ssl' => array(
'cafile' => CURLOPT_CAINFO, 'cafile' => CURLOPT_CAINFO,
'capath' => CURLOPT_CAPATH, '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 (self::$options as $type => $curlOptions) {
foreach ($curlOptions as $name => $curlOption) { foreach ($curlOptions as $name => $curlOption) {
if (isset($options[$type][$name])) { 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]); curl_setopt($curlHandle, $curlOption, $options[$type][$name]);
} }
} }
} }
}
$progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo); $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);

Loading…
Cancel
Save