cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Can't set headers using CURLOPT_HTTPHEADER

From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Mon, 23 Jan 2012 18:21:36 +0100

 
Yanov, Andrey wrote:
> curl_slist *headers=NULL; // init to NULL is important
> curl_slist_append(headers, "Accept: text/xml");
> curl_slist_append(headers, "Content-Type: text/xml");
> //curl_slist_append(headers, "charsets: utf-8");
> res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

Use "headers = curl_slist_append(headers, ...);" for each
curl_slist_append() call: this function cannot change the 1st parameter
since it is passed by value. However the proper new list head is
returned by the function.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-23