cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: when POSTing data, when does curl add the x-www-form header?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 29 May 2012 21:28:57 +0200

On Tue, May 29, 2012 at 01:28:18PM -0400, Carmody, Steven wrote:
> Thanks for the advice. I upgraded to the recently released 7..26.0. BUt, I'm
> getting the same result
>
> curl_command = curl --verbose --insecure -o /tmp/tmp.PPKOU32382 -c /tmp/
> tmp.RvrTn32380 -b /tmp/tmp.RvrTn32380 -X POST -d @/tmp/tmp.eZjTn32398 -H
> "Content−Type: application/vnd.paos+xml" http://stc-test3.cis.brown.edu/
> Shibboleth.sso/SAML2/ECP

Note that when you use the -d option, curl automatically does a POST so
there's no need for the -X option. Note also the what the documentation
says about the -d option:

    This will cause curl to pass the data to the server using the
    content-type application/x-www-form-urlencoded.

Admittedly, using -H in this case to change the Content-Type would be a
reasonable thing to expect to happen, but it sounds like it isn't
currently. What you could try is using -T option to send the data, then
-X POST to change the PUT that would normally be done for this option to
a POST.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-29