From 8807cac100acb2d368232833b2478e96a1806fa9 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 26 May 2011 19:32:45 -0400 Subject: [PATCH] dload: abort transfer on CURLOPT_LOW_SPEED_LIMIT If a connection drops below 1kb/s for 10s, curl will kill the transfer and we'll report failure. This is the average transfer speed over the delta defined by CURLOPT_LOW_SPEED_TIME, so setting a low value here shouldn't bother folks using 14.4k dial-up. Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index d024c736..e29929ef 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -194,6 +194,8 @@ static int curl_download_internal(const char *url, const char *localpath, curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress); curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile); + curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 1200L); + curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L); useragent = getenv("HTTP_USER_AGENT"); if(useragent != NULL) {