bug #40702 [HttpClient] allow CurlHttpClient on Windows (n0rbyt3)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] allow CurlHttpClient on Windows

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #40676
| License       | MIT
| Doc PR        | no

Even if you don't set curl options or openssl cert options on Windows in ```php.ini```, you should be able to use ```CurlHttpClient``` if ```cafile``` or ```capath``` options are set as default options as they will override the options in ```php.ini```.

Commits
-------

6609a175f2 allow CurlHttpClient on Windows
This commit is contained in:
Alexander M. Turek 2021-04-04 14:33:28 +02:00
commit 3b1948fe72
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ final class HttpClient
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface
{
if (\extension_loaded('curl')) {
if ('\\' !== \DIRECTORY_SEPARATOR || ini_get('curl.cainfo') || ini_get('openssl.cafile') || ini_get('openssl.capath')) {
if ('\\' !== \DIRECTORY_SEPARATOR || isset($defaultOptions['cafile']) || isset($defaultOptions['capath']) || ini_get('curl.cainfo') || ini_get('openssl.cafile') || ini_get('openssl.capath')) {
return new CurlHttpClient($defaultOptions, $maxHostConnections, $maxPendingPushes);
}