[HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set
This commit is contained in:
parent
9526988eca
commit
a2960a3318
@ -32,9 +32,13 @@ final class HttpClient
|
|||||||
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface
|
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface
|
||||||
{
|
{
|
||||||
if (\extension_loaded('curl')) {
|
if (\extension_loaded('curl')) {
|
||||||
|
if ('\\' !== \DIRECTORY_SEPARATOR || ini_get('curl.cainfo') || ini_get('openssl.cafile') || ini_get('openssl.capath')) {
|
||||||
return new CurlHttpClient($defaultOptions, $maxHostConnections, $maxPendingPushes);
|
return new CurlHttpClient($defaultOptions, $maxHostConnections, $maxPendingPushes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@trigger_error('Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient', E_USER_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
return new NativeHttpClient($defaultOptions, $maxHostConnections);
|
return new NativeHttpClient($defaultOptions, $maxHostConnections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ final class CurlResponse implements ResponseInterface
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($certinfo = curl_getinfo($ch, CURLINFO_CERTINFO)) {
|
if (\function_exists('openssl_x509_read') && $certinfo = curl_getinfo($ch, CURLINFO_CERTINFO)) {
|
||||||
$info['peer_certificate_chain'] = array_map('openssl_x509_read', array_column($certinfo, 'Cert'));
|
$info['peer_certificate_chain'] = array_map('openssl_x509_read', array_column($certinfo, 'Cert'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user