From 0f7de9268d01c6a7f5b4b54e37a1d3a94579c889 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Wed, 9 May 2018 11:54:55 +0200 Subject: [PATCH] check_port_source: download first kilobytes of file Unfortunately, some sites do not support the HTTP/1.1 range header and just serve the whole file, which takes it's time and may result in a timeout. Fixes #2819 --- tool/ports/mk/check.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/ports/mk/check.mk b/tool/ports/mk/check.mk index 691c8f3b51..38c7b7f070 100644 --- a/tool/ports/mk/check.mk +++ b/tool/ports/mk/check.mk @@ -54,11 +54,14 @@ check: $(DOWNLOADS) # # Check plain remote file # +# Try to download first kilobytes at maximum, which succeeds with return code 0 +# on small files or "(63) Maximum file size exceeded" if the file is larger. # We call curl a second time if the first check fails. This gives download # sites time to reconsider their response and helps, for example, to check the # qemu-usb port. # -CURL_CMD = curl -f -L -k -r -2 --max-time 15 --retry 2 $(URL($*)) > /dev/null 2>&1 +CURL_CMD = curl -s -f -L -k --max-filesize 200000 \ + --max-time 15 --retry 1 $(URL($*)) > /dev/null || [ $$? -eq 63 ] %.file: $(VERBOSE)$(CURL_CMD) || (sleep 1; $(CURL_CMD))