#!/usr/local/bin/perl # Simple example of nph- CGI script. It must supply ALL headers. # Get date information ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(); $fullyear = $year + 2000; $fullyear -= 100 if $year > 75; @weekday = ( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); @month = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $|=1; # Make output unbuffered -- needed for server push print "HTTP/1.0 200 OK\r\n"; # The first line must be the status line printf("Date: %s, %02d %s %04d %02d:%02d:%02d GMT\r\n", $weekday[$wday], $mday, $month[$mon], $fullyear, $hour, $min, $sec); print "Server: $ENV{SERVER_SOFTWARE}\r\n"; print "Content-type: text/html\r\n"; print "Cache-control: no-cache\r\n"; print "\r\n"; # A blank line ends the headers # From now on everything goes to the client print "\n"; print "\n"; print " \n"; print " WN Executable Program Example -- Results\n"; print " \n"; print "\n"; print " \n"; print "

Here are some standard CGI environment variables:

\n"; print "\n"; print "

\n"; print " PATH_INFO = $ENV{PATH_INFO}
\n"; print " AUTH_TYPE = $ENV{AUTH_TYPE}
\n"; print " SERVER_SOFTWARE = $ENV{SERVER_SOFTWARE}
\n"; print " SERVER_NAME = $ENV{SERVER_NAME}
\n"; print " SERVER_PROTOCOL = $ENV{SERVER_PROTOCOL}
\n"; print " SERVER_PORT = $ENV{SERVER_PORT}
\n"; print " HTTP_ACCEPT = $ENV{HTTP_ACCEPT}
\n"; print " HTTP_ACCEPT_CHARSET = $ENV{HTTP_ACCEPT_CHARSET}
\n"; print " HTTP_ACCEPT_LANGUAGE = $ENV{HTTP_ACCEPT_LANGUAGE}
\n"; print " HTTP_RANGE = $ENV{HTTP_RANGE}
\n"; print " HTTP_REFERER = $ENV{HTTP_REFERER}
\n"; print " HTTP_USER_AGENT = $ENV{HTTP_USER_AGENT}
\n"; print " HTTP_FROM = $ENV{HTTP_FROM}
\n"; print " HTTP_HOST = $ENV{HTTP_HOST}
\n"; print " HTTP_COOKIE = $ENV{HTTP_COOKIE}
\n"; print " PATH_TRANSLATED = $ENV{PATH_TRANSLATED}
\n"; print " SCRIPT_NAME = $ENV{SCRIPT_NAME}
\n"; print " SCRIPT_FILENAME = $ENV{SCRIPT_FILENAME}
\n"; print " QUERY_STRING = $ENV{QUERY_STRING}
\n"; print " REMOTE_HOST = $ENV{REMOTE_HOST}
\n"; print " REMOTE_ADDR = $ENV{REMOTE_ADDR}
\n"; print " REQUEST_METHOD = $ENV{REQUEST_METHOD}
\n"; print "

\n"; print "\n"; print "

Non-CGI variables provided by the WN server:

\n"; print "\n"; print "

\n"; print " URL_SCHEME = $ENV{URL_SCHEME}
\n"; print " DOCUMENT_ROOT = $ENV{DOCUMENT_ROOT}
\n"; print " WN_DIR_PATH = $ENV{WN_DIR_PATH}
\n"; print " HTTP_POST_FILE = $ENV{HTTP_POST_FILE}
\n"; print " HTTP_PUT_FILE = $ENV{HTTP_POST_FILE}
\n"; print "

\n"; print " \n"; print "\n"; exit(0);