On Tue, 10 Aug 2010, Matthew Hails wrote:

But calling:

  curl_easy_setopt(handle, CURLOPT_HTTPHEADER, "Some-Header:");

Suppresses the header.

Is there any way to accomplish this? I need to send the header as-is, i.e. no double quotes or any other characters.

This is really a rather silly API restrictions that exists due to my lack of imagination back in the day and we never introduced a way to work around this properly. I'll be interested in discussing ways to do this the proper way!

I think the ways people have done it in the past involves using quotes or adding other nonsensical data, and you can also trick libcurl (and the receiver) by doing:

  curl_easy_setopt(handle, CURLOPT_HTTPHEADER, "Weirdo:\r\nSome-Header:");

... which will trick libcurl to add this as it considers it a header with content, but in reality it will get sent as two headers where the second one has no content and the first one is uninteresting and only put there to fool libcurl.

--

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

Reply via email to