cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: libcurl + https + multi = lost information

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Mar 2008 12:58:49 +0100 (CET)

On Tue, 25 Mar 2008, REISS Pierre wrote:

> So, in order to provide stability to my sample, even during long week ends
> and holidays, I replaced the read of 2 pages of data under "CAC 40" by the
> read of 2 header pages ("CAC 40" and "NASDAQ-100").

The example code is still very complicated and I can't even understand half of
all magic going on in there so it is hard to see if or why or when anything
goes wrong - and if libcurl really is to blame. I read the Readme's
explanation of where it would find problems, but my attempts didn't get
anything like that on the line numbers you mention in there.

> I am looking further on header data/not header data, on multithreaded
> Curl_read's, on SSL_read: bad or good trails, I don't know...

The multi interface is not multi-threaded so that's not a problem here.

> Let me know if you have any difficulty trying my sample.

Let me be specific about problems I have with it:

Here's your write callback:

size_t CallBaPR ( void *Ptr, size_t Size, size_t NMemb, void *Stream )
{
   int Idx;
   for ( Idx=1; Idx>=0; Idx-- )
     if ( Door[Idx] == (FILE*) Stream ) break;
   fwrite ( Ptr, Size, NMemb, (FILE*) Stream );
   return NMemb;
}

What is this for loop and if condition doing in there and why?

What is the Door[] array's purpose? It seems (ab)used in strange ways in the
app.

Another mistake in the code comes when a single handle's transfer is
completed:

     while ( Msg = curl_multi_info_read ( Multi, &Query ) ) {
       Fini = Msg->easy_handle;
       for ( Idx=1; Idx>=0; Idx-- )
         if ( TabCurl[Idx] == Fini ) break;

       Extrait ( Idx ); // extracts information

Now what is that if() expression for and what do you really expect the break
instruction will add to this?

As long as you keep sending us very complicated examples stuffed with
*application* errors I really can't see any libcurl errors.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-03-26