Usage: plexus.pl config_file port running_as_root socket_filedescriptor
This routine is the main loop that accepts incoming connections
on the socket and forks a process to handle the transaction. This
way the server can continue to accept other connections while processing
the actual data in the background. Plexus.pl is normally only called from
the plexus
startup code. Once the connection is established
plexus.pl
gets the request and logs it to the log file, then
hands the request off to &process_input
.
&process_input
routine validates the request and
hands it off to a support routine. Currently the only routine supported
is &do_get
, which handles GET requests from the the
server.
&do_get
routine handles mappings between the
URL path and the actual data. For most documents the two will be the
same but you can interpose translators using the %map
associative array to specify alternate routines for handling the request.
The default is $map{'__default__'} and as distributed
is set to &retrieve
. The mappings can be customized in
the config file.
&wrap_file
or &index_dir
to handle it.
If it's a file &retrieve
first calls
&deduce_content
to decide what kind of file it is.
-B
test to decide if it a binary file, if so it returns
$content_binary; if not it returns $content_plain.
setext.pl
for an example translator. To send raw data use &raw_file.