Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoids converting a ClientIp to a tuple when conversion is unnecessary.

  • Loading branch information...
commit 2e2994a5e7140d1f751bf9e49e8daee2b9d14f0d 1 parent 0ad02e6
Nicholas Whittier imperialwicket authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/lib/cb_admin_lib.erl
3  src/lib/cb_admin_lib.erl
View
@@ -16,7 +16,8 @@ mask_ipv4_address({I1, I2, I3, I4}, MaskInt) ->
require_ip_address(Req) ->
ClientIp = case Req:header(x_forwarded_for) of
undefined -> Req:peer_ip();
- IP -> list_to_tuple(lists:map(fun erlang:list_to_integer/1, string:tokens(IP, ".")))
+ IP when is_tuple(IP)-> IP;
+ IP when is_list(IP) -> list_to_tuple(lists:map(fun erlang:list_to_integer/1, string:tokens(IP, ".")))
end,
Authorized = lists:foldr(fun
(IPBlock, false) ->
Please sign in to comment.
Something went wrong with that request. Please try again.