cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SSL with WriteMemoryCallback function to get the response

From: Lijo Antony <lta_at_one.com>
Date: Thu, 04 Apr 2013 09:28:43 +0400

On 04/04/2013 12:19 AM, Ajay Tanpure wrote:
> Hello I am developing an application over HTTPS.
> My first handshakes related to SSL/TLS takes successfully.
>
> But the problem is in the response, which i store using function as
>
> *curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);*
> * curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);*
> *
> *
> as given in http://curl.haxx.se/libcurl/c/getinmemory.html
>
> But i didn't get the actual data that my application need from chunk
> (writeMemorycallback) and my application terminates.
>

Since you set CURLOPT_WRITEFUNCTION as well, libcurl will not even touch
the pointer you set using CURLOPT_WRITEDATA, in your case &chunk. It
will be passed as the userdata param when libcurl invokes your
WriteMemoryCallback. Actual data buffer would be ptr param. Please check
the awesome libcurl documentation for details,

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

-lijo
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-04