diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_pkg_resource.erl | 2 | ||||
-rw-r--r-- | src/rebar_utils.erl | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl index 16ec83f..2cf167e 100644 --- a/src/rebar_pkg_resource.erl +++ b/src/rebar_pkg_resource.erl @@ -191,7 +191,7 @@ ssl_opts(Url) -> ETag :: string(), Res :: ok. store_etag_in_cache(Path, ETag) -> - ok = file:write_file(Path, ETag). + _ = file:write_file(Path, ETag). %%%============================================================================= %%% Private functions diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 9bbe54e..a911cc2 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -854,10 +854,18 @@ set_httpc_options(_, []) -> ok; set_httpc_options(Scheme, Proxy) -> - {ok, {_, UserInfo, Host, Port, _, _}} = http_uri:parse(Proxy), + URI = normalise_proxy(Scheme, Proxy), + {ok, {_, UserInfo, Host, Port, _, _}} = http_uri:parse(URI), httpc:set_options([{Scheme, {{Host, Port}, []}}], rebar), set_proxy_auth(UserInfo). +normalise_proxy(Scheme, URI) -> + case re:run(URI, "://", [unicode]) of + nomatch when Scheme =:= https_proxy -> "https://" ++ URI; + nomatch when Scheme =:= proxy -> "http://" ++ URI; + _ -> URI + end. + url_append_path(Url, ExtraPath) -> case http_uri:parse(Url) of {ok, {Scheme, UserInfo, Host, Port, Path, Query}} -> |