25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Use uri_string module instead of the deprecated http_uri

http_uri is marked for deprecation since OTP 23
Use uri_string which is available since OTP 21
No need to provide alternative, because it's used only by mod_matrix,
and this runs only with Erlang/OTP 24 or higher.

https://www.erlang.org/patches/otp-23.0#inets-7.2
https://www.erlang.org/docs/23/man/http_uri
This commit is contained in:
Badlop 2024-02-14 22:09:53 +01:00
parent 2438fc8b31
commit 816900a6cf

View File

@ -743,7 +743,7 @@ sign_json(Host, JSON) ->
send_request(Host, Method, MatrixServer, Path, Query, JSON,
HTTPOptions, Options) ->
URI1 = iolist_to_binary(
lists:map(fun(P) -> [$/, http_uri:encode(P)] end, Path)),
lists:map(fun(P) -> [$/, uri_string:quote(P)] end, Path)),
URI =
case Query of
[] -> URI1;
@ -751,7 +751,7 @@ send_request(Host, Method, MatrixServer, Path, Query, JSON,
URI2 = str:join(
lists:map(
fun({K, V}) ->
[http_uri:encode(K), $=, http_uri:encode(V)]
[uri_string:quote(K), $=, uri_string:quote(V)]
end, Query), $&),
<<URI1/binary, $?, URI2/binary>>
end,