-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Labels
Description
Split out from wp-cli/core-command#292
- php-curl happens to honor the http_proxy env var
- Requests defers honoring that env var to the library user (e.g., WordPress core or WP-CLI) (see also Auto use Proxy if HTTP_PROXY & HTTPS_PROXY Environment variable is setย WordPress/Requests#218)
- WP-CLI doesn't want to blindly trust that env var
- One should be able to manually configure proxy support via
wp-cli.ymland theextra-phpconfig
You might be able to do something like this:
# In wp-cli.yml
require:
- path-to/proxy.php// proxy.php
$proxy_host = getenv( 'HTTP_PROXY' );
if ( ! $proxy_host ) {
return;
}
$proxy_url = parse_url( $proxy_host );
if ( $proxy_url['host'] ) {
define( 'WP_PROXY_HOST', $proxy_url['host'] );
}
if ( $proxy_url['port'] ) {
define( 'WP_PROXY_PORT', $proxy_url['port'] );
}This would configure the proxy for HTTP requests in core when using WP-CLI, similar to when you define this in wp-config.php. The setup would be slightly more complex for modifying HTTP requests from WP-CLI itself.
beittuc