cURL / Mailing Lists / curl-library / Single Mail

curl-library

Order of appearance of header settings

From: Roberto Nibali <ratz_at_drugphish.ch>
Date: Tue, 11 Oct 2005 10:22:19 +0200

Hello,

I set the following headers in the following order in my programme (it's
scattered all over the code, so I only extract the calls in order):

1. curl_easy_setopt(curl, CURLOPT_ENCODING, "gzip,deflate");

char *std_headers[] = {
        "Accept-Language: en-us,en;q=0.5",
        "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
        "Keep-Alive: 300",
        NULL
};
for (i = 0; std_headers[i] != NULL; i++) {
  headers = curl_slist_append(headers, std_headers[i]);
}
2. curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

3. curl_easy_setopt(curl, CURLOPT_REFERER, "http://www.foobar.com/");

4. curl_easy_setopt(curl, CURLOPT_USERAGENT, "some_stats_stuff");

One would assume following order of appearance from the libcurl engine:

Accept-Encoding: ...
Accept-Language: ...
Accept-Charset: ...
Keep-Alive: ...
Referer: ...
User-Agent: ...

However, additionally to the fields libcurl has to set for HTTP/1.1
connections, the order I see when I enable the debug mode is the following:

User-Agent: ...
Host: ... (libcurl internal)
Pragma: ... (libcurl internal)
Accept: ... (libcurl internal)
Accept-Encoding: ...
Referer: ...
Proxy-Connection: ... (libcurl internal)
Accept-Language: ...
Accept-Charset: ...
Keep-Alive: ...

Which is not at all the order I submitted my headers. What's the reason
for this behaviour? What am I doing wrong or what did I forget to read?

Thanks for your help,
Roberto Nibali, ratz

-- 
-------------------------------------------------------------
addr://Kasinostrasse 30, CH-5001 Aarau tel://++41 62 823 9355
http://www.terreactive.com             fax://++41 62 823 9356
-------------------------------------------------------------
terreActive AG                       Wir sichern Ihren Erfolg
-------------------------------------------------------------
Received on 2005-10-11