Merge branch 'dev/v4.3.0' into fix/webhook_certs
This commit is contained in:
commit
8d56371465
|
@ -61,20 +61,7 @@ translate_env(EnvName) ->
|
||||||
_ -> 80
|
_ -> 80
|
||||||
end),
|
end),
|
||||||
Path = path(Path0),
|
Path = path(Path0),
|
||||||
Host = case inet:parse_address(Host0) of
|
{Inet, Host} = parse_host(Host0),
|
||||||
{ok, {_,_,_,_} = Addr} -> Addr;
|
|
||||||
{ok, {_,_,_,_,_,_,_,_} = Addr} -> Addr;
|
|
||||||
{error, einval} -> Host0
|
|
||||||
end,
|
|
||||||
Inet = case Host of
|
|
||||||
{_,_,_,_} -> inet;
|
|
||||||
{_,_,_,_,_,_,_,_} -> inet6;
|
|
||||||
_ ->
|
|
||||||
case inet:getaddr(Host, inet6) of
|
|
||||||
{error, _} -> inet;
|
|
||||||
{ok, _} -> inet6
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
MoreOpts = case Scheme of
|
MoreOpts = case Scheme of
|
||||||
"http" ->
|
"http" ->
|
||||||
[{transport_opts, [Inet]}];
|
[{transport_opts, [Inet]}];
|
||||||
|
@ -152,6 +139,17 @@ unload_hooks() ->
|
||||||
ehttpc_sup:stop_pool('emqx_auth_http/acl_req'),
|
ehttpc_sup:stop_pool('emqx_auth_http/acl_req'),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
parse_host(Host) ->
|
||||||
|
case inet:parse_address(Host) of
|
||||||
|
{ok, Addr} when size(Addr) =:= 4 -> {inet, Addr};
|
||||||
|
{ok, Addr} when size(Addr) =:= 8 -> {inet6, Addr};
|
||||||
|
{error, einval} ->
|
||||||
|
case inet:getaddr(Host, inet6) of
|
||||||
|
{ok, _} -> {inet6, Host};
|
||||||
|
{error, _} -> {inet, Host}
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
||||||
to_lower(Headers) ->
|
to_lower(Headers) ->
|
||||||
[{string:to_lower(K), V} || {K, V} <- Headers].
|
[{string:to_lower(K), V} || {K, V} <- Headers].
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{deps,
|
{deps,
|
||||||
[{eredis_cluster, {git, "https://github.com/emqx/eredis_cluster", {tag, "0.6.3"}}}
|
[{eredis_cluster, {git, "https://github.com/emqx/eredis_cluster", {tag, "0.6.4"}}}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{erl_opts, [warn_unused_vars,
|
{erl_opts, [warn_unused_vars,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{deps, [
|
{deps, [
|
||||||
{recon, {git, "https://github.com/ferd/recon", {tag, "2.5.0"}}}
|
%% recon "https://github.com/ferd/recon" at root rebar.config
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{edoc_opts, [{preprocess, true}]}.
|
{edoc_opts, [{preprocess, true}]}.
|
||||||
|
|
|
@ -340,20 +340,7 @@ pool_opts(Params = #{<<"url">> := URL}) ->
|
||||||
end),
|
end),
|
||||||
PoolSize = maps:get(<<"pool_size">>, Params, 32),
|
PoolSize = maps:get(<<"pool_size">>, Params, 32),
|
||||||
ConnectTimeout = timer:seconds(maps:get(<<"connect_timeout">>, Params, 5)),
|
ConnectTimeout = timer:seconds(maps:get(<<"connect_timeout">>, Params, 5)),
|
||||||
Host = case inet:parse_address(Host0) of
|
{Inet, Host} = parse_host(Host0),
|
||||||
{ok, {_,_,_,_} = Addr} -> Addr;
|
|
||||||
{ok, {_,_,_,_,_,_,_,_} = Addr} -> Addr;
|
|
||||||
{error, einval} -> Host0
|
|
||||||
end,
|
|
||||||
Inet = case Host of
|
|
||||||
{_,_,_,_} -> inet;
|
|
||||||
{_,_,_,_,_,_,_,_} -> inet6;
|
|
||||||
_ ->
|
|
||||||
case inet:getaddr(Host, inet6) of
|
|
||||||
{error, _} -> inet;
|
|
||||||
{ok, _} -> inet6
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
MoreOpts = case Scheme of
|
MoreOpts = case Scheme of
|
||||||
"http" ->
|
"http" ->
|
||||||
[{transport_opts, [Inet]}];
|
[{transport_opts, [Inet]}];
|
||||||
|
@ -388,3 +375,14 @@ pool_opts(Params = #{<<"url">> := URL}) ->
|
||||||
|
|
||||||
pool_name(ResId) ->
|
pool_name(ResId) ->
|
||||||
list_to_atom("webhook:" ++ str(ResId)).
|
list_to_atom("webhook:" ++ str(ResId)).
|
||||||
|
|
||||||
|
parse_host(Host) ->
|
||||||
|
case inet:parse_address(Host) of
|
||||||
|
{ok, Addr} when size(Addr) =:= 4 -> {inet, Addr};
|
||||||
|
{ok, Addr} when size(Addr) =:= 8 -> {inet6, Addr};
|
||||||
|
{error, einval} ->
|
||||||
|
case inet:getaddr(Host, inet6) of
|
||||||
|
{ok, _} -> {inet6, Host};
|
||||||
|
{error, _} -> {inet, Host}
|
||||||
|
end
|
||||||
|
end.
|
||||||
|
|
|
@ -58,20 +58,7 @@ translate_env() ->
|
||||||
_ -> 80
|
_ -> 80
|
||||||
end),
|
end),
|
||||||
Path = path(Path0),
|
Path = path(Path0),
|
||||||
Host = case inet:parse_address(Host0) of
|
{Inet, Host} = parse_host(Host0),
|
||||||
{ok, {_,_,_,_} = Addr} -> Addr;
|
|
||||||
{ok, {_,_,_,_,_,_,_,_} = Addr} -> Addr;
|
|
||||||
{error, einval} -> Host0
|
|
||||||
end,
|
|
||||||
Inet = case Host of
|
|
||||||
{_,_,_,_} -> inet;
|
|
||||||
{_,_,_,_,_,_,_,_} -> inet6;
|
|
||||||
_ ->
|
|
||||||
case inet:getaddr(Host, inet6) of
|
|
||||||
{error, _} -> inet;
|
|
||||||
{ok, _} -> inet6
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
PoolSize = application:get_env(?APP, pool_size, 32),
|
PoolSize = application:get_env(?APP, pool_size, 32),
|
||||||
MoreOpts = case Scheme of
|
MoreOpts = case Scheme of
|
||||||
"http" ->
|
"http" ->
|
||||||
|
@ -117,3 +104,14 @@ path(Path) ->
|
||||||
set_content_type(Headers) ->
|
set_content_type(Headers) ->
|
||||||
NHeaders = proplists:delete(<<"Content-Type">>, proplists:delete(<<"content-type">>, Headers)),
|
NHeaders = proplists:delete(<<"Content-Type">>, proplists:delete(<<"content-type">>, Headers)),
|
||||||
[{<<"content-type">>, <<"application/json">>} | NHeaders].
|
[{<<"content-type">>, <<"application/json">>} | NHeaders].
|
||||||
|
|
||||||
|
parse_host(Host) ->
|
||||||
|
case inet:parse_address(Host) of
|
||||||
|
{ok, Addr} when size(Addr) =:= 4 -> {inet, Addr};
|
||||||
|
{ok, Addr} when size(Addr) =:= 8 -> {inet6, Addr};
|
||||||
|
{error, einval} ->
|
||||||
|
case inet:getaddr(Host, inet6) of
|
||||||
|
{ok, _} -> {inet6, Host};
|
||||||
|
{error, _} -> {inet, Host}
|
||||||
|
end
|
||||||
|
end.
|
|
@ -54,6 +54,7 @@
|
||||||
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}}
|
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}}
|
||||||
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.3"}}}
|
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.3"}}}
|
||||||
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.2"}}}
|
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.2"}}}
|
||||||
|
, {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
|
||||||
, {getopt, "1.0.1"}
|
, {getopt, "1.0.1"}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
|
|
@ -275,14 +275,8 @@ util_alloc()->
|
||||||
alloc(?UTIL_ALLOCATORS).
|
alloc(?UTIL_ALLOCATORS).
|
||||||
|
|
||||||
alloc(Type) ->
|
alloc(Type) ->
|
||||||
[{{T, Instance}, Props} || {{T, Instance}, Props} <- allocators(), lists:member(T, Type)].
|
[{{T, Instance}, Props} ||
|
||||||
|
{{T, Instance}, Props} <- recon_alloc:allocators(), lists:member(T, Type)].
|
||||||
allocators() ->
|
|
||||||
UtilAllocators = erlang:system_info(alloc_util_allocators),
|
|
||||||
Allocators = [sys_alloc, mseg_alloc|UtilAllocators],
|
|
||||||
[{{A, N}, lists:sort(proplists:delete(versions, Props))} ||
|
|
||||||
A <- Allocators, Allocs <- [erlang:system_info({allocator, A})],
|
|
||||||
Allocs =/= false, {_, N, Props} <- Allocs].
|
|
||||||
|
|
||||||
container_size(Prop, Keyword, Container) ->
|
container_size(Prop, Keyword, Container) ->
|
||||||
Sbcs = container_value(Prop, Keyword, sbcs, Container),
|
Sbcs = container_value(Prop, Keyword, sbcs, Container),
|
||||||
|
|
Loading…
Reference in New Issue