Blame docs/cgi-examples/printenv
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
# To permit this cgi, replace # on the first line above with the
|
|
Packit |
90a5c9 |
# appropriate #!/path/to/perl shebang, and on Unix / Linux also
|
|
Packit |
90a5c9 |
# set this script executable with chmod 755.
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# ***** !!! WARNING !!! *****
|
|
Packit |
90a5c9 |
# This script echoes the server environment variables and therefore
|
|
Packit |
90a5c9 |
# leaks information - so NEVER use it in a live server environment!
|
|
Packit |
90a5c9 |
# It is provided only for testing purpose.
|
|
Packit |
90a5c9 |
# Also note that it is subject to cross site scripting attacks on
|
|
Packit |
90a5c9 |
# MS IE and any other browser which fails to honor RFC2616.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
##
|
|
Packit |
90a5c9 |
## printenv -- demo CGI program which just prints its environment
|
|
Packit |
90a5c9 |
##
|
|
Packit |
90a5c9 |
use strict;
|
|
Packit |
90a5c9 |
use warnings;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
print "Content-type: text/plain; charset=iso-8859-1\n\n";
|
|
Packit |
90a5c9 |
foreach my $var (sort(keys(%ENV))) {
|
|
Packit |
90a5c9 |
my $val = $ENV{$var};
|
|
Packit |
90a5c9 |
$val =~ s|\n|\\n|g;
|
|
Packit |
90a5c9 |
$val =~ s|"|\\"|g;
|
|
Packit |
90a5c9 |
print "${var}=\"${val}\"\n";
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|