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. git-svn-id: https://develop.svn.wordpress.org/trunk@38054 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
26758ec22f
commit
7fccd0ba4f
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user