chore(connector http): update ssl for http connector

This commit is contained in:
zhanghongtong 2021-09-02 14:23:24 +08:00 committed by Rory Z
parent 516f2fd06e
commit b014266fa0
1 changed files with 6 additions and 9 deletions

View File

@ -58,9 +58,7 @@ fields(config) ->
, {pool_type, fun pool_type/1} , {pool_type, fun pool_type/1}
, {pool_size, fun pool_size/1} , {pool_size, fun pool_size/1}
, {enable_pipelining, fun enable_pipelining/1} , {enable_pipelining, fun enable_pipelining/1}
, {ssl_opts, #{type => hoconsc:ref(?MODULE, ssl_opts), ] ++ emqx_connector_schema_lib:ssl_fields();
default => #{}}}
];
fields(ssl_opts) -> fields(ssl_opts) ->
[ {cacertfile, fun cacertfile/1} [ {cacertfile, fun cacertfile/1}
@ -200,12 +198,11 @@ check_ssl_opts(Conf) ->
check_ssl_opts(URLFrom, Conf) -> check_ssl_opts(URLFrom, Conf) ->
#{schema := Scheme} = hocon_schema:get_value(URLFrom, Conf), #{schema := Scheme} = hocon_schema:get_value(URLFrom, Conf),
SSLOpts = hocon_schema:get_value("ssl_opts", Conf), SSL= hocon_schema:get_value("ssl", Conf),
case {Scheme, maps:size(SSLOpts)} of case {Scheme, maps:get(enable, SSL, false)} of
{http, 0} -> true; {http, false} -> true;
{http, _} -> false; {https, true} -> true;
{https, 0} -> false; {_, _} -> false
{https, _} -> true
end. end.
update_path(BasePath, {Path, Headers}) -> update_path(BasePath, {Path, Headers}) ->