6.5. Browsers and HTTP/1.1
Like any other human creation, the Web
fills up with rubbish. The webmaster cannot assume that all clients
will be using up-to-the-minute browsers -- all the old, useless
versions are out there waiting to make a mess of your best-laid
In 1996, the weekly Internet magazine devoted to Apache affairs,
Apache Week (Issue 25), had this to say about
the impact of the then-upcoming HTTP/1.1:
For negotiation to work, browsers must send the correct request information. For human languages, browsers should let the user pick what language or languages they are interested in. Recent beta versions of Netscape let the user select one or more languages (see the Netscape Options, General Preferences, Languages section).
For content-types, the browser should send a list of types it can accept. For example, "text/html, text/plain, image/jpeg, image/gif.". Most browsers also add the catch-all type of "*/*" to indicate that they can accept any content type. The server treats this entry with lower priority than a direct match.
Unfortunately, the "*/*" type is sometimes used instead of listing explicitly acceptable types. For example, if the Adobe Acrobat Reader plug-in is installed into Netscape, Netscape should add application/pdf to its acceptable content types. This would let the server transparently send the most appropriate content type (PDF files to suitable browsers, else HTML). Netscape does not send the content types it can accept, instead relying on the */* catch-all. This makes the transparent content-negotiation impossible.
Although time has passed, the situation has probably not changed very
much. In addition, most browsers do not indicate a preference for
particular types. This should be done by adding a preference factor
(q) to the content type. For
example, a browser that accepts Acrobat files might prefer them to
HTML, so it could send an accept-type list that includes:
text/html: q=0.7, application/pdf: q=0.8
When the server handles the request, it combines this information
with its source quality information (if any) to pick the
"best" content type to return.
For another method of handling MIME types, see Section 12.11, "MIME Magic" in Chapter 12, "Extra Modules".
Copyright © 2001 O'Reilly & Associates. All rights reserved.