home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Practical mod_perlPractical mod_perlSearch this book

16.3. Content Negotiation

Content negotiation is a wonderful feature that was introduced with HTTP/1.1. Unfortunately it is not yet widely supported. Probably the most popular usage scenario for content negotiation is language negotiation for multilingual sites. Users specify in their browsers' preferences the languages they can read and order them according to their ability. When the browser sends a request to the server, among the headers it sends it also includes an Accept-Language header. The server uses the Accept-Language header to determine which of the available representations of the document best fits the user's preferences. But content negotiation is not limited to language. Quoting the specification:

HTTP/1.1 includes the following request-header fields for enabling server-driven 
negotiation through description of user agent capabilities and user preferences: 
Accept (section 14.1), Accept-Charset (section 14.2), Accept-Encoding (section 14.3), 
Accept-Language (section 14.4), and User-Agent (section 14.43). However, an origin 
server is not limited to these dimensions and MAY vary the response based on any 
aspect of the request, including information outside the request-header fields or 
within extension header fields not defined by this specification.


Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.