Skip to content

Commit

Permalink
Use uri_string module instead of the deprecated http_uri
Browse files Browse the repository at this point in the history
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
  • Loading branch information
badlop committed Feb 14, 2024
1 parent dba6078 commit 5f78427
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mod_matrix_gw.erl
Original file line number Diff line number Diff line change
Expand Up @@ -743,15 +743,15 @@ 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;
_ ->
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,
Expand Down

0 comments on commit 5f78427

Please sign in to comment.