Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does relative quality factor mean in HTTP?

Hi all I've been examining Chrome's request headers whenever we type a URL into the address bar and I was wondering what exactly does it mean by these headers:

Accept: application/xml;q=0.9
Accept-Charset: utf-8;q=0.7
Accept-Language: en;q=0.8

This thread says it's the quality factor, so Chrome is saying it is accepting >=90% quality application/xml, >=70% quality UTF-8, and >=80% english language.

What exactly does 90% quality application/xml, 70% quality UTF-8, and 80% english language mean here?

like image 877
Pacerier Avatar asked Jan 18 '12 07:01

Pacerier


2 Answers

These headers are explained in RFC 2616.

Accept-Charset: utf-8;q=0.7

The key to understanding this line is that ISO-8859-1 is accepted by default even if it isn't mentioned. The header says "I want ISO-8859-1, but I'll accept UTF-8 if using ISO-8859-1 would degrade the quality of the object being sent by more than 30%." I'd take this to mean that if 30% of the characters won't fit into ISO-8859-1, then use UTF-8, but the standard doesn't seem to require this interpretation.

For the other examples you gave the quality factors are no-ops because there are no alternatives or defaults to preempt the definition of what's accepted.

like image 65
Kyle Jones Avatar answered Nov 07 '22 09:11

Kyle Jones


The name relative quality factor is a little bit misleading.
I think it's being used to order the preference of the values for the header just like the docs say:

A more elaborate example is

   Accept: text/plain; q=0.5, text/html,
           text/x-dvi; q=0.8, text/x-c   

Verbally, this would be interpreted as "text/html and text/x-c are the preferred media types, but if they do not exist, then send the text/x-dvi entity, and if that does not exist, send the text/plain entity."

In your example it's easy to decide, because each header has only one value.

like image 22
matino Avatar answered Nov 07 '22 08:11

matino