[pacman-dev] [PATCH 1/2] dload: abort transfer on CURLOPT_LOW_SPEED_LIMIT

Dave Reisner d at falconindy.com
Wed Jun 1 15:24:06 EDT 2011


If a connection drops below 10kb/s for 10s, curl will kill the transfer
and we'll report failure.

Signed-off-by: Dave Reisner <d at falconindy.com>
---
 lib/libalpm/dload.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index d024c73..3d90130 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, 10240L);
+	curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);
 
 	useragent = getenv("HTTP_USER_AGENT");
 	if(useragent != NULL) {
-- 
1.7.5.2



More information about the pacman-dev mailing list