aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-10-25 18:41:41 +0300
committerLoïc Hoguin <[email protected]>2016-10-25 18:41:41 +0300
commit0c11cdf485310b584624187a7a757b9a6863887e (patch)
treec0331f5445561737e11d64614549a21a4d1cfcca /core
parent9578ddf3e0cdd8d4669adbb7d1af24f460698669 (diff)
downloaderlang.mk-0c11cdf485310b584624187a7a757b9a6863887e.tar.gz
erlang.mk-0c11cdf485310b584624187a7a757b9a6863887e.tar.bz2
erlang.mk-0c11cdf485310b584624187a7a757b9a6863887e.zip
Use curl instead of wget/erl for fetching files
After a lot of soul searching and experiments, I am opting to using curl for fetching files. It works with very little manipulation on all supported systems. Some might need it installed, but most come with it. While wget was working, it had TLS validation deactivated because some users didn't have CA certificates on their system or wget was not configured properly. This does not seem to be a problem with curl as far as I tested, in particular on OSX. The fallback to use Erlang was also insecure, and probably not the best idea. Let's keep things simple. Curl is required.
Diffstat (limited to 'core')
-rw-r--r--core/core.mk25
1 files changed, 1 insertions, 24 deletions
diff --git a/core/core.mk b/core/core.mk
index 167b1a1..0331489 100644
--- a/core/core.mk
+++ b/core/core.mk
@@ -161,30 +161,7 @@ else
core_native_path = $1
endif
-ifeq ($(shell which wget 2>/dev/null | wc -l), 1)
-define core_http_get
- wget --no-check-certificate -O $(1) $(2)|| rm $(1)
-endef
-else
-define core_http_get.erl
- ssl:start(),
- inets:start(),
- case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of
- {ok, {{_, 200, _}, _, Body}} ->
- case file:write_file("$(1)", Body) of
- ok -> ok;
- {error, R1} -> halt(R1)
- end;
- {error, R2} ->
- halt(R2)
- end,
- halt(0).
-endef
-
-define core_http_get
- $(call erlang,$(call core_http_get.erl,$(call core_native_path,$1),$2))
-endef
-endif
+core_http_get = curl -Lf$(if $(filter-out 0,$(V)),,s)o $(call core_native_path,$1) $2
core_eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))