aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-01-23 08:49:30 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-01-23 08:49:30 -0800
commit1117d4abe4fe3545f9169b05269363c9655061b1 (patch)
treea8576320afc36f7342d9285d6e84ce755a087f35 /src/test/java/org/traccar
parenteb2697434dbbb8c12cad26df94e3a367880ac4db (diff)
downloadtrackermap-server-1117d4abe4fe3545f9169b05269363c9655061b1.tar.gz
trackermap-server-1117d4abe4fe3545f9169b05269363c9655061b1.tar.bz2
trackermap-server-1117d4abe4fe3545f9169b05269363c9655061b1.zip
Fix logging issue (fix #4473)
Diffstat (limited to 'src/test/java/org/traccar')
-rw-r--r--src/test/java/org/traccar/helper/ServletHelperTest.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/test/java/org/traccar/helper/ServletHelperTest.java b/src/test/java/org/traccar/helper/ServletHelperTest.java
index 7359bf3dd..e419b6491 100644
--- a/src/test/java/org/traccar/helper/ServletHelperTest.java
+++ b/src/test/java/org/traccar/helper/ServletHelperTest.java
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertEquals;
public class ServletHelperTest {
@Test
- public void testIpBehindReverseProxy() {
+ public void testRetrieveRemoteAddressProxyMultiple() {
MockRequest request = new MockRequest();
request.setRemoteAddress("147.120.1.5");
request.addHeader("X-FORWARDED-FOR", "231.23.45.65, 10.20.10.33, 10.20.20.34");
@@ -20,7 +20,16 @@ public class ServletHelperTest {
}
@Test
- public void testNormalIp() {
+ public void testRetrieveRemoteAddressProxySingle() {
+ MockRequest request = new MockRequest();
+ request.setRemoteAddress("147.120.1.5");
+ request.addHeader("X-FORWARDED-FOR", "231.23.45.65");
+
+ assertEquals("231.23.45.65", ServletHelper.retrieveRemoteAddress(request));
+ }
+
+ @Test
+ public void testRetrieveRemoteAddressNoProxy() {
MockRequest request = new MockRequest();
request.setRemoteAddress("231.23.45.65");