Update of /cvsroot/popfile/engine/UI
In directory sc8-pr-cvs1:/tmp/cvs-serv17686
Modified Files:
HTTP.pm
Log Message:
Calculate and send a 1 hour expire header for files returned through http_file_
Index: HTTP.pm
===================================================================
RCS file: /cvsroot/popfile/engine/UI/HTTP.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HTTP.pm 30 May 2003 19:39:19 -0000 1.4
--- HTTP.pm 30 May 2003 20:52:32 -0000 1.5
***************
*** 311,315 ****
--- 311,317 ----
my ( $self, $client, $file, $type ) = @_;
my $contents = '';
+
if ( open FILE, "<$file" ) {
+
binmode FILE;
while (<FILE>) {
***************
*** 318,322 ****
close FILE;
! my $header = "HTTP/1.0 200 OK\r\nContent-Type: $type\r\nContent-Length: ";
$header .= length($contents);
$header .= "$eol$eol";
--- 320,338 ----
close FILE;
! # To prevent the browser for continuously asking for file handled in this way
! # we calculate the current date and time plus 1 hour to give the browser
! # cache 1 hour to keep things like graphics and style sheets in cache.
!
! my @day = ( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' );
! my @month = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
! my $zulu = time;
! $zulu += 60 * 60; # 1 hour
! my ( $sec, $min, $hour, $mday, $mon, $year, $wday ) = gmtime( $zulu );
!
! my $expires = sprintf( "%s, %02d %s %04d %02d:%02d:%02d GMT",
! $day[$wday], $mday, $month[$mon], $year+1900,
! $hour, $min, $sec);
!
! my $header = "HTTP/1.0 200 OK\r\nContent-Type: $type\r\nExpires: $expires\r\nContent-Length: ";
$header .= length($contents);
$header .= "$eol$eol";
|