Remove the massive chunk of crud to do application/xhtml+xml detection and replace...
Tomas Doran [Wed, 2 Sep 2009 23:49:33 +0000 (00:49 +0100)]
Makefile.PL
lib/Gitalist/View/Default.pm
lib/gitweb.pm

index 365b177..4f22ab8 100644 (file)
@@ -10,6 +10,7 @@ requires 'Catalyst::Runtime' => '5.80003';
 requires 'Catalyst::Plugin::ConfigLoader';
 requires 'Catalyst::Plugin::Static::Simple';
 requires 'Catalyst::Action::RenderView';
+requires 'Catalyst::View::ContentNegotiation::XHTML';
 requires 'Moose';
 requires 'namespace::autoclean';
 requires 'Config::General'; # This should reflect the config file format you've chosen
index 8473abc..7a9b11e 100644 (file)
@@ -4,6 +4,7 @@ use Gitalist; # ->path_to
 use namespace::autoclean;
 
 extends 'Catalyst::View::TT';
+with 'Catalyst::View::ContentNegotiation::XHTML';
 
 =head1 NAME
 
index ff41f84..30c1977 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+co#!/usr/bin/perl
 
 # gitweb - simple web interface to track changes in git repositories
 #
@@ -2925,26 +2925,10 @@ sub git_header_html {
                }
        }
 
-       # XXX As this does much header grovelling it may be broken ...
-       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 (defined $cgi->http('HTTP_ACCEPT') &&
-           $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';
-       }
-       $c->response->content_type($content_type);
-
        my $mod_perl_version = $ENV{'MOD_PERL'} ? " $ENV{'MOD_PERL'}" : '';
 
        $c->stash->{version} = $version;
        $c->stash->{git_version} = $git_version;
-       $c->stash->{content_type} = $content_type;
        $c->stash->{mod_perl_version} = $mod_perl_version;
        $c->stash->{title} = $title;