[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/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):
  is_enabled()
  use_authentication()
  host()
  port()
  username()
  password()
  authentication()
  authentication_header()
  send_through_proxy()


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
constants.

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:
<ol>
<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>
</ol>

An example can be as seen below.

define('WP_PROXY_HOST', '192.168.84.101');
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.

since: 2.8.0
return: bool

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

since: 2.8.0
return: bool

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

since: 2.8.0
return: string

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

since: 2.8.0
return: string

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

since: 2.8.0
return: string

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

since: 2.8.0
return: string

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

since: 2.8.0
return: string

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

since: 2.8.0
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.

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



Generated: Thu Feb 27 01:00:03 2020 Cross-referenced by PHPXref 0.7.1