cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_TIMEOUT and CURLOPT_LOW_SPEED_TIME question

From: Michal Marek <mmarek_at_suse.cz>
Date: Wed, 07 Nov 2007 17:28:24 +0100

Dragos MOINESCU wrote:
> When downloading files (small and large) I need libcurl to close connection
> and return some error code each time the transfer is stalled (no bytes
> coming from peer).
> The problem is that setting CURLOPT_LOW_SPEED_TIME means that I cannot allow
> extremely low downloaders to grab a file. I need to download even with 1
> byte / 29 seconds.
> I know this scenario is kind of weird, but I really have to do this.

If CURLOPT_LOW_SPEED_LIMIT & CURLOPT_LOW_SPEED_TIME is not enough for
you, then you can implement any kind of rule using a progress callback
(CURLOPT_PROGRESSFUNCTION). Eg. this is how we solved a similar problem
in the libzypp curl backend:
http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/media/MediaCurl.cc
(look for progressCallback).

hth,
Michal
Received on 2007-11-07