#! ./perl
#
# Put the full path to perl5.002 on the first line, or a symbolic link to perl in
# the startup directory.
#
# CGIservlet:
# A HTTPd "connector" for running CGI scripts on unix systems as WWW
# accessible Web sites. The servlet starts a true HTTP daemon that channels
# HTTP requests to forked daughter processes. CGIservlet.pl is NOT a
# full fledged server. Moreover, this servlet is definitely NOT intended
# as a replacement of a real server (e.g., Apache). It's design goal was
# SIMPLICITY, and not mileage.
#
# Note that a HTTP server can be accessed on your local machine WITHOUT
# internet access (but WITH a DNS?):
# use "http://localhost[:port]/[path]" or "http://127.0.0.1[:port]/[path]"
# as the URL. It is also easy to restrict access to the servlet to localhost
# users (i.e., the computer running the servlet).
#
# Suggested uses:
# - A testbed for CGI-scripts and document-trees outside the primary server.
# When developing new scripts and services, you don't want to mess up your
# current Web-site. CGIservlet is an easy way to start a temporary (private)
# server. CGIservlet allows to test separate HTTP server components, e.g.,
# user authentication, in isolation.
#
# - A special purpose temporary server (WWW everywhere/anytime).
# We run identification and other experiments over the inter-/intra-net using
# CGI-scripts. This means a lot of development and changes and only little
# actual run-time. The people doing this do not want "scripting" access to our
# departmental server with all its restrictions and security. So we need a
# small, lightweigth, easy-to-configure server that can be run by each
# investigator on her own account (and risk).
#
# - Interactive WWW presentations.
# Not everyone is content with the features of "standard" office presentation
# software. HTML and its associated browsers are an alternative (especially
# under Linux). However, you need a server to realize the full interactive
# nature of the WWW. CGIservlet with the necessary scripts can be run from
# a floppie (a Web server in 100 kB). The CGIservlet can actually run a
# (small) web site from RAM, without disk access (if you DO NOT use the
# 2>pid.log redirection on startup).
# With the "localhost" or "127.0.0.1" id in your browser you can use the
# servlet standalone.
#
# When the servlet is started with the -r option, only requests from "localhost"
# or "127.0.0.1" are accepted (default) or from addresses indicated after the
# -r switch.
#
# Running demo's and more information can be found at
# http://www.fon.hum.uva.nl/rob/OSS/OSS.html
#
#
############################################################################
#
# Changes (document ALL changes with date, name and email here):
#
# 8 Dec 1999 - Included hooks for compression when running from RAM.
# 2 Dec 1999 - Autoflush enabled.
# 2 Dec 1999 - Allow running a Web Site from RAM.
# 2 Dec 1999 - Changed the behavior of CGIservletSETUP. CGIservlet
# will eval ALL setup files, the one in the CGIscriptor
# subdirectory (if any) AND the one in the current
# directory. (also added a close(SETUP) command)
# 26 Nov 1999 - Added some minimal security for 'automatic', out of
# the box installation.
# 26 Nov 1999 - Made the text/osshell mime-type functional (i.e.,
# without any scripts, implement a dynamic web server)
# Linited to '.cgi' extension.
# 26 Nov 1999 - Added aliasing of URL paths, both one-to-one lookups
# and full regular expression, i.e., $Path =~ s/.../.../g
# replace commands
# 28 Sep 1999 - Made all client supplied HTTP parameter names lowercase
# to handle inconsistencies in case use.
# 29 Jul 1999 - Allowed for a SETUP configuration file 'CGIservletSETUP.pl'.
# Use $beginarg from the 'CGIscriptor/' directory if it exists.
# (Rob.van.Son@hum.uva.nl)
#
#
############################################################################
#
# Known bugs
#
# 23 Mar 2000 - An odd server side network error is reported by Netscape
# when a Post is initiated from a Javascript Submit of a
#