our $home_text = "indextext.html";
# filename of html text to include at bottom of each page
our $site_footer = "";
+# filename of cached version of front page
+our $cached_front_page = "/var/local/lib/gitweb/indexcache.html";
# URI of stylesheets
our @stylesheets = ("gitweb.css");
}
}
+sub git_send_cached_front_page {
+ my $status = shift || "200 OK";
+ my $expires = shift;
+ 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';
+ }
+ print $cgi->header(-type=>$content_type, -charset => 'utf-8',
+ -status=> $status, -expires => $expires);
+ open (my $fd, $cached_front_page);
+ print <$fd>;
+ close $fd;
+ exit;
+}
+
+# Display a cached page if no parameters were provided and the
+# "nocache" parameter was not passed.
+our $nocache = $cgi->param('nocache');
+our @params = $cgi->Vars;
+use Data::Dumper;
+if ($cached_front_page && ! defined $nocache && scalar @params == 0
+ && -f $cached_front_page && -r $cached_front_page) {
+ git_send_cached_front_page();
+}
+
# parameters which are refnames
our $hash = $cgi->param('h');
if (defined $hash) {