summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2015-09-30 13:59:25 -0500
committerTristan Sloughter <tristan.sloughter@gmail.com>2015-09-30 13:59:25 -0500
commit30465dd12b166f98b15bbe92f8dd4027560b54dd (patch)
tree2f31ca577e1452e557493919a9c0c13e18cf8dae
parent8495964a0a1ba639e1bbd3355560b01cf02255b0 (diff)
parentd3e83b7a9e53fa03ffc6b274ec1cc570cc0e41c0 (diff)
Merge pull request #847 from zugolosian/disable_ssl_verify_option
Add support for disabling ssl verification for hex
-rw-r--r--src/rebar_pkg_resource.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
index 97dc8a7..4f55ad1 100644
--- a/src/rebar_pkg_resource.erl
+++ b/src/rebar_pkg_resource.erl
@@ -129,6 +129,14 @@ etag(Path) ->
end.
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
true ->
{ok, {_, _, Hostname, _, _, _}} = http_uri:parse(ec_cnv:to_list(Url)),
@@ -171,6 +179,16 @@ check_ssl_version() ->
false
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) ->
version_pad(string:tokens(Vsn, ".-")).