cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Help me

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 26 Mar 2001 18:48:20 +0200 (MET DST)

On Mon, 26 Mar 2001, Mohammed Yousef wrote:

> Is it possible to change one or more of the existing header fields with
> an external header? If so, please explain how.

Welll, you can replace headers in the *request* curl sends. By using -H you
replace internal headers if you set a header that is otherwise generated
internally (like Host:) or you add a header if it isn't otherwise internally
generated.

Since you're mailing this to the libcurl list, I would suspect that would
want to do this with a libcurl interface call. Your friend is then named
CURLOPT_HTTPHEADER and you should create a list of headers with
curl_slist_append() and pass that list in the curl_easy_setopt() call.

> For example, can I exchange the "Content-Type" field in the header below
> for an external field such as "application/html-form-urlencoded"?
>
> HTTP/1.0 200 OK
> Server: Netscape-Enterprise/2.01
> Date: Mon, 26 Mar 2001 15:08:33 GMT
> Accept-ranges: bytes
> Last-modified: Mon, 18 Oct 1999 15:25:20 GMT
> Content-length: 539
> Content-type: text/html

This is a sequence of headers in a server *response*. Curl didn't send these
headers, it just read them. Curl doesn't replace headers in the download
stream. There's no point in doing that. If this is what you want, use 'sed'
or a similar tool.

Are you sure you're not looking for the 'application/x-www-form-urlencoded'
Content-Type? Curl uses that when doing simple http form posts.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-03-26