#!./perl
#
# echo-perl --
#
# Produce a page containing all FastCGI inputs
#
# Copyright (c) 1996 Open Market, Inc.
#
# See the file "LICENSE.TERMS" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: echo-perl,v 1.2 1996/10/30 14:38:00 mbrown Exp $
#
use FCGI;
sub print_env {
my($label, $envp) = @_;
print("$label:
\n
\n"); my @keys = sort keys(%$envp); foreach $key (@keys) { print("$key=$$envp{$key}\n"); } print("
\n"); } while (($key, $val) = each %ENV) { $initialEnv{$key} = $val; } $count = 0; while(FCGI::accept() >= 0) { print("Content-type: text/html\r\n\r\n", "
\n"); $len = 0 + $ENV{'CONTENT_LENGTH'}; if($len == 0) { print("No data from standard input.
\n");
} else {
print("Standard input:
\n
\n"); for($i = 0; $i < $len; $i++) { $ch = getc(STDIN); if($ch eq "") { print("Error: Not enough bytes received ", "on standard input\n"); last; } print($ch); } print("\n
\n"); } print_env("Request environment", \%ENV); print_env("Initial environment", \%initialEnv); }