Skip to content

Commit e0e82bb

Browse files
ged15fabpot
authored andcommitted
added tests for non-trusted proxies
1 parent 59362a9 commit e0e82bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,13 @@ public function testTrustedProxies()
14771477
$this->assertEquals(80, $request->getPort());
14781478
$this->assertFalse($request->isSecure());
14791479

1480+
// request is forwarded by a non-trusted proxy
1481+
Request::setTrustedProxies(array('2.2.2.2'));
1482+
$this->assertEquals('3.3.3.3', $request->getClientIp());
1483+
$this->assertEquals('example.com', $request->getHost());
1484+
$this->assertEquals(80, $request->getPort());
1485+
$this->assertFalse($request->isSecure());
1486+
14801487
// trusted proxy via setTrustedProxies()
14811488
Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'));
14821489
$this->assertEquals('1.1.1.1', $request->getClientIp());

0 commit comments

Comments
 (0)