[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mozilla-general
Subject:    Mozilla Cache vs. image/jpeg
From:       david () catcode ! com
Date:       2001-08-31 3:33:21
[Download RAW message or body]

The following CGI script rotates through files "sample1.txt"
"sample2.txt", and "sample3.txt", presenting a different
one every time I re-enter http://localhost/cgi-bin/rotate.cgi
in the location bar.

The script uses a file "count.dat" to keep track of which text file 
to present next. (I'm testing this locally, so I'm not worried
about multiple users hitting this script and screwing up the
counter.) This script works great.
=====
#!/usr/bin/perl

open COUNTFILE, "<count.dat" or die("Can't find file");
$n = <COUNTFILE>;
chomp $n;
close COUNTFILE;

open DATAFILE, "sample$n.txt";
read DATAFILE, $buf, 32768;

$n++;
if ($n > 3) { $n = 1; }
open COUNTFILE, ">count.dat";
print COUNTFILE $n, "\n";
close COUNTFILE;

print "Content-type: text/plain\n";
print "Cache-Control: no-cache, no-store, post-check=0, pre-check=0\n";
print "Expires: Thu, 01 Dec 1994 16:00:00 GMT\n";
print "\n";
print $buf;
====

If I change the files that I read to "sample1.jpg", "sample2.jpg", and
"sample3.jpg" by changing the line

   open DATAFILE, "sample$n.jpg";

and change the MIME type to:

   print "Content-type: image/jpeg\n";

then I do NOT get the rotation through all three images; I only get 
the first one.

All the "sampleX.txt" files are less than 200 bytes long, and
all the "sampleX.jpg" files are less than 14000 bytes long, so I'm
not missing data from the read being too short.

I'm using this version of Mozilla 0.9

Mozilla/5.0 (X11; U; Linux 2.2.17-21mdk i586; en-US; rv:0.9)i
Gecko/20010505

-- 
J. David Eisenberg    http://catcode.com/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic