I have made a http request using Firefox.Now the request header shows the following:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
But curious to know what is q=0.9,*/*;q=0.8
It is called the relative quality factor in the specification: Each media-range MAY be followed by one or more accept-params, beginning with the "q" parameter for indicating a relative quality factor.
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand. The server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Type response header.
The Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as in the case of a request for an in-line image.
Accept header is used by HTTP clients to tell the server which type of content they expect/prefer as response. Content-type can be used both by clients and servers to identify the format of the data in their request (client) or response (server) and, therefore, help the other part interpret correctly the information.
Each media-range MAY be followed by one or more accept-params, beginning with the "q" parameter for indicating a relative quality factor. The first "q" parameter (if any) separates the media-range parameter(s) from the accept-params. Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1. The default value is q=1
The information is available here
A nice explanation can be found here as well.
The Accept
header list is first split at ,
then at ;
for additional parameters per entry. So, the list in your example splits down to text/html
, application/xhtml+xml
, application/xml;q=0.9
and */*;q=0.8
. The q=
parameter on each entry indicates to the server the degree of preference for that media-type. It defaults to its maximum value of 1
, if it is missing (like in the first 2 entries). The last entry of */*;q=0.8
indicates to the server, that eventually any content-type would be acceptable but would be less preferable than the others listed. Otherwise, the server might decide to send no content at all, because the client would not "accept" it anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With