Headers are not specific to browsers, it's a part of the HTTP protocol.
A request for a page (or any other resource like images) will cause the client (e.g. Internet browser) to send a request header. This could contain an header for language (Accept-Language) for example.
The first line of a HTTP request is in the format METHOD RESOURCE HTTP/VERSION
. Example: GET /resource HTTP/1.0
.
HTTP/1.1 requires the Host-header. An example HTTP/1.1 request:
GET / HTTP/1.1
Host: example.com
The server responds with at least a status code: HTTP/1.1 200 OK
Most servers will send additional headers. Common headers are: Content-Type
, Date
, Server
and Content-Length
.
This is an example request (raw data):
$ nc example.com 80
GET / HTTP/1.0
HTTP/1.1 200 OK
Date: Sat, 11 Sep 2010 19:12:13 GMT
Server: Apache
Last-Modified: Fri, 30 Jul 2010 15:30:18 GMT
ETag: "573c1-254-48c9c87349680"
Accept-Ranges: bytes
Content-Length: 596
Connection: close
Content-Type: text/html; charset=UTF-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>Example Web Page</TITLE>
</HEAD>
<body>
<p>You have reached this web page by typing "example.com",
"example.net","example.org"
or "example.edu" into your web browser.</p>
<p>These domain names are reserved for use in documentation and are not available
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
2606</a>, Section 3.</p>
</BODY>
</HTML>
It's up to the client (Internet browser) whether to parse a header or not. All modern Internet browsers parses the Content-Type
header, and use it to determine how to display a resource (is it a HTML page, an image, a text file or something else?). The Server
header is ignored by browsers, servers use it to identify themselves. But some crawler might use it for statistics.
A quote from the HTTP specification:
Multiple message-header fields with
the same field-name MAY be present in
a message if and only if the entire
field-value for that header field is
defined as a comma-separated list
[i.e., #(values)]. It MUST be possible
to combine the multiple header fields
into one "field-name: field-value"
pair, without changing the semantics
of the message, by appending each
subsequent field-value to the first,
each separated by a comma.
That means that multiple Content-Type
fields are not valid, and the behaviour is undefined (although it's common to use the last defined one).
This Wikipedia article contains a list of headers with a description.