Browse Source

force use of tls1.2 for http fetching to work on OTP-23-rc1

pull/2240/head
Tristan Sloughter 5 years ago
parent
commit
b7cfa757dc
No known key found for this signature in database GPG Key ID: AAB97DDECCEB8150
4 changed files with 6 additions and 5 deletions
  1. +1
    -1
      bootstrap
  2. +2
    -1
      src/r3_hex_http_httpc.erl
  3. +1
    -1
      src/r3_hex_tarball.erl
  4. +2
    -2
      src/rebar_utils.erl

+ 1
- 1
bootstrap View File

@ -113,7 +113,7 @@ extract(Binary) ->
{ok, Contents}. {ok, Contents}.
request(Url) -> request(Url) ->
HttpOptions = [{relaxed, true} | get_proxy_auth()],
HttpOptions = [{ssl, [{versions, ['tlsv1.2']}]}, {relaxed, true} | get_proxy_auth()],
case httpc:request(get, {Url, []}, case httpc:request(get, {Url, []},
HttpOptions, HttpOptions,

+ 2
- 1
src/r3_hex_http_httpc.erl View File

@ -13,7 +13,8 @@
request(Method, URI, ReqHeaders, Body, AdapterConfig) -> request(Method, URI, ReqHeaders, Body, AdapterConfig) ->
Profile = maps:get(profile, AdapterConfig, default), Profile = maps:get(profile, AdapterConfig, default),
Request = build_request(URI, ReqHeaders, Body), Request = build_request(URI, ReqHeaders, Body),
case httpc:request(Method, Request, [], [{body_format, binary}], Profile) of
case httpc:request(Method, Request, [{ssl, rebar_utils:ssl_opts(URI)}],
[{body_format, binary}], Profile) of
{ok, {{_, StatusCode, _}, RespHeaders, RespBody}} -> {ok, {{_, StatusCode, _}, RespHeaders, RespBody}} ->
RespHeaders2 = load_headers(RespHeaders), RespHeaders2 = load_headers(RespHeaders),
{ok, {StatusCode, RespHeaders2, RespBody}}; {ok, {StatusCode, RespHeaders2, RespBody}};

+ 1
- 1
src/r3_hex_tarball.erl View File

@ -223,7 +223,7 @@ do_unpack(Files, OuterChecksum, Output) ->
finish_unpack({error, _} = Error) -> finish_unpack({error, _} = Error) ->
Error; Error;
finish_unpack(#{metadata := Metadata, files := Files, inner_checksum := InnerChecksum, outer_checksum := OuterChecksum, output := Output}) -> finish_unpack(#{metadata := Metadata, files := Files, inner_checksum := InnerChecksum, outer_checksum := OuterChecksum, output := Output}) ->
_Version = maps:get("VERSION", Files),
_ = maps:get("VERSION", Files),
ContentsBinary = maps:get("contents.tar.gz", Files), ContentsBinary = maps:get("contents.tar.gz", Files),
filelib:ensure_dir(filename:join(Output, "*")), filelib:ensure_dir(filename:join(Output, "*")),
case unpack_tarball(ContentsBinary, Output) of case unpack_tarball(ContentsBinary, Output) of

+ 2
- 2
src/rebar_utils.erl View File

@ -1010,9 +1010,9 @@ is_list_of_strings(List) when is_list(List) ->
ssl_opts(Url) -> ssl_opts(Url) ->
case get_ssl_config() of case get_ssl_config() of
ssl_verify_enabled -> ssl_verify_enabled ->
ssl_opts(ssl_verify_enabled, Url);
[{versions, ['tlsv1.2']} | ssl_opts(ssl_verify_enabled, Url)];
ssl_verify_disabled -> ssl_verify_disabled ->
[{verify, verify_none}]
[{versions, ['tlsv1.2']}, {verify, verify_none}]
end. end.
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------

Loading…
Cancel
Save