diff --git a/ejabberd_auth_http/src/ejabberd_auth_http.erl b/ejabberd_auth_http/src/ejabberd_auth_http.erl index b3ab6f1..c3b1b64 100644 --- a/ejabberd_auth_http/src/ejabberd_auth_http.erl +++ b/ejabberd_auth_http/src/ejabberd_auth_http.erl @@ -180,6 +180,15 @@ remove_user_req(LUser, LServer, Password, Method) -> %%% Request maker %%%---------------------------------------------------------------------- +-ifdef(OTP_BELOW_25). +-dialyzer({no_missing_calls, [uri_quote/1]}). +uri_quote(URL) -> + http_uri:encode(URL). +-else. +uri_quote(URL) -> + uri_string:quote(URL). % Available since OTP 25.0 +-endif. + -spec make_req(post | get, binary(), binary(), binary(), binary()) -> {ok, Body :: binary()} | {error, term()}. make_req(_, _, LUser, LServer, _) when LUser == error orelse LServer == error -> @@ -195,9 +204,9 @@ make_req(Method, Path, LUser, LServer, Password) -> false -> <<"/">> end, BasicAuth64 = base64:encode(BasicAuth), - LUserE = list_to_binary(misc:uri_parse(binary_to_list(LUser))), - LServerE = list_to_binary(misc:uri_parse(binary_to_list(LServer))), - PasswordE = list_to_binary(misc:uri_parse(binary_to_list(Password))), + LUserE = list_to_binary(uri_quote(binary_to_list(LUser))), + LServerE = list_to_binary(uri_quote(binary_to_list(LServer))), + PasswordE = list_to_binary(uri_quote(binary_to_list(Password))), Query = <<"user=", LUserE/binary, "&server=", LServerE/binary, "&pass=", PasswordE/binary>>, Header = [{<<"Authorization">>, <<"Basic ", BasicAuth64/binary>>}], ContentType = {<<"Content-Type">>, <<"application/x-www-form-urlencoded">>},