]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: webserver config for PATH_INFO
[Gitweb] / gitweb.perl
index f33524d212b7d7db9fc912a85eedb47f807e6b240044c043ad6e301b271268cf..a0b1681acaf23200cf0835ca08c29be0c7eab7cc66e01671a56281e726cba017 100755 (executable)
@@ -2902,6 +2902,11 @@ sub git_header_html {
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 EOF
 <meta name="robots" content="index, nofollow"/>
 <title>$title</title>
 EOF
+# the stylesheet, favicon etc urls won't work correctly with path_info unless we
+# set the appropriate base URL
+       if ($ENV{'PATH_INFO'}) {
+               print '<base href="'.esc_url($my_url).'" />\n';
+       }
 # print out each stylesheet that exist
        if (defined $stylesheet) {
 #provides backwards capability for those people who define style sheet in a config file
 # print out each stylesheet that exist
        if (defined $stylesheet) {
 #provides backwards capability for those people who define style sheet in a config file
@@ -6016,7 +6021,25 @@ sub git_feed {
        }
        if (defined($commitlist[0])) {
                %latest_commit = %{$commitlist[0]};
        }
        if (defined($commitlist[0])) {
                %latest_commit = %{$commitlist[0]};
-               %latest_date   = parse_date($latest_commit{'committer_epoch'});
+               my $latest_epoch = $latest_commit{'committer_epoch'};
+               %latest_date   = parse_date($latest_epoch);
+               my $if_modified = $cgi->http('IF_MODIFIED_SINCE');
+               if (defined $if_modified) {
+                       my $since;
+                       if (eval { require HTTP::Date; 1; }) {
+                               $since = HTTP::Date::str2time($if_modified);
+                       } elsif (eval { require Time::ParseDate; 1; }) {
+                               $since = Time::ParseDate::parsedate($if_modified, GMT => 1);
+                       }
+                       if (defined $since && $latest_epoch <= $since) {
+                               print $cgi->header(
+                                       -type => $content_type,
+                                       -charset => 'utf-8',
+                                       -last_modified => $latest_date{'rfc2822'},
+                                       -status => '304 Not Modified');
+                               return;
+                       }
+               }
                print $cgi->header(
                        -type => $content_type,
                        -charset => 'utf-8',
                print $cgi->header(
                        -type => $content_type,
                        -charset => 'utf-8',
This page took 0.245264 seconds and 4 git commands to generate.