John Korb ([log in to unmask]) wrote:
: If anyone has any additional suggestions (or sample code for reading
: CONTENT_LENGTH bytes from STDIN), please pass them along!
I can't help with the 3000 end of things, but I have appended a script
below that we use to echo form responses, environmnet variables, and
command line arguments when we debug ... You'll note that the config line
shows we are using it with Apache on HP-UX currently, but the same script
has been used with NCSA on HP-UX, Apollo, Linux, and I don't recall where
else ... If it can help you locate your problem, use it.
Good luck,
Dave
-(These opinions are my own and not necessarily those of my company.)-
Dave Eaton
Honeywell Inc. - Industrial Automation and Control - AZ15/2E8
16404 N Black Canyon Highway; Phoenix, AZ 85023
e-mail:[log in to unmask] voice:602-313-5094 FAX:602-313-4064
---------------------------perl script------------------
#!/opt/perl/bin/perl
# W. M. Richards, Honeywell IAC, Phoenix AZ, June 1994
#
# Configurable values
$server_root = '/opt/apache' ;
#
# Get some info from the environment
$local = $ENV {'SERVER_NAME'} ;
$remote = $ENV {'REMOTE_HOST'} ;
#
# Read the form responses and parse them into %responses
$content_length = $ENV {'CONTENT_LENGTH'} ;
if ($content_length > 0)
{
read (STDIN, $response, $content_length) ;
&parse_form_response ($response) ;
}
#
# Standard mime header
print "Content-type: text/html\n\n" ;
print "<title>HTML CGI response echo</title>\n" ;
print "<h1>HTML Common Gateway Interface Echo</h1>\n" ;
#
# Echo the environment
print "<hr>\n" ;
foreach $envar (keys (%ENV))
{
push (@envstrs, "<strong>${envar}</strong>=" . $ENV {$envar}) ;
}
print "<h2>Environment strings:</h2>\n" ;
print "<ul>\n" ;
foreach $envstr (@envstrs)
{
print "<li>$envstr\n" ;
}
print "</ul>\n" ;
#
# Echo the form contents, if any
print "<hr>\n" ;
if ($content_length > 0)
{
print "<h2>Form contents:</h2>\n" ;
print "<ul>\n" ;
foreach $keyword (keys (%responses))
{
print "<li><strong>${keyword}</strong> = '", $responses {$keyword}, "'\n"
;
}
print "</ul>\n" ;
}
else
{
print "<h2>No form data posted.</h2>\n" ;
}
#
# Echo the command-line args, if any
print "<hr>\n" ;
if (scalar (@ARGV) > 0)
{
print "<h2>Command-line arguments:</h2>\n" ;
print "<ul>\n" ;
foreach $arg (@ARGV)
{
print "<li>$arg\n" ;
}
print "</ul>\n" ;
}
else
{
print "<h2>No command-line arguments.</h2>\n" ;
}
print "<hr>\n" ;
exit (0) ;
#
# Parses its form-response argument into associative array "%responses"
sub parse_form_response
{
local ($response) = @_ ;
local (@fields, $field, $keyword, $value) ;
@fields = split (/\&/, $response) ;
foreach $field (@fields)
{
$field =~ s/[\r\n]+/\n/g ;
$field =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig ;
$field =~ s/\+/ /g ;
($keyword, $value) = split (/=/, $field) ;
$responses {$keyword} = $value ;
}
}
#-----------end---------------
|