Do you use HTML for mail? If so please switch to text. I actually asked for
a compilable whole program not a snippet. Comments inside.

First, what is this code inside? A main function or a while body? Please
show us the code as a whole.

my code snippet is as follows please try to find if anyone knows better.
>
>          curl_global_init(CURL_GLOBAL_ALL);
>          curl = curl_easy_init();
>
>         struct data config;
>       config.trace_ascii = 1; /* enable ascii tracing */
>     struct curl_slist *chunk = NULL;
>         curl_slist_append( chunk, "Content-Type: application/json");
>
>  curl = curl_easy_init();
>

Any reason to initialize easy handle second time here? It should not affect
anything but just wondered.


> struct AppMemoryStruct chunk1;
>         chunk1.memory = (char *)malloc(1); /* will be grown as needed by
> the realloc above */
>         chunk1.size = 0; /* no data at this point */
>
>

Realloc above is -- I guess in the write callback -- suspicious. Again I
would like to see the whole code :-)


>         if(curl) {
>
>                   curl_easy_setopt(curl, CURLOPT_URL,
> url.GetPlatformString().c_str());
>                   curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
>                   curl_easy_setopt(curl, CURLOPT_SSLCERT,
> "C:\\test\\omg.aps.net.pem");
>
>                   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
>                   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
>                   curl_easy_setopt(curl,CURLOPT_KEYPASSWD,"");
>
>                   char error[1024];
>                   curl_easy_setopt ( curl, CURLOPT_ERRORBUFFER, error );
>
>

the error buffer should be off size CURL_ERROR_SIZE. I suggest you define
it in outer blocks to avoid possible stack corruption.


>                   /* send all data to this function */
>                   curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
> &AppWriteMemoryCallback);
>
>                   /* we pass our 'chunk' struct to the callback function
> */
>                   curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void
> *)&chunk1);
>
>

Again seeing the whole code and repeating problem, we will better help you
here.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to