cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Setting content type use curel_eay C API's

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 21 Oct 2003 14:25:44 +0200 (CEST)

On Mon, 20 Oct 2003, Joe Ceklosky wrote:

(consider using the curl-library list for libcurl questions.)

> Using the curl_easy C API's how do I set the Context type on a post request?
>
> I need to set the Content type to "text/xml"

Allow me to quote from the curl_easy_setopt docs:

    CURLOPT_HTTPHEADER
         Pass a pointer to a linked list of HTTP headers to pass
         to the server in your HTTP request. The linked list
         should be a fully valid list of struct curl_slist
         structs properly filled in. Use curl_slist_append(3) to
         create the list and curl_slist_free_all(3) to clean up
         an entire list. If you add a header that is otherwise
         generated and used by libcurl internally, your added one
         will be used instead. If you add a header with no con-
         tents as in 'Accept:' (no data on the right side of the
         colon), the internally used header will get disabled.
         Thus, using this option you can add new headers, replace
         internal headers and remove internal headers. The head-
         ers included in the linked list must not be CRLF-termi-
         nated, because curl adds CRLF after each header item.
         Failure to comply with this will result in strange bugs
         because the server will most likely ignore part of the
         headers you specified.

         The first line in a request (usually containing a GET or
         POST) is not a header and cannot be replaced using this
         option. Only the lines following the request-line are
         headers.

         NOTE:The most commonly replaced headers have "shortcuts"
         in the options CURLOPT_COOKIE, CURLOPT_USERAGENT and
         CURLOPT_REFERER.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
Received on 2003-10-21