Re: XHTML2 MIME type

On Fri, Apr 11, 2003 at 09:35:44PM +0200, Herr Christian Wolfgang Hujer wrote:
| > It is far from ideal, but until browser start using the Accept header in
| > a useful manner, it is what needs to be done.
| That's really far from ideal.
| AFAIK:
| Currently, it's illegal to send XHTML 1.1 as text/html.
| There's no RFC or TR allowing XHTML 1.1 to be sent as text/html.

So arrest me. Besides, XHTML 1.0 defines steps that reasonably allow you 
to use text/html as a MIME type and XHTML 1.1 does nothing to contradict 
this advice.

Further, the RFC that defines the application/xhtml+xml MIME type is of 
category "Informational" whereas "text/html" is defined in a "Standards 
Track" RFC and so is arguably the most standards-compliant way of 
serving up HTML-like content.
 
| And how am I supposed to do that in my .htaccess?

----------------------- .htaccess -----------------------
Action xhtml-mime /cgi-bin/xhtml-mime.cgi
AddHandler xhtml-mime .xhtml
---------------------------------------------------------

---------------- /cgi-bin/xhtml-mime.cgi ----------------
#!/usr/bin/perl
$ua   = $ENV{'HTTP_USER_AGENT'};
$orig = $ENV{'PATH_TRANSLATED'};
if ( ($ua =~ m/Opera.7/) || ($su =~ m/Gecko/) ) {
        print "Content-Type: application/xhtml+xml\n\n";
} else {
        print "Content-Type: text/html\n\n";
}
system("cat $orig");
---------------------------------------------------------

Of course, you can make things a little more efficient by writing the 
CGI program in C instead of Perl.

-- 
Toby A Inkster BSc (Hons) ARCS | mailto:tobyink@goddamn.co.uk | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:tobyink@a-message.de
            http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
                             playing://(nothing)

Received on Friday, 11 April 2003 18:39:36 UTC