cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURLOPT_URL returning FALSE

From: <nitin.mittal_at_rsa.com>
Date: Wed, 16 Dec 2009 01:14:41 -0500

 

>Where is the curl header append function for your code???
I think its safe and less error prone if you follow the standard.
Do this:

struct curl_slist *content_type=NULL; //note the pointer here
headers = curl_slist_append(content_type, "Content-Type: text/xml");
curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, content_type);

SOAP is just xml over http so its crucial that if you will use libcurl
you use the standard of using the pointer to curl_slist layout above so
you can pass the right headers with post.

1)Create a header pointer and append the header type.
2)set the header to your handle
3)call perform();

>Hi Isaac,

As you suggested, I wrote these lines in my code:

                struct curl_slist *headers = NULL; //note the pointer
here
                headers = curl_slist_append(headers, "Content-Type:
Multipart/Related");
                headers = curl_slist_append(headers, "type: text/xml");
                curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, headers);

But it crashes at line #4, curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER,
headers);

Please let me know if I am doing something wrong.

I have digged through various links on internet & sample programs on
libcurl but I found it the most appropriate way to set my headers. But,
I am getting a crash in line #4.

Thanks & Regards,
Nitin

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-16