#!/usr/bin/perl # Print out compressed pages $file = "faq.html.gz"; use HTTP::Date; @stat = stat($0) or die ("Could not get statistics for script file"); $mylastmodtime = $stat[9]; $mylastmod = time2str($mylastmodtime); if ($ENV{'HTTP_ACCEPT_ENCODING'} =~ m/gzip/) { @stat = stat($file) or die ("Could not get statistics for compressed file"); $lastmodtime = $stat[9]; if ($mylastmodtime > $lastmodtime) { $lastmodtime = $mylastmodtime; } $lastmod = time2str($lastmodtime); if ($ims = $ENV{'HTTP_IF_MODIFIED_SINCE'}) { $ims =~ s/;.*//; $imstime = str2time($ims); if ($lastmodtime <= $imstime) { print "Status: 304 Not Modified\n\n"; exit; } } print "Content-Type: text/html\n"; print "Content-Encoding: gzip\n"; print "Last-Modified: $lastmod\n\n"; open (COMP, $file) or die ("Could not open compressed file"); binmode (COMP); print ; close (COMP); } else { print "Content-Type: text/html\n"; print "Last-Modified: $mylastmod\n\n"; print "GeForce FAQ

Your browser does not support gzip compression. Try enabling the HTTP 1.1 protocol or using a newer browser.

You will be automatically redirected to the uncompressed version in 5 seconds if your browser supports redirects.

"; }