diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 2e87de4769..bd9b9de88c 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -293,7 +293,17 @@ sub git_header_html { } } } - print $cgi->header(-type=>'text/html', -charset => 'utf-8', -status=> $status, -expires => $expires); + my $content_type; + # require explicit support from the UA if we are to send the page as + # 'application/xhtml+xml', otherwise send it as plain old 'text/html'. + # we have to do this because MSIE sometimes globs '*/*', pretending to + # support xhtml+xml but choking when it gets what it asked for. + if ($cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ && $cgi->Accept('application/xhtml+xml') != 0) { + $content_type = 'application/xhtml+xml'; + } else { + $content_type = 'text/html'; + } + print $cgi->header(-type=>$content_type, -charset => 'utf-8', -status=> $status, -expires => $expires); print < @@ -301,7 +311,7 @@ sub git_header_html { - + $title