cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Help! about LIBCURL ,I've got trouble in download rate setting

From: Frank Mcgeough <fmcgeough_at_mac.com>
Date: Wed, 11 Aug 2010 08:47:54 -0400

On Aug 11, 2010, at 3:06 AM, Dan Fandrich wrote:

> On Wed, Aug 11, 2010 at 11:02:20AM +0800, frank chan wrote:
>> Please help me !
>> I've set all the params of easy curl downloading, such as speed
>> limit , url ,
>> and it seems all right . It is all ok to set speed limit at the
>> begining before
>> curl_easy_perform . But I need to change the speed limit during the
>> download
>> process , so I use
>> curl_easy_setopt(handle,CURLOPT_MAX_SEND_SPEED_LARGE,speed)
>> to set speed (from 100k to about 30k) , then the speed decrease to
>> 0k for some
>> seconds and the connection breaks down . The problem will not
>> appear when I set
>> speed limit to a bigger one , like from 50k to 100k .
>> I want to know if it is sort of a bug of libcurl , please help me !
>
> Options are generally not allowed to be set after a transfer begins.
> That makes sense for most options (after all, what is libcurl
> supposed to do
> if a GET is converted to a POST in mid-transfer), but I can see how
> it would
> be handy to be able to change one like this.
>
>>>> Dan

I've had similar needs. I just ignored the libcurl provided facilities
and implemented a progress callback which would abort the operation if
my condition wasn't met. This is a bit of a pain since it seems like
it should work in your case but there is a way to get the job done
when your needs are dynamic like this. See CURLOPT_PROGRESSFUNCTION.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-11