Переглянути джерело

Added rebar profile to httpc initialization and calls.

pull/579/head
CarlosEDP 9 роки тому
джерело
коміт
38cc32c40a
5 змінених файлів з 12 додано та 7 видалено
  1. +5
    -3
      bootstrap
  2. +2
    -1
      src/rebar3.erl
  3. +2
    -1
      src/rebar_pkg_resource.erl
  4. +2
    -1
      src/rebar_prv_update.erl
  5. +1
    -1
      src/rebar_utils.erl

+ 5
- 3
bootstrap Переглянути файл

@ -9,6 +9,8 @@ main(_Args) ->
application:start(public_key),
application:start(ssl),
inets:start(),
inets:start(httpc, [{profile, rebar}]),
set_httpc_options(),
%% Fetch and build deps required to build rebar3
BaseDeps = [{providers, []}
@ -82,10 +84,10 @@ extract(Binary) ->
{ok, Contents}.
request(Url) ->
set_httpc_options(),
case httpc:request(get, {Url, []},
[{relaxed, true}],
[{body_format, binary}]) of
[{body_format, binary}],
rebar) of
{ok, {{_Version, 200, _Reason}, _Headers, Body}} ->
{ok, Body};
Error ->
@ -114,7 +116,7 @@ set_httpc_options(_, []) ->
set_httpc_options(Scheme, Proxy) ->
{ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
httpc:set_options([{Scheme, {{Host, Port}, []}}]).
httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).
compile(App, FirstFiles) ->
Dir = filename:join(filename:absname("_build/default/lib/"), App),

+ 2
- 1
src/rebar3.erl Переглянути файл

@ -273,5 +273,6 @@ start_and_load_apps() ->
application:start(public_key),
application:start(ssl),
inets:start(),
inets:start(httpc),
inets:start(httpc, [{profile, rebar}]),
rebar_utils:set_httpc_options().

+ 2
- 1
src/rebar_pkg_resource.erl Переглянути файл

@ -95,7 +95,8 @@ make_vsn(_) ->
request(Url, ETag) ->
case httpc:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]},
[{relaxed, true}],
[{body_format, binary}]) of
[{body_format, binary}],
rebar) of
{ok, {{_Version, 200, _Reason}, Headers, Body}} ->
?DEBUG("Successfully downloaded ~s", [Url]),
{"etag", ETag1} = lists:keyfind("etag", 1, Headers),

+ 2
- 1
src/rebar_prv_update.erl Переглянути файл

@ -43,7 +43,8 @@ do(State) ->
Url = rebar_state:get(State, rebar_packages_cdn, "https://s3.amazonaws.com/s3.hex.pm/registry.ets.gz"),
{ok, _RequestId} = httpc:request(get, {Url, []},
[], [{stream, TmpFile}, {sync, true}]),
[], [{stream, TmpFile}, {sync, true}],
rebar),
{ok, Data} = file:read_file(TmpFile),
Unzipped = zlib:gunzip(Data),
ok = file:write_file(HexFile, Unzipped),

+ 1
- 1
src/rebar_utils.erl Переглянути файл

@ -685,4 +685,4 @@ set_httpc_options(_, []) ->
set_httpc_options(Scheme, Proxy) ->
{ok, {_, _, Host, Port, _, _}} = http_uri:parse(Proxy),
httpc:set_options([{Scheme, {{Host, Port}, []}}]).
httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar).

Завантаження…
Відмінити
Зберегти