]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2003-01-03 16:01:32 by cjwatson]
authorcjwatson <>
Sat, 4 Jan 2003 00:01:32 +0000 (16:01 -0800)
committercjwatson <>
Sat, 4 Jan 2003 00:01:32 +0000 (16:01 -0800)
Print a Last-Modified: header with the bug log's mtime for HEAD requests.

cgi/bugreport.cgi

index 636e1543b9e61b8eaaf78cb35388808233570d98..b0265dabc0d349f202a6eaf03f375c312424796c 100755 (executable)
@@ -16,18 +16,10 @@ require '/etc/debbugs/text';
 
 use vars(qw($gEmailDomain $gHTMLTail $gSpoolDir $gWebDomain));
 
-if ($ENV{REQUEST_METHOD} eq 'HEAD') {
-    print "Content-Type: text/html\n\n";
-    exit 0;
-}
-
 my %param = readparse();
 
 my $tail_html;
 
-my %maintainer = %{getmaintainers()};
-my %pkgsrc = %{getpkgsrc()};
-
 my $ref = $param{'bug'} || quit("No bug number");
 $ref =~ /(\d+)/ or quit("Invalid bug number");
 $ref = $1;
@@ -38,6 +30,22 @@ my $boring = ($param{'boring'} || 'no') eq 'yes';
 my $reverse = ($param{'reverse'} || 'no') eq 'yes';
 my $mbox = ($param{'mbox'} || 'no') eq 'yes'; 
 
+my $buglog = buglog($ref);
+
+if ($ENV{REQUEST_METHOD} eq 'HEAD') {
+    print "Content-Type: text/html\n";
+    my @stat = stat $buglog;
+    if (@stat) {
+       my $mtime = strftime '%a, %d %b %Y %T GMT', gmtime($stat[9]);
+       print "Last-Modified: $mtime\n";
+    }
+    print "\n";
+    exit 0;
+}
+
+my %maintainer = %{getmaintainers()};
+my %pkgsrc = %{getpkgsrc()};
+
 my $indexentry;
 my $descriptivehead;
 my $showseverity;
@@ -127,7 +135,6 @@ $descriptivehead.= ";\nSource for $status{package} is\n".
            '<a href="'.srcurl($tsrc)."\">$tsrc</a>" if ($tsrc ne "(unknown)");
 $descriptivehead.= ".</p>";
 
-my $buglog = buglog($ref);
 open L, "<$buglog" or &quit("open log for $ref: $!");
 if ($buglog !~ m#^\Q$gSpoolDir/db-h/#) {
     $descriptivehead .= "\n<p>Bug is <strong>archived</strong>. No further changes may be made.</p>";