Home >>HTTP Tutorial >HTTP Content Negotiation
Most of HTTP's responses involve an entity that contains the user-interpretation information. Of necessity, it is used to provide the user with the best entity available that corresponds to the request. Unfortunately, not all users have the same expectations for what is best for cache and server. Therefore HTTP has provisions for many "content negotiation" processes. The process of selecting the best representation for a given answer when there are multiple representations available.
Any response that includes an entity-body Can also be subject to negotiation, including responses to errors.
There are two kinds of content negotiation in HTTP, server-led negotiation, and agent-driven negotiation. Both the negotiations are orthogonal and can thus be used either in combination or individually.
One type of combination called transparent negotiation that occurs when the origin server provides the agent-driven negotiation information that the cache uses to provide server-driven negotiation for subsequent requests.
When a server-driven negotiation occurs, then an algorithm located at the server selects the best representation for an answer. The collection and the contents are based on the available representation of a resource. Selection is often based on the contents of relevant header fields in the request message or on other information pretending to be applicable.
Advantages
Disadvantages
When an agent-driven negotiation takes place, after receiving an initial response from the origin server, the user agent performs selection of the best representation for an answer. In agent-driven negotiation, the selection is based on a list of available response representations, which is included within the initial response header fields or entity-body, each representation being defined by its own URI. Selection from a list of representations can be done either manually or automatically by selecting the user from a created menu.
Advantages
Disadvantages
A negotiation led by an agent suffers when a second request is required to get the best alternative representation.
It is a mixture of server-led negotiation and agent-driven negotiation. If a cache is given in the form of a list of available response representations, and the cache fully understands the dimension of the variance, then the cache becomes capable of conducting server-driven negotiation on behalf of the origin server.