Please Whitelist This Site?

I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)

If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.

If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.

Thanks for your understanding!

Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide


NOTE: Using software to mass-download the site degrades the server and is prohibited.
If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.

The Book is Here... and Now On Sale!

Enjoy The TCP/IP Guide? Get the complete PDF!
The TCP/IP Guide

Custom Search







Table Of Contents  The TCP/IP Guide
 9  TCP/IP Application Layer Protocols, Services and Applications (OSI Layers 5, 6 and 7)
      9  TCP/IP Key Applications and Application Protocols
           9  TCP/IP File and Message Transfer Applications and Protocols (FTP, TFTP, Electronic Mail, USENET, HTTP/WWW, Gopher)
                9  TCP/IP World Wide Web (WWW, "The Web") and the Hypertext Transfer Protocol (HTTP)
                     9  TCP/IP Hypertext Transfer Protocol (HTTP)
                          9  HTTP Entities, Transfers, Coding Methods and Content Management

Previous Topic/Section
HTTP Data Length Issues, "Chunked" Transfers and Message Trailers
Previous Page
Pages in Current Topic/Section
12
3
Next Page
HTTP Features, Capabilities and Issues
Next Topic/Section

HTTP Content Negotiation and "Quality Values"
(Page 3 of 3)

Weighting Preferences with "Quality Values"

Even better than simple acceptance lists, HTTP allows the client to weight each of the items in such a list, to indicate which is preferred of the alternatives. This is done by adding a decimal quality value after each parameter using the syntax “q=<value>”, which represents the relative priority of that parameter relative to others. The highest priority is 1 and the lowest is 0; the default if no value is indicated is 1, while a value of 0 means the client is specifically saying it is not willing to accept documents with that characteristic.

This is best illustrated by an example, so let’s take our trilingual friend again. This time, let’s say she knows English, French and Spanish, but her French is a bit rusty (she hasn’t used it in a while). Furthermore, she may need to share this document with a friend of hers who only knows a little Spanish, so it would be best if she got the document in English. Finally, she knows there is a German version of the resource that she definitely does not want. This could be represented as follows:

Accept-Language: en, fr;q=0.3, sp;q=0.7, de;q=0

Translated to English, this means “I prefer if you sent me the document in English. If not, Spanish is okay, or French if that is all you have, but definitely don’t send it in German”.

Incidentally, the name “quality value” is the one used in the HTTP standard, but is really a poor choice of terminology (which, to be fair, is also mentioned in the standard!) These values do not really have anything to do with quality; for all we know, the German version of this document may be the original and the others could be lousy translations. The “q” values only specify the relative preference of the client making the request.

Finally, the “*” wildcard can be used in the Accept family of headers to represent “any value”, or “everything else”. This is often used to tell the server “if you can’t find what I specifically asked for, then here’s my preference level on the alternatives”. Let’s take an example using the Accept header:

Accept: text/html, text/*;q=0.6, */*;q=0.1

This header represents the client saying “My preference (q=1) is an HTML text document. If not available, I would prefer some other type of text document. Failing that, you may send me any other type of document relevant to the requested resource.”

Key Concept: Server-driven content negotiation is the type most often used in HTTP. A client sending a request can include up to four different headers that provide information about how the server should fill its request. These may include optional quality values that specify the client’s relative preference amongst a set of alternative resource characteristics such as media type, language, character set or encoding.


 


Previous Topic/Section
HTTP Data Length Issues, "Chunked" Transfers and Message Trailers
Previous Page
Pages in Current Topic/Section
12
3
Next Page
HTTP Features, Capabilities and Issues
Next Topic/Section

If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $



Home - Table Of Contents - Contact Us

The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005

© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.