Subject: Content Auto-negotiation

From: William Waites <[email-masked]>
Date: Tue, 19 Oct 2010 21:26:56 +0200

This topic came up in IRC after I was looking at making a small
CGI script to do autonegotiation and I noticed the Accept header
send by Google Chrome:

	application/xml,application/xhtml+xml,text/html;q=0.9,
        text/plain;q=0.8,image/png,*/*;q=0.5

My reading of the RFC (and the new draft) suggests that this 
would result in image/png being preferred over text/html. 
Someone else believed that the q=0.5 at the end applies to
both image/png and */* though both the pseudo-BNF grammar
and one of the examples would appear to contradict this.

Would appreciate some clarification. Does Chrome really 
prefer pictures of web pages?

Perhaps the new draft would benefit from some more explicit
treatment of this case to avoid confusion.

Cheers,
-w

---

From: "Roy T. Fielding" <[email-masked]>
Date: Tue, 19 Oct 2010 12:48:40 -0700

> would result in image/png being preferred over text/html. 

Yes.

> and one of the examples would appear to contradict this.

They do contradict it.  Accept is an unordered list, which is
why the q values are needed.

> prefer pictures of web pages?

It is just a bug in Chrome.

> treatment of this case to avoid confusion.

No.  I don't think anyone who reads the spec can conclude anything
other than what you did.  People who don't read specs will not be
helped by more words in the spec.

....Roy

---

From: Julian Reschke <[email-masked]>
Date: Tue, 19 Oct 2010 21:57:53 +0200

On 19.10.2010 21:48, Roy T. Fielding wrote:
> ...
> ...

+1

I was looking at this as well just a few minutes ago, and it already says:

"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 (Section 6.4 of 
[Part1]). The default value is q=1." -- 
<http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p3-payload-11.html#header.accept>

Best regards, Julian