Server algorithm
The main routine for the HTTP server configures itself according to the
command line arguments, reads the rules file into memory, and starts
a thread that listens for TCP/IP connections to the specified port. When
a connection is received, the listener thread creates a new thread
with a start routine that performs the following actions:
- Reads the HTTP request from WWW client and parses out method, URL, and
protocol. Any header lines included with the request are read at this
time as well.
- Executes request (function http_execute()):
-
Parse URL into scheme, host, ident, and search arg (if any).
- Apply rules file rules to ident portion of URL. Send error
message and return if 'fail' rule triggered.
-
- If translated URL matched on an exec rule:
- Punt to DECnet task (WWWEXEC) with subfunction "HTBIN"
- else if requested method is "GET" or "HEAD":
- If search argument present:
- Punt to DECnet task with subfunction "SEARCH"
- else:
- Retrieve file/directory and send to client.
- else if requested method is "POST":
- Punt to DECnet task with subfunction "POST"
-
Close connection and exit thread.
Note the repeated use of the operation "punt to DECnet task", in which the
server makes a DECnet connection to object WWWEXEC and lets the object
control the processing of the request.
WWEXEC algorithm
The WWWEXEC procedure first opens SYS$NET, making it a PPF (Process
Permanent File). It then reads the basic request parameters from the
server (sub-function, method, ident, protocol) and continues processing based
upon the sub-function:
- HTBIN:
- Parse script name out of URL ident and search for matching
script in htbin directory (directory that was named in the rule
file). If found, invoke script.
- SEARCH:
- Send message indicating generic search capability not available.
Note that scripts can handle searches because they are
tested for first by the server
- POST:
- Save request to temporary file and send acknowlegement to
client. Nothing is done with the saved file, I was testing
the request_to_file program for future development.
For a more detailed
description of the protocol
used between the server and WWWEXEC, see the comments at the bottom of
WWWEXEC.COM.