#!/usr/local/bin/perl # This filename must be changed. The file it points to # must contain a list of GIF files on your system, # specified by complete paths. $gifListFile = "/CHANGE/THIS/FILE/giflist.txt"; sub SupportsServerPush { local($userAgent) = $ENV{'HTTP_USER_AGENT'}; $version = 0; $_ = $userAgent; if (/Mozilla\/(\d\.\d)/) { if ($1 >= 1.1) { return 1; } } return 0; } open(IN, $gifListFile); @list = ; close(IN); print "HTTP/1.0 200 OK\n"; $pushFlag = &SupportsServerPush; if ($pushFlag) { print "Content-type: multipart/x-mixed-replace;boundary=goober\n\n"; } foreach $name (@list) { $name =~ s/\n//g; # Now output the file if ($pushFlag) { print "\n--goober\n"; } print "Content-type: image/gif\n\n"; open(IN, $name); while (read(IN, $buffer, 4096)) { print $buffer; } close($name); if (! $pushFlag) { last; } # A short delay to make sure each frame is appreciated sleep(1); } if ($pushFlag) { print "\n--goober--\n"; } exit 0;