From 1c351d32ead2903d701d5d03c1fc494789c9f9da Mon Sep 17 00:00:00 2001 From: jikai Date: Sat, 27 Apr 2024 14:38:58 +0800 Subject: [PATCH] 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 52b05fa36..976ef041c 100644 --- a/src/utils/http/http.c +++ b/src/utils/http/http.c @@ -478,7 +478,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) { + 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 { -- Gitee