[ Index ]

WordPress 5.4.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    




/wp-includes/ -> class-wp-http-proxy.php (summary)

HTTP API: WP_HTTP_Proxy class

File Size: 229 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_HTTP_Proxy:: (9 methods):

Class: WP_HTTP_Proxy  - X-Ref

Core class used to implement HTTP API proxy support.

There are caveats to proxy support. It requires that defines be made in the wp-config.php file to
enable proxy support. There are also a few filters that plugins can hook into for some of the

Please note that only BASIC authentication is supported by most transports.
cURL MAY support more methods (such as NTLM authentication) depending on your environment.

The constants are as follows:
<li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
<li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
<li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
<li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
<li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
You do not need to have localhost and the site host in this list, because they will not be passed
through the proxy. The list should be presented in a comma separated list, wildcards using * are supported, eg. *.wordpress.org</li>

An example can be as seen below.

define('WP_PROXY_HOST', '');
define('WP_PROXY_PORT', '8080');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, *.wordpress.org');

is_enabled()   X-Ref
Whether proxy connection should be used.

return: bool

use_authentication()   X-Ref
Whether authentication should be used.

return: bool

host()   X-Ref
Retrieve the host for the proxy server.

return: string

port()   X-Ref
Retrieve the port for the proxy server.

return: string

username()   X-Ref
Retrieve the username for proxy authentication.

return: string

password()   X-Ref
Retrieve the password for proxy authentication.

return: string

authentication()   X-Ref
Retrieve authentication string for proxy authentication.

return: string

authentication_header()   X-Ref
Retrieve header string for proxy authentication.

return: string

send_through_proxy( $uri )   X-Ref
Determines whether the request should be sent through a proxy.

We want to keep localhost and the site URL from being sent through the proxy, because
some proxies can not handle this. We also have the constant available for defining other
hosts that won't be sent through the proxy.

param: string $uri URI to check.
return: bool True, to send through the proxy and false if, the proxy should not be used.

Generated: Tue May 19 15:51:04 2020 Cross-referenced by PHPXref 0.7.1