cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl's behaviour when CURLOPT_MAX_RECV_SPEED_LARGE is used

From: Mohammad_AlSaleh <ce.mohammad.alsaleh_at_gmail.com>
Date: Tue, 10 Dec 2013 21:27:24 +0300

Hello.

I'm sharing this just in case there is interest. The real bug in my code
was unrelated to this.

A small test case is attached to help me explain. It's not a real-world
use case.

The 2m file is created with dd:
 dd if=/dev/urandom of=/tmp/2m bs=2M count=1

When running the test case on my laptop, I noticed the following:

 1- All required data is read fast.

 2- dlnow will report a completed transfer early on.
    (It only represents the size of data received/read).

 3- Not all data is flushed after writes
    (unless you uncomment the fflush line).

 4- libcurl will keep waiting until the speed limit is met on a now
    long interval.

 5- Finally, the remaining (unflushed) data is written.

I would have expected libcurl to:

 1- not wait needlessly when there is no more data to receive/read.

 2- not allow the size of data read, and the size written to be out of
    sync for that long. Maybe flushing should be used after writes!

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2013-12-10