cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fw: problem_in_header

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 2 Mar 2016 01:20:38 -0500

On 3/1/2016 1:42 PM, ravi kumar via curl-library wrote:
> I have xml file.I have to post the data of xml file.
> Now in our server, we have to send base64encode data in header.which
> i am trying by using CURLOPT_HEADERFUCNCTION and
> CURLOPT_HEADERDATA,which not able to pass in header.
> Means i have to pass data in header,you can see the attached image and
> program.
>

The header function is called for each received header and it has
nothing to do with headers to be sent. To send encoded data in a header
use CURLOPT_HTTPHEADER [1] not the header function. It is possible the
headers to be sent could go to a proxy as well on CONNECT by default
depending on how old your version of libcurl is. This may not be what
you intended if the data is secret. In that case use CURLOPT_HEADEROPT
[2] as well if necessary.

   struct curl_slist *header_list = NULL;
   header_list = curl_slist_append(header_list, your_header_here);
   header_list = curl_slist_append(header_list, your_next_header_here);
   curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);
   curl_easy_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);

after the transfer is finished call curl_slist_free_all(header_list);

I suggest you contact connect2 if their server still does not
acknowledge your request after sending the proper headers.

[1]: https://curl.haxx.se/libcurl/c/CURLOPT_HTTPHEADER.html
[2]: https://curl.haxx.se/libcurl/c/CURLOPT_HEADEROPT.html

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-02