Skip to content

http_request utility ignores verify option #5463

@aaemnnosttv

Description

@aaemnnosttv

Bug Report

The \WP_CLI\Utils\http_request utility accepts an array of $options which it passes to Requests::request. One of these options is verify for specifying a custom SSL certificate to use or false to disable certificate verification.

The wp-cli utility however sets this option with its own value regardless of any passed value.

This makes debugging requests using an HTTP proxy nearly impossible because a custom certificate cannot be used, nor can certificate verification be disabled.

As a developer familiar with HTTP requests in WP and Requests, I would expect the verify option provided to the utility to take precedence over any other logic to determine or require an SSL certificate.

Is your bug report directly related to a specific command?

No

Describe the current, buggy behavior

This is a pretty low-level detail in an internal utility function so it should be quite clear by the description above but I'm happy to elaborate if needed 😄

Describe what you expect as the correct outcome

A clear and concise description of what you expected to happen (or code).

Let us know what environment you are running this on

OS:	Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
Shell:	/bin/zsh
PHP binary:	/usr/local/Cellar/php@7.2/7.2.33/bin/php
PHP version:	7.2.33
php.ini used:	/usr/local/etc/php/7.2/php.ini
MySQL binary:	/usr/local/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.4.10-MariaDB, for osx10.14 (x86_64) using readline 5.1
SQL modes:	
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/Users/aaemnnosttv
WP-CLI packages dir:	/Users/aaemnnosttv/.wp-cli/packages/
WP-CLI global config:	/Users/aaemnnosttv/.config/wp-cli/config.yml
WP-CLI project config:	
WP-CLI version:	2.5.0-alpha-102ef48

Provide a possible solution

If verify is set in the given $options to \WP_CLI\Utils\http_request, this value should be passed through rather than overwritten.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions