cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Problem with CURLOPT_HEADERFUNCTION

From: Legoff Vincent <vincent.legoff_at_siemens.com>
Date: Tue, 17 Dec 2002 08:22:43 +0100

Thanks, it works now.

Vincent

-----Original Message-----
From: RBramante_at_on.com [mailto:RBramante_at_on.com]
Sent: Monday, December 16, 2002 5:42 PM
To: curl-library_at_lists.sourceforge.net
Subject: Re: Problem with CURLOPT_HEADERFUNCTION

Looks like you forgot curl_easy_setopt(httpHandle, CURLOPT_WRITEHEADER,
myObject)?

                                                                                                                                            
                      Legoff Vincent
                      <vincent.legoff_at_siemens.com> To: "'curl-library_at_lists.sourceforge.net'"
                      Sent by: <curl-library_at_lists.sourceforge.net>
                      curl-library-admin_at_lists.sour cc:
                      ceforge.net Subject: Problem with CURLOPT_HEADERFUNCTION
                                                                                                                                            
                                                                                                                                            
                      12/16/2002 11:21 AM
                      Please respond to
                      curl-library
                                                                                                                                            
                                                                                                                                            

Hello,

I have a problem with the callback set with CURLOPT_HEADERFUNCTION.
I use curl_multi and I want to get the headers and the body of each URL
with two callbacks,
so that I can store them in a object (myObject).

When a URL has to be downloaded I set the following parameters:
curl_easy_setopt(httpHandle, CURLOPT_URL, "http://myURL");
curl_easy_setopt(httpHandle, CURLOPT_WRITEFUNCTION, myCallback);
curl_easy_setopt(httpHandle, CURLOPT_HEADERFUNCTION, myHeaderCallback);
curl_easy_setopt(httpHandle, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(httpHandle, CURLOPT_FILE, myObject);

My callback for the headers is defined as follow:
size_t XXX::myHeaderCallback(void* buffer, size_t size, size_t nmemb, void*
userp)
{
 myObject* object = (myObject*) userp
 ...
}

The problem is that userp is always NULL, so I can not store the headers.
As I understood, myObject set as CURLOPT_FILE is not passed as argument
(userp) to myHeaderCallback().
Is there a way to pass myObject to myHeaderCallBack() ?

Thanks in advance

> Vincent Le Goff
>

-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
Received on 2002-12-17