From d076f9fd56c9791457c2a2ea6603c1fe94966593 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 20 Jan 2020 22:02:14 +0100 Subject: [PATCH] import: put a time-out on downloads Let's abort downloads when they are stuck by setting a download speed threshold (as suggested in the CURL docs) Fixes: #14215 --- src/import/curl-util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/import/curl-util.c b/src/import/curl-util.c index 96cf696652f..eea5ca395f8 100644 --- a/src/import/curl-util.c +++ b/src/import/curl-util.c @@ -247,6 +247,12 @@ int curl_glue_make(CURL **ret, const char *url, void *userdata) { if (curl_easy_setopt(c, CURLOPT_FOLLOWLOCATION, 1L) != CURLE_OK) return -EIO; + if (curl_easy_setopt(c, CURLOPT_LOW_SPEED_TIME, 60L) != CURLE_OK) + return -EIO; + + if (curl_easy_setopt(c, CURLOPT_LOW_SPEED_LIMIT, 30L) != CURLE_OK) + return -EIO; + *ret = TAKE_PTR(c); return 0; } -- 2.47.3