#!/usr/bin/perl -wT # WARNING # THIS SCRIPT IS VULNERABLE TO XSS ATTACKS # If you use this on your site, be careful not to have anything on # your entire domain that cares about being hit by an XSS attack. # Initialise System use strict; use CGI; my $query = new CGI; ############################################################ # Initialize Parameters my $Pause = $query->param('Pause') || $query->param('pause'); if (($Pause eq "") or ($Pause < 0)) { print "Content-Type: text/plain delayed-file.pl <> version 1.2 ================================== This script will wait for x seconds before returning nothing or z, tagged with a mime type of y. The syntax is as follows: http://software.hixie.ch/utilities/cgi/test-tools/delayed-file?pause=x&mime=y&text=z ...where x is an integer greater than zero, y is an optional mime type (if no mime type is given then \"image/gif\" is used), and z is some string to output. The source (i.e., the real documentation) is available at http://software.hixie.ch/utilities/cgi/test-tools/delayed-file.pl "; exit; } my $Mime = $query->param('Mime') || $query->param('mime'); $Mime =~ s/[^a-zA-Z\/0-9]/-/go; if ($Mime eq "") { $Mime = "image/gif"; } my $Text = $query->param('Text') || $query->param('text'); ############################################################ # Print HTTP Header print "Content-Type: $Mime\n"; # print "Content-Length: " . length($Text) . "\n" unless ($Text eq ''); # causes problems with IE4 print "Cache-Control: no-cache\n\n"; ############################################################ # Pause for the required number of seconds, then return if ($Pause <= 60 and $Pause > 0) { sleep $Pause; } print $Text; ############################################################