cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

[cURLpp] Changing Content-type in HTTP POST

From: John Burnette <john.burnette_at_gmail.com>
Date: Wed, 29 Mar 2006 07:07:08 -0800

Hi all,

I tried sending this out a month or so ago but was never able to resolve the
issue so I'll try again. I am trying to set the "content-type" of the
header that I am POSTing. Seems like it should be straightforward.
Unfortunately, it's not working out. I set up my POST like this:

      // Setting the URL to retrive.
      m_HTTP_Handle.setOpt(new cURLpp::Options::Url(url));
      m_HTTP_Handle.setOpt(new cURLpp::Options::Verbose(true));

      std::list<std::string> HeaderData;
      HeaderData.push_back("Content-Type: application/octet-stream");

      m_HTTP_Handle.setOpt(new cURLpp::Options::HttpHeader(HeaderData));

      m_HTTP_Handle.setOpt( new cURLpp::Options::PostFields( pBinaryData )
);
      m_HTTP_Handle.setOpt( new cURLpp::Options::PostFieldSize( size ) );

      m_HTTP_Handle.perform();

When I send this I see the following in my terminal:

* About to connect() to 192.168.1.101 port 8080
* Trying 192.168.1.101... * connected
* Connected to 192.168.1.101 (192.168.1.101) port 8080
*> POST /cdn/simpleServlet HTTP/1.1 *
Host: 192.168.1.101:8080
Pragma: no-cache
Accept: */*
Content-Length: 72
Content-Type: application/x-www-form-urlencoded

Everything is perfect except that I my header is still set to the default:
"Content-Type: application/x-www-form-urlencoded" instead of what I want:
"Content-Type: application/octet-stream".

Can anyone see what I am doing wrong (or not doing)?

By the way, I have this working perfectly using the regular C-binding.
 Thanks for your help,

John

_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2006-03-29

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET