From 51081276c2efec6f0972e51226d84dda276df0a6 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 12 Nov 2025 21:41:39 +0100 Subject: [PATCH] Remove OTP_BELOW_24 --- mix.exs | 1 - rebar.config | 1 - src/ejabberd_http.erl | 2 +- src/misc.erl | 36 +----------------------------------- src/mod_http_upload.erl | 4 ++-- src/mod_matrix_gw.erl | 6 +++--- src/prosody2ejabberd.erl | 4 ++-- test/commands_tests.erl | 9 --------- 8 files changed, 9 insertions(+), 54 deletions(-) diff --git a/mix.exs b/mix.exs index 716807b00..4c9f176bb 100644 --- a/mix.exs +++ b/mix.exs @@ -77,7 +77,6 @@ defmodule Ejabberd.MixProject do result = [{:d, :ELIXIR_ENABLED}] ++ cond_options() ++ Enum.map(includes, fn (path) -> {:i, path} end) ++ - if_version_below(~c"24", [{:d, :OTP_BELOW_24}]) ++ if_version_below(~c"25", [{:d, :OTP_BELOW_25}]) ++ if_version_below(~c"26", [{:d, :OTP_BELOW_26}]) ++ if_version_below(~c"27", [{:d, :OTP_BELOW_27}]) ++ diff --git a/rebar.config b/rebar.config index 97d63e410..260af9f6f 100644 --- a/rebar.config +++ b/rebar.config @@ -112,7 +112,6 @@ {erl_opts, [nowarn_deprecated_function, {i, "include"}, - {if_version_below, "24", {d, 'OTP_BELOW_24'}}, {if_version_below, "25", {d, 'OTP_BELOW_25'}}, {if_version_below, "26", {d, 'OTP_BELOW_26'}}, {if_version_below, "27", {d, 'OTP_BELOW_27'}}, diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl index 709585145..3664e091f 100644 --- a/src/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -718,7 +718,7 @@ file_format_error(Reason) -> url_decode_q_split_normalize(Path) -> {NPath, Query} = url_decode_q_split(Path), LPath = normalize_path([NPE - || NPE <- str:tokens(misc:uri_decode(NPath), <<"/">>)]), + || NPE <- str:tokens(uri_string:percent_decode(NPath), <<"/">>)]), {LPath, Query}. % Code below is taken (with some modifications) from the yaws webserver, which diff --git a/src/misc.erl b/src/misc.erl index 43d6989c3..62855a6a3 100644 --- a/src/misc.erl +++ b/src/misc.erl @@ -42,8 +42,7 @@ intersection/2, format_val/1, cancel_timer/1, unique_timestamp/0, is_mucsub_message/1, best_match/2, pmap/2, peach/2, format_exception/4, get_my_ipv4_address/0, get_my_ipv6_address/0, parse_ip_mask/1, - uri_parse/1, uri_parse/2, uri_quote/1, - uri_decode/1, + uri_parse/1, uri_parse/2, json_encode/1, json_decode/1, set_proc_label/1, match_ip_mask/3, format_hosts_list/1, format_cycle/1, delete_dir/1, @@ -79,39 +78,6 @@ uri_parse(URL) -> uri_parse(URL, Protocols) -> yconf:parse_uri(URL, Protocols). --ifdef(OTP_BELOW_25). --ifdef(OTP_BELOW_24). -uri_quote(Data) -> - Data. --else. -uri_quote(Data) -> - http_uri:encode(Data). --endif. --else. -uri_quote(Data) -> - uri_string:quote(Data). --endif. - -%% @doc Decode a part of the URL and return string() -%% -spec url_decode(binary()) -> bitstring(). - --ifdef(OTP_BELOW_24). -uri_decode(Path) -> uri_decode(Path, <<>>). - -uri_decode(<<$%, Hi, Lo, Tail/binary>>, Acc) -> - Hex = list_to_integer([Hi, Lo], 16), - if Hex == 0 -> exit(badurl); - true -> ok - end, - uri_decode(Tail, <>); -uri_decode(<>, Acc) when H /= 0 -> - uri_decode(T, <>); -uri_decode(<<>>, Acc) -> Acc. --else. -uri_decode(Path) -> - uri_string:percent_decode(Path). --endif. - -ifdef(OTP_BELOW_27). json_encode(Term) -> jiffy:encode(Term). diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index a80d24dc0..81a6c210c 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -922,14 +922,14 @@ mk_slot(PutURL, GetURL, XMLNS, Query) -> reencode_url(UrlString) -> {ok, _, _, Host, _, _, _} = yconf:parse_uri(misc:url_encode(UrlString)), - HostDecoded = misc:uri_decode(Host), + HostDecoded = uri_string:percent_decode(Host), HostIdna = idna:encode(HostDecoded), re:replace(UrlString, Host, HostIdna, [{return, binary}]). redecode_url(UrlString) -> {ok, _, _, HostIdna, _, _, _} = yconf:parse_uri(<<"http://", UrlString/binary>>), HostDecoded = idna:decode(HostIdna), - Host = misc:uri_quote(HostDecoded), + Host = uri_string:quote(HostDecoded), re:replace(UrlString, HostIdna, Host, [{return, binary}]). -spec make_user_string(jid(), sha1 | node) -> binary(). diff --git a/src/mod_matrix_gw.erl b/src/mod_matrix_gw.erl index 54edafcf2..70e8d0ae3 100644 --- a/src/mod_matrix_gw.erl +++ b/src/mod_matrix_gw.erl @@ -816,7 +816,7 @@ sign_json(Host, JSON) -> send_request(Host, Method, MatrixServer, Path, Query, JSON, HTTPOptions, Options) -> URI1 = iolist_to_binary( - lists:map(fun(P) -> [$/, misc:uri_quote(P)] end, Path)), + lists:map(fun(P) -> [$/, uri_string:quote(P)] end, Path)), URI = case Query of [] -> URI1; @@ -825,8 +825,8 @@ send_request(Host, Method, MatrixServer, Path, Query, JSON, lists:map( fun({K, V}) -> iolist_to_binary( - [misc:uri_quote(K), $=, - misc:uri_quote(V)]) + [uri_string:quote(K), $=, + uri_string:quote(V)]) end, Query), $&), <> end, diff --git a/src/prosody2ejabberd.erl b/src/prosody2ejabberd.erl index 045abdf90..6b2a6c9a9 100644 --- a/src/prosody2ejabberd.erl +++ b/src/prosody2ejabberd.erl @@ -87,8 +87,8 @@ convert_dir(Path, Host, Type) -> case eval_file(FilePath) of {ok, Data} -> Name = iolist_to_binary(filename:rootname(File)), - convert_data(misc:uri_decode(Host), Type, - misc:uri_decode(Name), Data); + convert_data(uri_string:percent_decode(Host), Type, + uri_string:percent_decode(Name), Data); Err -> Err end diff --git a/test/commands_tests.erl b/test/commands_tests.erl index 7b0675c3f..0b6f3d64f 100644 --- a/test/commands_tests.erl +++ b/test/commands_tests.erl @@ -32,13 +32,6 @@ %%%================================== %%%% setup --ifdef(OTP_BELOW_24). - -single_cases() -> - {commands_single, [sequence], []}. - --else. - single_cases() -> {commands_single, [sequence], @@ -70,8 +63,6 @@ single_cases() -> %%single_test(adhoc_all), single_test(clean)]}. --endif. - %% @format-begin single_test(T) ->