Chapter 2. The site’s design
Host: noether.csi.cam.ac.uk
The second line indicates which server the query was addressed to. It is this
element of the query that allows a web server to distinguish between web sites
based purely on their names, regardless of the port number(s) or IP address(es)
used.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003
This optional line identifies the browser. Some servers, designed by stupid peo-
ple, vary the output according to this header. It is a hint and can be trivially
changed on many browsers.
In this case Mozilla identifies the browser as one of the Netscape/Mozilla fam-
ily and 5.0 ties it down to a version of Mozilla. X11 indicates that it is a browser
with access to an X windowing system, U identifies it as a Unix and Linux i686
specifies what sort of Unix. en-US specifies the locale the browser is working in.
rc:1.0.1 specifies the version of the browser. Gecko specifies the rendering en-
gine the browser uses and 20021003 is the release date (as version number) of
the version.
Accept: text/html,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
This specifies the formats the browser can accept and how keen it is on them.
Servers can be configured to negotiate various different formats of response de-
pending on these parameters.
text/html means that the browser is happy to accept MIME content type
text/html and text/plain means that it can accept plain text too. The qualifier
q=0.8 means that, given a choice, the browser would prefer to receive text/html
(default q=1.0) than text/plain (q=0.8). Similarly for images, the browser would
prefer image/png or image/jpeg to the image/gif format. Finally it will accept
any format (*/*) but is not keen on them (q=0.1).
We will meet MIME content types again in Chapter 4.
Accept-Language: en, es;q=0.50
Just as it is possible to negotiate formats it is possible to negotiate languages. A
page might appear in more than one language and the browser specifies what
languages it can cope with and how desirable they are. The author is learning
Spanish and has Spanish as a second choice in the language selections.
Accept-Encoding: gzip, deflate, compress;q=0.9
Just as there was negotiation over MIME content type there can also be nego-
tation over MIME transfer encoding. This is a mechanism for the server and
browser to agree on a way to (typically) compress the data stream prior to trans-
fer.
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.33
The final topic for negotiation is the character set of any text that will be sent. In
this case, ISO Latin 1 is preferred, with UTF-8 a second choice and everything
else coming third.
Connection: keep-alive
This tells the server that it need not close the network connection after sending
back the response to the query as other requests may be sent down the same con-
nection. As setting up and tearing down connections are expensive operations
this is a major fficiency boost.
13
Comentarios a estos manuales