added tests for non-trusted proxies
This commit is contained in:
parent
59362a95c2
commit
e0e82bb318
@ -1477,6 +1477,13 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(80, $request->getPort());
|
||||
$this->assertFalse($request->isSecure());
|
||||
|
||||
// request is forwarded by a non-trusted proxy
|
||||
Request::setTrustedProxies(array('2.2.2.2'));
|
||||
$this->assertEquals('3.3.3.3', $request->getClientIp());
|
||||
$this->assertEquals('example.com', $request->getHost());
|
||||
$this->assertEquals(80, $request->getPort());
|
||||
$this->assertFalse($request->isSecure());
|
||||
|
||||
// trusted proxy via setTrustedProxies()
|
||||
Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'));
|
||||
$this->assertEquals('1.1.1.1', $request->getClientIp());
|
||||
|
Reference in New Issue
Block a user