cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURLOPT_WRITEFUNCTION - cannot make it working...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 8 Jun 2011 00:24:19 +0200 (CEST)

On Tue, 7 Jun 2011, Paolo Piacentini wrote:

> curl_easy_setopt(sessionA, CURLOPT_WRITEHEADER, HeaderFile);
>
> If I run it without that incriminated line, it works fine. If I add that
> line, it goes in segmentation fault.
>
> Is there a specific reason for this behavior? How can I have the header
> saved on file?

Allow me to quote a little piece of the manual from

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHEADERFUNCTION

   If this option is not set, or if it is set to NULL, but CURLOPT_HEADERDATA
   (CURLOPT_WRITEHEADER) is set to anything but NULL, the function used to
   accept response data will be used instead. That is, it will be the function
   specified with CURLOPT_WRITEFUNCTION

I would agree that it is a bit unusual and unexpected (and that is due to
historical reasons and nothing else), but it is documented!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-08