cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_HTTPHEADER ignored?

From: Chris Johnson <cxjohnson_at_gmail.com>
Date: Wed, 8 Oct 2014 10:17:44 -0500

libcurl 7.37.1 (FreeBSD 10 port)

I'm setting an explicit Content-Type header for my POST operation to a SOAP
service. The value I'm setting, via curl_easy_setopt(curl,
CURLOPT_HTTPHEADER, headers)
​,​
​ ​
is "application/soap+xml". However, when executed, libcurl is actually
sending "application/x-www-form-urlencoded".

Is there some condition under which this is
​e​
xpected behavior? It seems like it's just wrong.

Most of the relevant code looks like this:

struct curl_slist* headers;
headers = curl_slist_append(NULL, "Content-Type: application/soap+xml");

bool result =
  curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC) ||
  curl_easy_setopt(curl, CURLOPT_POST, 1) ||
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, 0) ||
  curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, len) ||
  curl_easy_setopt(curl, CURLOPT_READDATA, (void*)this) ||
  curl_easy_setopt(curl, CURLOPT_READFUNCTION, source) ||
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers) ||
  sendRequest();

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-08