W3C home > Mailing lists > Public > www-validator@w3.org > August 2007

Re: Validator doesn't send HTTP_ACCEPT headers, "Conflict between Mime Type and Document Type" warning is incorrect.

From: olivier Thereaux <ot@w3.org>
Date: Wed, 1 Aug 2007 10:04:43 +0900
Message-Id: <C4EA3EEC-DCDF-4727-B5D9-F6580AD9BD39@w3.org>
Cc: www-validator Community <www-validator@w3.org>
To: Gez Lemon <gez@juicystudio.com>


On Aug 1, 2007, at 00:49 , Gez Lemon wrote:
> You could first check that there is an HTTP_ACCEPT header. If not,
> deliver application/xhtml+xml; otherwise, test if
> application/xhtml+xml is in the accept header. That caters for all the
> scenarios you mentioned. The following serves text/html to IE,
> application/xhtml+xml to Firefox (and other browsers that state they
> can handle it), and application/xhtml+xml to the validator (as it
> doesn't send the accept header):
>
> header("Vary: Accept");
> if ($_SERVER[HTTP_ACCEPT]) {
>     if (stristr($_SERVER[HTTP_ACCEPT], "application/xhtml+xml") ===  
> FALSE) {
>         header("Content-Type: text/html; charset=utf-8");
>     }
>     else {
>         header("Content-Type: application/xhtml+xml; charset=utf-8");
>     }
> }
> else {
>     header("Content-Type: application/xhtml+xml; charset=utf-8");
> }

Looks good, Gez, do you think you could update
http://juicystudio.com/article/content-negotiation.php#php
accordingly?

Thanks
-- 
olivier
Received on Wednesday, 1 August 2007 01:04:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:25 GMT