fix(authn): fix bugs in http and pgsql authn
This commit is contained in:
parent
e31840d943
commit
11bdfcb8f0
|
@ -188,8 +188,8 @@ check_url(URL) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
check_body(Body) ->
|
check_body(Body) ->
|
||||||
lists:any(fun({_, V}) ->
|
lists:all(fun({_, V}) ->
|
||||||
not is_binary(V)
|
is_binary(V)
|
||||||
end, maps:to_list(Body)).
|
end, maps:to_list(Body)).
|
||||||
|
|
||||||
default_headers() ->
|
default_headers() ->
|
||||||
|
|
|
@ -150,7 +150,7 @@ check_password(Password,
|
||||||
parse_query(Query) ->
|
parse_query(Query) ->
|
||||||
case re:run(Query, ?RE_PLACEHOLDER, [global, {capture, all, binary}]) of
|
case re:run(Query, ?RE_PLACEHOLDER, [global, {capture, all, binary}]) of
|
||||||
{match, Captured} ->
|
{match, Captured} ->
|
||||||
PlaceHolders = [PlaceHolder || PlaceHolder <- Captured],
|
PlaceHolders = [PlaceHolder || [PlaceHolder] <- Captured],
|
||||||
Replacements = ["$" ++ integer_to_list(I) || I <- lists:seq(1, length(Captured))],
|
Replacements = ["$" ++ integer_to_list(I) || I <- lists:seq(1, length(Captured))],
|
||||||
NQuery = lists:foldl(fun({PlaceHolder, Replacement}, Query0) ->
|
NQuery = lists:foldl(fun({PlaceHolder, Replacement}, Query0) ->
|
||||||
re:replace(Query0, <<"'\\", PlaceHolder/binary, "'">>, Replacement, [{return, binary}])
|
re:replace(Query0, <<"'\\", PlaceHolder/binary, "'">>, Replacement, [{return, binary}])
|
||||||
|
|
Loading…
Reference in New Issue