r8965 - /scripts/qa/qareport.cgi

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Nov 7 15:06:08 UTC 2007


Author: dmn
Date: Wed Nov  7 15:06:08 2007
New Revision: 8965

URL: http://svn.debian.org/wsvn/?sc=1&rev=8965
Log:
Attempt to return "304 not modified" if browser has sent If-Modified-Since and nothing has changed since

Modified:
    scripts/qa/qareport.cgi

Modified: scripts/qa/qareport.cgi
URL: http://svn.debian.org/wsvn/scripts/qa/qareport.cgi?rev=8965&op=diff
==============================================================================
--- scripts/qa/qareport.cgi (original)
+++ scripts/qa/qareport.cgi Wed Nov  7 15:06:08 2007
@@ -41,6 +41,7 @@
     ),
     Date::Parse::str2time($script_date),
 );
+my $last_modified = @modified[-1];
 my @pkglist = get_pkglist();
 
 my( @for_upload, @for_upgrade, @waiting, @wip, @with_bugs );
@@ -110,6 +111,16 @@
 {
     my $htmlp = $cgi->Accept("text/html");
     my $xhtmlp = $cgi->Accept("application/xhtml+xml");
+
+    my $ims = $cgi->http('If-Modified-Since');
+    $ims = Date::Parse::str2time($ims) if $ims;
+
+    if( $ims and $ims >= $last_modified )
+    {
+        print $cgi->header('text/html', '304 Not modified');
+        exit 0;
+    }
+
     my $old_locale = setlocale(LC_TIME);
     setlocale(LC_TIME, "C");
     print $cgi->header(
@@ -120,7 +131,7 @@
             ),
         -last_modified   => POSIX::strftime(
             "%a, %d %b %Y %T %Z",
-            gmtime($modified[-1],
+            $last_modified,
             ),
         ),
     );
@@ -144,6 +155,7 @@
         wip => \@wip,
         with_bugs   => \@with_bugs,
         bugs_by_severity    => \%bugs_by_severity,
+        ims => $ims,
     },
 ) || die $tt->error;
 
@@ -293,6 +305,7 @@
 [% META id='$Id$' %]
 <p style="border-top: 1px solid black">
     <code>$template.id</code>
+    <code>IMS: $ims</code>
 </p>
 </body>
 </html>




More information about the Pkg-perl-cvs-commits mailing list