This is an old revision of the document!
Table of Contents
RemoteAddress
Layer: Core · Source: lib/core/RemoteAddress.php:18 (lines 18–173)
class RemoteAddress
Docblock Metadata
^ Tag ^ Value ^ | ''@category'' | Core Class | | ''@license'' | https://github.com/zendframework/zend-http/blob/master/LICENSE.md New BSD License | | ''@see'' | https://github.com/zendframework/zend-http for the canonical source repository | | ''@see'' | https://framework.zend.com/apidoc/2.1/classes/Zend.Http.PhpEnvironment.RemoteAddress.html |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (3)
^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ''protected'' | ''(untyped)'' | ''$useProxy'' | ''false;'' | 30 | | ''protected'' | ''(untyped)'' | ''$trustedProxies'' | ''[];'' | 37 | | ''protected'' | ''(untyped)'' | ''$proxyHeader'' | '''HTTP_X_FORWARDED_FOR';'' | 44 |
Methods (7)
^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''setUseProxy()'' | Changes proxy handling setting. | 55 | | public | ''isUseProxy()'' | Checks proxy handling setting. | 66 | | public | ''setTrustedProxies()'' | Set list of trusted proxy addresses | 77 | | public | ''setProxyHeader()'' | Set the header to introspect for proxy IPs | 89 | | public | ''getIpAddress()'' | Returns client IP address. | 100 | | protected | ''getIpAddressFromProxy()'' | Attempt to get the IP address for a proxied client | 121 | | protected | ''normalizeProxyHeader()'' | Normalize a header string | 164 |
setUseProxy()
public function setUseProxy($useProxy = true)
lines 55–59 (5)
Changes proxy handling setting.
This must be static method, since validators are recovered automatically at session read, so this is the only way to switch setting.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$useProxy'' | ''(untyped)'' | ''true'' | Whether to check also proxied IP addresses. |
Returns: (none declared) — $this
isUseProxy()
public function isUseProxy()
lines 66–69 (4)
Checks proxy handling setting.
Takes no parameters.
Returns: (none declared) — bool Current setting value.
setTrustedProxies()
public function setTrustedProxies(array $trustedProxies)
lines 77–81 (5)
Set list of trusted proxy addresses
^ Parameter ^ Type ^ Default ^ Description ^ | ''$trustedProxies'' | ''array'' | //required// | //none// |
Returns: (none declared) — $this
setProxyHeader()
public function setProxyHeader($header = 'X-Forwarded-For')
lines 89–93 (5)
Set the header to introspect for proxy IPs
^ Parameter ^ Type ^ Default ^ Description ^ | ''$header'' | ''(untyped)'' | '''X-Forwarded-For''' | //none// |
Returns: (none declared) — $this
getIpAddress()
public function getIpAddress()
lines 100–113 (14)
Returns client IP address.
Takes no parameters.
Returns: (none declared) — string IP address.
getIpAddressFromProxy()
protected function getIpAddressFromProxy()
lines 121–153 (33)
Attempt to get the IP address for a proxied client
Takes no parameters.
Returns: (none declared) — false|string
normalizeProxyHeader()
protected function normalizeProxyHeader($header)
lines 164–172 (9)
Normalize a header string
Normalizes a header string to a format that is compatible with $_SERVER
^ Parameter ^ Type ^ Default ^ Description ^ | ''$header'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — string
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
