0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

inet_address:parse/1 does not accept binaries as an input, only strings

This commit is contained in:
Yurii Rashkovskii 2012-01-04 15:13:14 -08:00
parent 5c101560df
commit ade1fb93ca

View file

@ -89,8 +89,8 @@ peer_addr(Req = #http_req{}) ->
end
end,
{ok, PeerAddr} = if
is_binary(RealIp) -> inet_parse:address(RealIp);
is_binary(ForwardedFor) -> inet_parse:address(ForwardedFor);
is_binary(RealIp) -> inet_parse:address(binary_to_list(RealIp));
is_binary(ForwardedFor) -> inet_parse:address(binary_to_list(ForwardedFor));
true -> {ok, PeerIp}
end,
{PeerAddr, Req3}.