]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: put a time-out on downloads
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Jan 2020 21:02:14 +0000 (22:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Jan 2020 21:07:02 +0000 (22:07 +0100)
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

index 96cf696652f684ac866a06aed4c41046365f1062..eea5ca395f86e268bca18b4255699964af7fb3cd 100644 (file)
@@ -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;
 }