Added a unit test to validate traffic from more than 3 hops

This commit is contained in:
venusbb
2017-07-11 09:59:41 +01:00
parent 5d57189187
commit d3db4a6a01

View File

@@ -47,6 +47,7 @@ def restrict_ip_sms():
ip = ''
if request.headers.get("X-Forwarded-For"):
# X-Forwarded-For looks like "203.0.113.195, 70.41.3.18, 150.172.238.178"
# Counting backwards and look at the IP at the 3rd last hop - hence, hop(end-3)
ip_route = request.headers.get("X-Forwarded-For")
ip_list = ip_route.split(',')
if len(ip_list) >= 3: