Просмотр исходного кода

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.
Loïc Hoguin 8 лет назад
Родитель
Сommit
0c11cdf485
1 измененных файлов с 1 добавлено и 24 удалено
  1. 1 24
      core/core.mk

+ 1 - 24
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)))