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.
Merge pull request #725 from cspurk/master

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