-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
CurlClient fail to exec HTTPS with empty HTTPOptions #2
Comments
I just did #3 that also covers |
Hey, thank you for the heads-up! I think #3 is a bit too invasive. The concept is to decouple the "settings" logic as far as possible from the application logic. So the whole process of determining the CA info went into php-httpinterface/src/HTTPOptionsTrait.php Lines 83 to 189 in a780569
The cURL options are applied here before firing the request: php-httpinterface/src/Psr18/CurlHandle.php Lines 249 to 250 in a780569
So if there's a problem finding the correct CA on your system, it might be that i'm probably missing a default path or something. The tests currently don't include much testing for default paths. So if you're looking to fix that, the best would be in HTTPOptionsTrait in first place. Also, i should point out, that the StreamClient is in "experimental" status at best.
|
As you mention, on My first thought was to check if Then I think that would be better to check the place where this is set and found that this Anyhow, please, play around with the test I post in the issue. |
Ok, i investigated a bit further and found an error on my end over here: php-httpinterface/src/Psr18/CurlHandle.php Lines 249 to 250 in a780569
The PHP documentation says:
So it would be simply: curl_setopt_array($this->curl, $this->options->curl_options + $options); To circumvent any future bugs, preserve the numerical array keys ( php-httpinterface/src/Psr18/CurlHandle.php Lines 249 to 252 in 5afc327
As for the fix in php-httpinterface/src/HTTPOptionsTrait.php Line 174 in c28ada3
Anything else should throw an error now. Please let me know if this helps. |
Thank you. |
Hello, thanks for your great work!
Was trying to use
CurlClient
without any (default)HTTPOptions
but it fail with a curl error:wich is weird because making a plain curl connection didn't fail:
So I take a look into your package and I see that in
CurlHandle::init()
you are setting$this->options->curl_options[\CURLOPT_CAINFO]
with aNULL
value.If you modify the test and add this line will fail in the same way.
I think that the problem is in
CurlHandle::initCurlOptions()
that returns an array withCURLOPT_CAINFO => $this->options->ca_info
even when$this->options->ca_info === NULL
. I tested includingCURLOPT_CAINFO
only when$this->options->ca_info
is not falsy and it work just fine.By the way, the same would happens with
CURLOPT_CAPATH
if you provide a way to work with.Looks like
CURLOPT_CAINFO
orCURLOPT_CAPATH
cannot be removed using null or empty strings, and it will fail. Also, if both are set then both must succeed.Could you consider to fix this? Do you want me to make a PR? I'm not familiar with your test suite. The only this I was thinking is to simply remove
'ca_info' => __DIR__.'/../cacert.pem'
from the initiation parameters onCurlClientTest.php
.The text was updated successfully, but these errors were encountered: