Skip to content
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

Respect provided verify option in Utils\http_request #5507

Conversation

@aaemnnosttv
Copy link
Contributor

@aaemnnosttv aaemnnosttv commented Mar 20, 2021

This PR fixes #5463 in that it respects the given value of $options['verify'] rather than overwriting it with the path to the default CA cert.

It does this partly by extracting the default CA cert detection/lookup into a new utility: get_default_cacert.

The tests added also include a very simple Mock_Requests_Transport class to make testing the http_request call much cleaner and simpler, but is only used in the added test. Regarding the way this class is loaded, normally I would expect it to be autoloaded but there didn't seem to be any existing configuration for this yet so I left that out for now for simplicity.

@aaemnnosttv aaemnnosttv marked this pull request as ready for review Mar 21, 2021
@aaemnnosttv aaemnnosttv requested a review from as a code owner Mar 21, 2021
@schlessera schlessera force-pushed the fix/5463-utils-http-request-verify-option branch from 8bca8ac to 398de67 May 5, 2021
@schlessera
Copy link
Member

@schlessera schlessera commented May 5, 2021

I rebased and adapted this PR to take the new default behavior from #5514 into account.

The main change is that WP-CLI will now default to the system certificate and only fall back to the bundled one if the system-wide certificate failed.

Loading

@schlessera schlessera merged commit 84ddf49 into wp-cli:master May 5, 2021
24 checks passed
Loading
@schlessera schlessera changed the title Fix 5463 Utils\http_request verify option Respect provided verify option in Utils\http_request May 5, 2021
@schlessera
Copy link
Member

@schlessera schlessera commented May 5, 2021

Thanks for the PR, @aaemnnosttv !

Loading

@aaemnnosttv aaemnnosttv deleted the fix/5463-utils-http-request-verify-option branch May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants