diff options
Diffstat (limited to 'src/ejabberd_http.erl')
-rw-r--r-- | src/ejabberd_http.erl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl index 56de7e25..fe13868f 100644 --- a/src/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -535,12 +535,14 @@ analyze_ip_xff({IPLast, Port}, XFF) -> TrustedProxies) of true -> - {ok, IPFirst} = inet_parse:address( - binary_to_list(ClientIP)), - ?DEBUG("The IP ~w was replaced with ~w due to " - "header X-Forwarded-For: ~ts", - [IPLast, IPFirst, XFF]), - IPFirst; + case inet_parse:address(binary_to_list(ClientIP)) of + {ok, IPFirst} -> + ?DEBUG("The IP ~w was replaced with ~w due to " + "header X-Forwarded-For: ~ts", + [IPLast, IPFirst, XFF]), + IPFirst; + E -> throw(E) + end; false -> IPLast end, {IPClient, Port}. |