From f526268e2b78330dfe6b63eb5f6ece7417f4c06e Mon Sep 17 00:00:00 2001 From: jikai Date: Sat, 27 Apr 2024 14:38:58 +0800 Subject: [PATCH 144/149] followlocation only not with head Signed-off-by: jikai --- src/utils/http/http.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/http/http.c b/src/utils/http/http.c index 8b74f773..c9bb5959 100644 --- a/src/utils/http/http.c +++ b/src/utils/http/http.c @@ -495,7 +495,9 @@ int http_request(const char *url, struct http_get_options *options, long *respon if (options->resume) { curl_easy_setopt(curl_handle, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)fsize); } - curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + if (options->with_head == 0) { + curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); + } curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, pagefile); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, fwrite_file); } else { -- 2.25.1