Re: XHTML 1.0 Content-Negotiation

On Sat, Aug 06, 2005 at 01:26:45PM -0700, James Pickering wrote:

>    if ( isset($_SERVER["HTTP_ACCEPT"]) and
>    stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {My
>    header("Content-type: application/xhtml+xml");

This is harmful, it just looks for the string "application/xhtml+xml",
so it would serve that content type to a browser with:

  Accept: text/html, application/xhtml+xml-1

Which is a somewhat nonsensical and theoretical content type (which is
not application/xhtml+xml). Of more practical and immediate
consequence is that it pays no attention to quality values:

  Accept: text/html, application/xhtml+xml;q=0

Would get served application/xhtml+xml despite explicitly stating that
XHTML is not accepted.



-- 
David Dorward                                      http://dorward.me.uk

Received on Saturday, 6 August 2005 20:39:22 UTC