diff mbox series

[RFC,1/2] support/download: curl: add --location

Message ID 20250212222253.719983-1-romain.naour@smile.fr
State Handled Elsewhere
Headers show
Series [RFC,1/2] support/download: curl: add --location | expand

Commit Message

Romain Naour Feb. 12, 2025, 10:22 p.m. UTC
Without --location (-L), curl doesn't retry if the requested page has
moved to a different location:

  curl -q -v --retry 3 --connect-timeout 10 --output 'glibc-2.41-5-gcb7f20653724029be89224ed3a35d627cc5b4163.tar.gz' \
    'https://github.com/bminor/glibc/archive/2.41-5-gcb7f20653724029be89224ed3a35d627cc5b4163/glibc-2.41-5-gcb7f20653724029be89224ed3a35d627cc5b4163.tar.gz'

The generated archive doesn't match the expected hash since it was
not actually downloaded.

  curl -q -v --retry 3 --location --connect-timeout 10 --output 'glibc-2.41-5-gcb7f20653724029be89224ed3a35d627cc5b4163.tar.gz' \
    'https://github.com/bminor/glibc/archive/2.41-5-gcb7f20653724029be89224ed3a35d627cc5b4163/glibc-2.41-5-gcb7f20653724029be89224ed3a35d627cc5b4163.tar.gz'

With --location and -v, we can notice that curl actually uses another
url:

  * Issue another request to this URL: 'https://codeload.github.com/bminor/glibc/tar.gz/cb7f20653724029be89224ed3a35d627cc5b4163'

So the downloaded archive match the expected hash.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Config.in b/Config.in
index a543091d4f..1e8025bf83 100644
--- a/Config.in
+++ b/Config.in
@@ -114,7 +114,7 @@  menu "Commands"
 
 config BR2_CURL
 	string "Curl command"
-	default "curl -q --ftp-pasv --retry 3 --connect-timeout 10"
+	default "curl -q --ftp-pasv --location --retry 3 --connect-timeout 10"
 
 config BR2_WGET
 	string "Wget command"