summaryrefslogtreecommitdiff
path: root/0135-followlocation-only-not-with-head.patch
blob: 2fd2bb0e08acb247a0d7a4944ab114df56bef617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From f526268e2b78330dfe6b63eb5f6ece7417f4c06e Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com>
Date: Sat, 27 Apr 2024 14:38:58 +0800
Subject: [PATCH 144/149] followlocation only not with head

Signed-off-by: jikai <jikai11@huawei.com>
---
 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