id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 37494 Proxy authentication is ignored by Requests francescobagnoli dd32 "in wp-config.php {{{ define('WP_PROXY_HOST', '172.16.XXX.XXX'); define('WP_PROXY_PORT', '3128'); define('WP_PROXY_USERNAME', 'XXX'); define('WP_PROXY_PASSWORD', 'XXX'); }}} in function.php {{{ $headers['X-Forwarded-For'] = $_SERVER['REMOTE_ADDR']; $response = wp_remote_get('http://example.com/', array('headers' => $headers)); }}} the proxy server raise an exception on authentication failed. debugging i see in `Requests_Proxy_HTTP` class, `$use_authentication` property is always false and in `curl_before_send()` method if `$use_authentication` is false `curl_setopt` `CURLOPT_PROXYUSERPWD` is never set. If I force `$use_authentication` to be true, everything works. the fix for me is edit /wp-includes/class-http.php line 354: {{{#!php $options['proxy'] = new Requests_Proxy_HTTP( $proxy->host() . ':' . $proxy->port() ); if ( $proxy->use_authentication() ) { $options['proxy']->user = $proxy->username(); $options['proxy']->pass = $proxy->password(); } }}} change to {{{#!php if ( $proxy->use_authentication() ) { $options['proxy']->user = $proxy->username(); $options['proxy']->pass = $proxy->password(); $options['proxy'] = new Requests_Proxy_HTTP( array($proxy->host() . ':' . $proxy->port(), $proxy->username(), $proxy->password()) ); } else { $options['proxy'] = new Requests_Proxy_HTTP( $proxy->host() . ':' . $proxy->port() ); } }}} This because `Requests_Proxy_HTTP` set `$use_authentication` property to true, only if `Requests_Proxy_HTTP::__construct()` has 3 parameters {{{#!php public function __construct($args = null) { if (is_string($args)) { $this->proxy = $args; } elseif (is_array($args)) { if (count($args) == 1) { list($this->proxy) = $args; } elseif (count($args) == 3) { list($this->proxy, $this->user, $this->pass) = $args; $this->use_authentication = true; } else { throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); } } } }}} " defect (bug) closed normal 4.6 HTTP API 4.6 normal fixed has-patch commit dev-reviewed