AW3 INTERNALS NOTES
~~~~~~~~~~~~~~~~~~~

--------------------------------------------------------------------
AW is a single process, non-threaded server. It uses this design
because AW tries to guarantee complete deterministic behaviour
in all instances - in other words, by following this design
strategy AW developers don't have to consider the possibilities
of race conditions or data access conflicts.
--------------------------------------------------------------------

--------------------------------------------------------------------
AW3 uses 2 main linked lists for client connections. It maintains an
'in use' list and a 'free' list. It does this to avoid the overhead
of malloc()ing a new connection structure every time.

When a client connects, AW3 checks to see if there are any free
structures that it can use in the free list. If not, it malloc()s
a structure and uses that.

It takes the structure, initializes it, adds it to the 'in use' list
and goes into a sleep state (actually a select() call).

When the connection is terminated (succesfully or otherwise), AW3
closes all descriptors associated with the connection and returns
the connection structure to the 'free' list.
--------------------------------------------------------------------

--------------------------------------------------------------------
AW3 indefinitley blocks on the select() call for *ALL* I/O. Contrast
this to AW2 which used polling in certain cases. This means that
AW will not use the CPU at all when it's not handling client I/O.
--------------------------------------------------------------------

--------------------------------------------------------------------
AW3 passes the "query arguments" (those arguments specified after
an unencoded '?' character in a URL) to a CGI process in 2 ways:

It creates an environment variable in the CGI process (*) for every
argument specified in the query and decodes the argument.
NOTE: AW doesn't do this anymore.

It passes the unencoded query string to the CGI process as the first
command line argument when running the CGI program.

* AW will *not* overwrite an existing argument if it is passed in
  the query string and already exists in the environment. This stops
  people from specifying, for example, query arguments "PATH" or
  "LOGIN" for instance.
--------------------------------------------------------------------

--------------------------------------------------------------------
AW shutdown()s the read side of the connection socket on all normal
requests and on CGI requests started with a GET or HEAD request.

On a CGI POST request, AW redirects the read side of the connection
to the stdin of the CGI process.
--------------------------------------------------------------------
