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

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.

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.

> (and the content negotiation is pretty pointless).
Not really, Web browser will usually handle a document differently 
depending of its media-type. Typically, a text/html document will be 
processed by an SGML parser, whereas an application/xhtml+xml document 
will be processed by an XML parser. That is, for an XHMTL capable 
browser. IE6 won't display at all an application/xhtml+xml page, so you 
really want to send it as text/html. And given that sending XHTML as 
text/html is not recommended in the general case, you need 
content-negociation (although it would be better to send real HTML to 
XHTML non-capable browser).

>> 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.

-- 
Etienne Miret
Ne m'envoyez pas de fichier Word SVP, je ne peux pas les lire !
Don't send me Word attachments please, I can't read them!
http://perso.ens-lyon.fr/etienne.miret/Netiquette/no_MS_Office

Received on Sunday, 20 April 2008 20:16:07 UTC