cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_DEBUGFUNCTION again

From: Michael Hecker <Hecker.Michael_at_gmx.de>
Date: Sat, 23 Feb 2008 17:58:52 +0100

Hello,
sorry, but I still have got some problems with CURLOPT_DEBUGFUNCTION or
rather with static functions in general.

I want to pass data from the debugfunction to the member-function of a
class, which is declared non-static.
Is that possible?

class Cmy_Communicator
{

public:
               Cmy_Communicator();
    virtual ~Cmy_Communicator();

    bool communicate3();

    CURL *curl_handle;

    CHeader request_header;
    CHeader response_header;
    CString mySTR;

    static int my_trace(CURL *handle, curl_infotype type, unsigned char
*data, size_t size, void *userp)
    {
        // Here I'm doing something with curl's debug data and now I
want to pass the data to my CHeader-Class, which is not possible the way
I'm trying to do it
        request_header.ADD_REQUEST_HEADER_DATA(mySTR);
}
}

bool Cmy_Communicator::communicate3()
{
    request_header.RESET_HEADER();
    response_header.RESET_HEADER();

    // Rahmeninformationen der Kommunikation
    curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1);
    curl_easy_setopt(curl_handle, CURLOPT_DEBUGFUNCTION,
Cmy_Communicator::my_trace);
    curl_easy_setopt(curl_handle, CURLOPT_DEBUGDATA, this);

[...]
}

Thank you,
Michael
Received on 2008-02-23