Просмотр исходного кода

Add support for disabling ssl verification for hex

Uses global rebar config to see if user wishes to disable ssl verfication.
If {ssl_verify, false} is present certificates will not be verified.
pull/847/head
David Leach 9 лет назад
Родитель
Сommit
d3e83b7a9e
1 измененных файлов: 18 добавлений и 0 удалений
  1. +18
    -0
      src/rebar_pkg_resource.erl

+ 18
- 0
src/rebar_pkg_resource.erl Просмотреть файл

@ -129,6 +129,14 @@ etag(Path) ->
end. end.
ssl_opts(Url) -> ssl_opts(Url) ->
case get_ssl_config() of
ssl_verify_enabled ->
ssl_opts(ssl_verify_enabled, Url);
ssl_verify_disabled ->
[{verify, verify_none}]
end.
ssl_opts(ssl_verify_enabled, Url) ->
case check_ssl_version() of case check_ssl_version() of
true -> true ->
{ok, {_, _, Hostname, _, _, _}} = http_uri:parse(ec_cnv:to_list(Url)), {ok, {_, _, Hostname, _, _, _}} = http_uri:parse(ec_cnv:to_list(Url)),
@ -175,6 +183,16 @@ check_ssl_version() ->
false false
end. end.
get_ssl_config() ->
GlobalConfigFile = rebar_dir:global_config(),
Config = rebar_config:consult_file(GlobalConfigFile),
case proplists:get_value(ssl_verify, Config, []) of
false ->
ssl_verify_disabled;
_ ->
ssl_verify_enabled
end.
parse_vsn(Vsn) -> parse_vsn(Vsn) ->
version_pad(string:tokens(Vsn, ".")). version_pad(string:tokens(Vsn, ".")).

Загрузка…
Отмена
Сохранить