Skip to content

Commit 1a94ff3

Browse files
committed
Test X-FORWARDED-FOR input to UserHostAddress
Added Unit Tests for comma separated style addresses when input is from the X-FORWAREDED-BY HTTP header. Current implementation throws an FormatException on the IP address when going through a load balancer or proxy
1 parent f3e2a31 commit 1a94ff3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/ServiceStack.WebHost.Endpoints.Tests/Support/EndpointHandlerBaseTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public static IEnumerable EndpointExpectations
6767
//ipv4 loopback
6868
yield return new TestCaseData("127.0.0.1", EndpointAttributes.Localhost);
6969
yield return new TestCaseData("127.0.0.1:20", EndpointAttributes.Localhost);
70+
71+
//ipv4 in X-FORWARDED-FOR HTTP Header format
72+
yield return new TestCaseData("192.168.100.2, 192.168.0.1", EndpointAttributes.External);
73+
yield return new TestCaseData("192.168.100.2, 192.168.0.1, 10.1.1.1", EndpointAttributes.External);
7074
}
7175
}
7276
}

0 commit comments

Comments
 (0)