cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problem with CURLOPT_HEADERFUNCTION

From: Legoff Vincent <vincent.legoff_at_siemens.com>
Date: Mon, 16 Dec 2002 17:21:53 +0100

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/
Received on 2002-12-16