Add support for OTP 25 (requires ejabberd newer than 17 August 2022)
This commit is contained in:
parent
35d05f2925
commit
037c3749f3
|
@ -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">>},
|
||||
|
|
Loading…
Reference in New Issue