Remove OTP_BELOW_24
This commit is contained in:
@@ -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}]) ++
|
||||
|
||||
@@ -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'}},
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-35
@@ -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, <<Acc/binary, Hex>>);
|
||||
uri_decode(<<H, T/binary>>, Acc) when H /= 0 ->
|
||||
uri_decode(T, <<Acc/binary, H>>);
|
||||
uri_decode(<<>>, Acc) -> Acc.
|
||||
-else.
|
||||
uri_decode(Path) ->
|
||||
uri_string:percent_decode(Path).
|
||||
-endif.
|
||||
|
||||
-ifdef(OTP_BELOW_27).
|
||||
json_encode(Term) ->
|
||||
jiffy:encode(Term).
|
||||
|
||||
@@ -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().
|
||||
|
||||
@@ -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), $&),
|
||||
<<URI1/binary, $?, URI2/binary>>
|
||||
end,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) ->
|
||||
|
||||
Reference in New Issue
Block a user