-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] use CurlHttpClient on Windows if cafile or capath is set in default options #40676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That is certainly a good idea, PR welcome.
I'm not sure what you mean. Options on scoped clients are meant to override the default options - but the default client still has to work on its own.
I added these checks in #32022, but I don't remember exactly how/when I experienced the issue... |
That is really interesting. Without having these options set on Windows, curl will not be able to get certificate information.
However, the |
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 ------- 6609a17 allow CurlHttpClient on Windows
This issue can be closed. |
Symfony version(s) affected: 5.2.6
Description
I get the following warning and notice:
I am on Windows and don't have these options set in my
php.ini
, but I have setcafile
How to reproduce
php.ini
.symfony/http-client
app/config/packages/framework.yaml
, sethttp_client
->default_options
->cafile: <path to PEM file>
HttpClientInterface
, perform a requestPossible Solution
I guess this check in
HttpClient::create
is faulty:if ('\\' !== \DIRECTORY_SEPARATOR || ini_get('curl.cainfo') || ini_get('openssl.cafile') || ini_get('openssl.capath'))
Extending it with
isset($defaultOptions['cafile']) || isset($defaultOptions['capath'])
fixes both log messages.However,
CurlHttpClient
can also be used if you setcafile
orcapath
on options for scoped clients, but these options aren't available in the factory.Why is this check present anyway?
CurlHttpClient
works great on Windows without any of these options.Additional context
The text was updated successfully, but these errors were encountered: