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

Re: please add Accept header to http request containing application/xhtml+xml

From: Noa Resare <noa@resare.com>
Date: Sun, 20 Apr 2008 22:57:12 +0200
Cc: www-validator@w3.org, David Dorward <david@dorward.me.uk>
Message-Id: <C7171995-754D-4839-ABD2-B6D7DF4FACC2@resare.com>
To: Etienne Miret <elimerl@gmail.com>

20 apr 2008 kl. 22.15 skrev Etienne Miret:

> On 18 Apr 2008, at 08:58, Noa Resare wrote:
>> In other words, adding "Accept: application/xhtml+xml, */*" to the  
>> requests of the validator would be a nice thing.
> This Accept header is redundant. "Accept: */*" means the user-agent  
> accepts anything, including XHTML, so adding "application/xhmtl+xml"  
> in the header is meaningless.

Yup, accept lines tend to be redundant. Just list everything that the  
validator accepts if you want to be formally correct as well as  
helping people who want to follow the recommendation and use XHTML 1.1  
with correct mime type and also be compatible by more than 25% of the  
browser market. Revised suggestion: send Accept: application/xhtml 
+xml, text/html

> David Dorward wrote :
>> If you are doing content negotiation and then sending exactly the  
>> same content, but with different Content-Types, then the validator  
>> is going to get the same data either way - so it makes no difference
> Actually it makes a difference. If the page is XHTML, the validator  
> will issue a warning when it is sent as text/html.

Which was the whole point of filing my request in the first place.

>>> My rewrite rules:
>>> RewriteEngine on
>>> RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml
>>> RewriteCond %{REQUEST_URI} \.xhtml$
>>> RewriteRule .* - [T=text/html]
>> This will serve up application/xhtml+xml if the browser sends  
>> Accept: application/xhtml+xml;q=0, text/html (i.e. explicitly  
>> rejecting XHTML). You should get a better algorithm.
> Definitely, you need a better algorithm. If you want to use the  
> Accept header, please use it correctly (that is, implement the full  
> specification). If you want to keep things simple, just make IE6 a  
> case off.

Why would I need a a better algorithm? Apache offers simple string  
matching, and my algorithm works well with all browsers that I have  
access to (except perhaps the w3 validator)  and it also has the added  
benefit of doing the backwards compatible thing (sending text/html)  
for the really old and strange browsers that I don't have access to.

While using the Accept header to tell servers what you don't want is  
possible according to spec, it seems more reasonable to ignore that  
corner case than to disenfranchise all old/esoteric browsers that  
doesn't understand application/xhtml+xml because you implemented a  
solution for very recent browsers + internet explorer.

The only real world case case that my solution doesn't handle is a  
future browser that does handle application/xhtml+xml but doesn't  
advertise it in the Accept: header. Well then, let's handle that case  
when it shows up. In a few years whe might even get an Internet  
Explorer 10 and a situation when more than 50% of the browser market  
can display pages marked according to the recommendation.


I guess normalcy is not really our style. -- Juno

Received on Sunday, 20 April 2008 20:57:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:59:07 UTC