summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorMark Ulrich <mark.ulrich.86@gmail.com>2019-02-06 15:36:51 +0100
committerAllan McRae <allan@archlinux.org>2019-02-07 00:51:01 +0100
commitdb102c67efe9cfd4367a9110c8f97ceff5afcbe3 (patch)
treef127c62f97f1f1e8fd3dcfda205007d2383ca6fc /lib/libalpm
parent714a1b4e4eaf7ffde5f30eccb476f59979fac44e (diff)
downloadpacman-db102c67efe9cfd4367a9110c8f97ceff5afcbe3.tar.gz
pacman-db102c67efe9cfd4367a9110c8f97ceff5afcbe3.tar.xz
libalpm: prevent 301 redirect loop from hanging the process
If a mirror responds with a 301 redirect to itself, it will create an infinite redirect loop. This will cause pacman to hang, unresponsive to even a SIGINT. The result is pacman being unable to sync or download any package from a particular repo if its current mirror is stuck in a redirect loop. Setting libcurl's MAXREDIRS option effectively prevents a redirect loop from hanging the process. Signed-off-by: Mark Ulrich <mark.ulrich.86@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/dload.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 36ae4ee1..7b114230 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -259,6 +259,7 @@ static void curl_set_handle_opts(struct dload_payload *payload,
curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
+ curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L);
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);