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

Send the HTTP request Accept header

From: misterhaan <misterhaan@track7.org>
Date: Fri, 01 Aug 2008 14:52:32 -0500
Message-ID: <48936980.2030208@track7.org>
To: www-validator@w3.org

i was getting a warning when trying to validate any page on my site that 
the mime type is text/html instead of application/xhtml+xml when the 
document type is xhtml 1.1.  at the time i was using code very similar 
to what was suggested under the “setting the mime type with php” heading 
of the document [1] the validator’s warning message linked to:

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

if you’re curious, i’m using stripos() !== false instead of stristr(), 
but other than that (and that i use single quotes and don’t put a space 
after if) i came up with identical code on my own.

the problem is that when the w3c html validator looked at my site, the 
Accept header was blank or missing, so my server sent text/html.  i’ve 
now updated my logic to say if accept contains application/xhtml+xml or 
doesn’t contain text/html, send application/xhtml+xml; otherwise fall 
back to text/html.

i think that since the validator can in fact accept 
application/xhtml+xml, it should say so in the Accept header.  i’d like 
to see application/xhtml+xml, text/html and all other mime types the 
validator is capable of validating sent in the Accept header when 
requesting a file to validate.


[1] http://juicystudio.com/article/content-negotiation.php
Received on Saturday, 2 August 2008 09:18:01 UTC

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