fix error with X-Forwarded-For headers with multiple IP addresses

We have to make sure here that the `_get_ipaddress` function returns at most one IP address.