Subject: Re: [PATCH] gitweb: Send XHTML as 'application/xhtml+xml' where possible

From: Alp Toker <[email-masked]>
Date: Sun, 09 Jul 2006 12:18:12 +0100

Junio C Hamano wrote:
>> It falls back to 'text/html' even if the user agent claims to support
>> 'application/xhtml+xml' by means of a glob in order to work around an
>> insidious Internet Explorer bug.
> 
> I do not care much about IE, but...

That makes the two of us. Still, it's probably worth not blocking out IE 
in case the need arises to check up on repositories from internet cafes 
when on holiday or the like.

>> +	my $content_type = ($cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ && $cgi->Accept('application/xhtml+xml') ne 0) ? 'application/xhtml+xml' : 'text/html';
> 
> 1. I would prefer something like this to be written with if-else,
>    not with a conditional expression;

Indeed, this line is a bit unwieldy. Will break it out.

> 2. The "by means of a glob" hack needs to be left as a comment
>    in the code to say why;

Good plan.

> 3. Did you really mean to say "ne 0"?

Well spotted. String comparison works, but != would be more sensible.

A revised patch is in the works.