mirror of
https://github.com/chillerlan/php-httpinterface.git
synced 2026-04-26 04:55:49 +03:00
[GH-ISSUE #1] Curl can't find cainfo, when doing https request #1
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/php-httpinterface#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bartv2 on GitHub (Nov 13, 2018).
Original GitHub issue: https://github.com/chillerlan/php-httpinterface/issues/1
Disabling setting the CURLOPT_CAINFO option to null fixes this issue. Adding this option to the array only when ca_info is set should fix this issue.
@codemasher commented on GitHub (Nov 14, 2018):
Thank you for the info! I should state somewhere that ca certificate (or bundle) is necessary/mandatory for HTTPS. I'll also look into a workaround to not run into errors otherwise.
@codemasher commented on GitHub (Nov 14, 2018):
This is actually handled over here:
github.com/chillerlan/php-httpinterface@339f552c65/src/CurlHandle.php (L121)I think the problem is rather that
CURLOPT_SSL_VERIFYPEERis set totrueby default, which then requires the cert- I think in an earlier version of the curl client i had this value depending on the existence of a cert.@bartv2 commented on GitHub (Nov 14, 2018):
The ca bundle is available on the system, and the connection works when i remove that line 121. I don't like your solution, i think only setting CURLOPT_CAINFO when $this->options->ca_info is a file would work better. When this is not specifically set the system default will be used.
@codemasher commented on GitHub (Nov 14, 2018):
Oh right, i didn't think about the system CA. But what would be a reliable way to check that? Or should i drop the check at all and leave the problem up to the user (which makes up 99% of SO questions about
CURLOPT_SSL_VERIFYPEER)?edit: brrrrr https://github.com/guzzle/guzzle/blob/master/src/functions.php#L160
@bartv2 commented on GitHub (Nov 14, 2018):
That function is only used in a very limited situation (streamHandler and php 5.?) For curl they do this: https://github.com/guzzle/guzzle/blob/master/src/Handler/CurlFactory.php#L326 I think that is the most flexible. Disabling CURLOPT_SSL_VERIFYPEER should be a last resort, maybe in the error message point to a checklist/steps to check/solve connection errors
@bartv2 commented on GitHub (Feb 22, 2019):
Thanks, looks good