cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEDATA not passed to CURLOPT_HEADERFUNCTION?

From: Dave Weis <djweis_at_sjdjweis.com>
Date: 16 Jan 2003 09:39:44 -0600

On Thu, 2003-01-16 at 09:26, Philippe Raoult wrote:
> On 16 Jan 2003 09:13:01 -0600
> Dave Weis <djweis_at_sjdjweis.com> wrote:
> > I'm writing a C program that uses libcurl 7.9.7 and it seems like data
> > that I set with CURLOPT_WRITEDATA isn't being passed to my header
> > function in the fourth argument, it's coming in as null. I haven't
> > checked in the body function because I need data from the headers before
> > I can parse the body.
>
> it's ok, set CURLOPT_WRITEDATA to pass data to the header callback.

This is what I'm doing but the parameter never makes it to the header
callback, it's null in the callback:

  config->curl = curl_easy_init();

  retcode = curl_easy_setopt(config->curl, CURLOPT_WRITEFUNCTION,
write_function);
  retcode = curl_easy_setopt(config->curl, CURLOPT_HEADERFUNCTION,
header_function);
  retcode = curl_easy_setopt(config->curl, CURLOPT_WRITEDATA, config);

  sprintf(url, "%s%s%s?feed=%s", FEED_SERVER, FEED_PREFIX,
FEED_REQUEST_POSITION, TEST_FEED_NAME);

  retcode = curl_easy_setopt(config->curl, CURLOPT_URL, strdup(url));

  retcode = curl_easy_perform(config->curl);

> > I had been using a global variable before but need to make my program
> > multithreaded.
>
> you could still use private thread data, but the solution mentionned
> above should be enough.

I'll probably do that if I can't get this working.

Thanks for the help!

dave

-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
Received on 2003-01-16