cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Pipelined download in my lib stopped working probably since libcurl 7.30

From: Xavi Artigas <xartigas_at_fluendo.com>
Date: Mon, 31 Mar 2014 14:20:11 +0200

> Why is that strange? We rewrite internals and (try to) maintain API and ABI. The promise to the world is in the backards compatible ABI and API, not that we don't rewrite code.

Sorry for not being clear, I meant that an API break was strange. We
all love code rewrites!

I hoped that maybe this was a known issue that could be quickly fixed.
If that is not the case, then yeah, I will try to prepare a simple
test case and post it here.
In the mean time, I can give some more details:

- The data being transferred is a series of mp4 files, therefore, the
nature of the corruption is not easily seen. At some point, one of the
files cannot be decoded, but I still do not know why.
- Multi handle setup (I have only one of these):
    context->handle = curl_multi_init ();
    curl_multi_setopt (context->handle, CURLMOPT_PIPELINING, 1);

- Simple handle setup (for each of the downloading tasks):
    task->handle = curl_easy_init ();
    curl_easy_setopt (task->handle, CURLOPT_WRITEFUNCTION,
        (curl_write_callback) _write_function);
    curl_easy_setopt (task->handle, CURLOPT_WRITEDATA, task);
    curl_easy_setopt (task->handle, CURLOPT_HEADERFUNCTION,
        (curl_write_callback) _header_function);
    curl_easy_setopt (task->handle, CURLOPT_HEADERDATA, task);
    curl_easy_setopt (task->handle, CURLOPT_PRIVATE, task);
    curl_easy_setopt (task->handle, CURLOPT_NOPROGRESS, 1L);
    /* We do not want signals, since we are multithreading */
    curl_easy_setopt (task->handle, CURLOPT_NOSIGNAL, 1L);
    /* Allow redirections */
    curl_easy_setopt (task->handle, CURLOPT_FOLLOWLOCATION, 1L);
    curl_easy_setopt (task->handle, CURLOPT_URL, url);
    curl_easy_setopt (task->handle, CURLOPT_RANGE, range);

- And then, every time the current transfer is detected to be above
75% completion (and it is the only task running), a new task is added
with:
    curl_multi_add_handle (context->handle, next_task->handle);

- Every time a task is completed (or cancelled):
    curl_multi_remove_handle (context->handle, task->handle);
    curl_easy_cleanup (task->handle);

I'll try to prepare a simple test.
Thanks!
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-31