From 4364559805245260f89d70d590d0686250aa5f93 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 16 Jul 2016 14:11:14 -0400 Subject: Handle HTTP header X-Real-IP to get IP address --- tests/units/Core/Http/RequestTest.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/units/Core/Http/RequestTest.php') diff --git a/tests/units/Core/Http/RequestTest.php b/tests/units/Core/Http/RequestTest.php index 6fa796f7..1db0100c 100644 --- a/tests/units/Core/Http/RequestTest.php +++ b/tests/units/Core/Http/RequestTest.php @@ -169,6 +169,9 @@ class RequestTest extends Base $request = new Request($this->container, array(), array(), array(), array(), array()); $this->assertEquals('Unknown', $request->getIpAddress()); + $request = new Request($this->container, array('HTTP_X_REAL_IP' => '192.168.1.1,127.0.0.1'), array(), array(), array(), array()); + $this->assertEquals('192.168.1.1', $request->getIpAddress()); + $request = new Request($this->container, array('HTTP_X_FORWARDED_FOR' => '192.168.0.1,127.0.0.1'), array(), array(), array(), array()); $this->assertEquals('192.168.0.1', $request->getIpAddress()); -- cgit v1.2.3