HTTP API: Pass proxy settings to Requests.

`WP_HTTP_Proxy()` is used directly in `WP_Http_Curl()` and `WP_Http_Streams()`. Since `WP_Http::request()` doesn't use them anymore we have to move the proxy handling into `WP_Http::request()` so the proxy data can be passed to `Requests::request()`.

Props rmccue.
See #33055.
Fixes #37107.
Built from https://develop.svn.wordpress.org/trunk@38054


git-svn-id: http://core.svn.wordpress.org/trunk@37995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-07-13 15:51:28 +00:00
parent 5f862c626a
commit 67de1f07d3
2 changed files with 12 additions and 1 deletions

View File

@ -347,6 +347,17 @@ class WP_Http {
*/
$options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'] );
// Check for proxies.
$proxy = new WP_HTTP_Proxy();
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
$options['proxy'] = new Requests_Proxy_HTTP( $proxy->host() . ':' . $proxy->port() );
if ( $proxy->use_authentication() ) {
$options['proxy']->user = $proxy->username();
$options['proxy']->pass = $proxy->password();
}
}
try {
$requests_response = Requests::request( $url, $headers, $data, $type, $options );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-beta2-38053';
$wp_version = '4.6-beta2-38054';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.