cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi Error Code 23 (Failed writing body) corner case

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 3 Oct 2014 18:47:15 +0200

On Fri, Oct 03, 2014 at 05:27:42AM -0400, Dan Donahue wrote:
> As stated in my original mail, this issue first manifested using the
> default write callback in libcurl (I did not register one). During debug
> I did register a callback but the problem persisted.
>
> The set up of the file handle is in the code in my original mail. It is
> fopen'd using "w+b" prior to the start of the download easy session.
>
> I don't believe it is related to the file handle as the download
> progresses nicely until the second failed upload. I also don't believe
> it's associated with the write callback because the problem manifests in
> both the libcurl default as well as registered callbacks.

I'd be looking for some issue with how the handle is dealt with between
transfers, for example, like reusing the same handle on uploads without
rewinding it. It's hard to see the big picture when pieces of code like
that and like the curl_easy_setopt calls aren't available to see. I don't see
the code that associates the file handle with the easy handle using
CURLOPT_WRITEDATA.

> Here is the callback I registered during debug in case you are still
> interested in it:
>
> int curlWrite(void *buffer, size_t size, size_t nmemb, void *stream)
> {
> CurlClient *client = (CurlClient*)stream;
>
> if(client == NULL)
> return -1;
>
> /* open file for writing */
> if (client->fd == NULL)
> {
> client->fd = fopen(client->reqInfo.fileName, "w+b");
> if(client->fd == NULL)
> return -1;
> }
>
> return fwrite(buffer, size, nmemb, client->fd);
> }
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-03