MediaWiki  REL1_20
ProxyTools.php File Reference

Functions for dealing with proxies. More...

Go to the source code of this file.

Functions

 wfGetAgent ()
 Returns the browser/OS data from the request header Note: headers are spoofable.
 wfGetForwardedFor ()
 Extracts the XFF string from the request header Note: headers are spoofable.
 wfGetIP ()
 Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain)
 wfIsConfiguredProxy ($ip)
 Checks if an IP matches a proxy we've configured.
 wfIsTrustedProxy ($ip)
 Checks if an IP is a trusted proxy providor.
 wfProxyCheck ()
 Forks processes to scan the originating IP for an open proxy server MemCached can be used to skip IPs that have already been scanned.

Detailed Description

Functions for dealing with proxies.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file ProxyTools.php.


Function Documentation

Returns the browser/OS data from the request header Note: headers are spoofable.

Deprecated:
in 1.18; use $wgRequest->getHeader( 'User-Agent' ) instead.
Returns:
string

Definition at line 43 of file ProxyTools.php.

References wfDeprecated().

Extracts the XFF string from the request header Note: headers are spoofable.

Deprecated:
in 1.19; use $wgRequest->getHeader( 'X-Forwarded-For' ) instead.
Returns:
string

Definition at line 30 of file ProxyTools.php.

References wfDeprecated().

wfGetIP ( )

Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of the chain)

Deprecated:
in 1.19; call $wgRequest->getIP() directly.
Returns:
string

Definition at line 56 of file ProxyTools.php.

References wfDeprecated().

Checks if an IP matches a proxy we've configured.

Parameters:
$ipString
Returns:
bool

Definition at line 81 of file ProxyTools.php.

Referenced by wfIsTrustedProxy().

wfIsTrustedProxy ( ip)

Checks if an IP is a trusted proxy providor.

Useful to tell if X-Fowarded-For data is possibly bogus. Squid cache servers for the site are whitelisted.

Parameters:
$ipString
Returns:
bool

Definition at line 70 of file ProxyTools.php.

References wfIsConfiguredProxy(), and wfRunHooks().

Forks processes to scan the originating IP for an open proxy server MemCached can be used to skip IPs that have already been scanned.

Definition at line 92 of file ProxyTools.php.

References $params, $title, $url, $wgMemc, SpecialPage\getTitleFor(), wfExpandUrl(), wfGetNull(), and wfMemcKey().