diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2018-04-20 16:10:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-20 16:10:04 -0700 |
commit | 39b743b36a13f63ccc4b9cd17594be070528d180 (patch) | |
tree | d10caf1a76711170ed56737af66d8558fe0f5baf /src | |
parent | d83167c74c15820f0f9a7513044faaecac533267 (diff) | |
parent | 088c47ad1d1f23650dc7bdc3d10659b9a223abb8 (diff) |
Merge pull request #1756 from ferd/handle-schemeless-proxy
Handle Schema-less Proxy URLs in ENV vars
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_utils.erl | 10 |
1 files changed, 9 insertions, 1 deletions
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}} -> |