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

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

From: Gez Lemon <gez@juicystudio.com>
Date: Tue, 31 Jul 2007 14:24:21 +0100
Message-ID: <e2a28a920707310624l5450ed9fgac202e5d85c8cb22@mail.gmail.com>
To: "Sierk Bornemann" <sierkb@gmx.de>
Cc: "olivier Thereaux" <ot@w3.org>, "Andries Louw Wolthuizen" <info@andrieslouw.nl>, "www-validator Community" <www-validator@w3.org>

On 31/07/07, Sierk Bornemann <sierkb@gmx.de> wrote:
> Am 31.07.2007 um 10:23 schrieb Gez Lemon:
> > On 31/07/07, olivier Thereaux <ot@w3.org> wrote:
> >>
> >> Trying to work around browser bugs is very understandable, but an
> >> improvement to this technique would be to use application/xhtml+xml
> >> as the *default*, as it should be for XHTML 1.1. Not the other way
> >> around. Hence:
> >>
> >> * if accept headers present, and application/xhtml+xml not accepted,
> >> send text/html
> >> * else, send application/xhtml+xml
> >>
> >> I think this would be a much more sane behavior. Gez? What do you
> >> think?
> >
> > Yes - as XHTML 1.1 should not be delivered with a MIME type of
> > text/html, the approach outlined here is far more sensible.
> In theorie -- yes. Please provide an example, how you can *reliable*
> distinguish, if a browser does *not* accept "application/xhtml+xml"
> to serve him "text/html" instead?
> Maybe I missed something, but I only know of reliable mechanisms to
> check, if a browser *does* accept "application/xhtml+xml". How do you
> check this and, much more important, if it *doesn't* support that
> Mimetype, *without* relying on the client's Accept header?
> Providing a solution would be very helpful, and I would be *very*
> lucky...

By checking if the string is found in the HTTP accept headers. As PHP
was mentioned in the first email I saw on this subject, it can be done
as follows in PHP:

header("Vary: Accept");
if (stristr($_SERVER[HTTP_ACCEPT], "application/xhtml+xml") === FALSE)
    header("Content-Type: text/html; charset=utf-8");
    header("Content-Type: application/xhtml+xml; charset=utf-8");

I only ever use XHTML 1.1 if I need the modular support of XHMTL (for
example with WAI-ARIA), so typically do it the other way around, but I
agree with Olivier that it is more sane to make the desired MIME type
the default MIME type.



Supplement your vitamins
Received on Tuesday, 31 July 2007 13:24:25 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:52 UTC