Home   Info   Documentation   Installation   Configuration   History   Download   Mailing list   Feedback 

 Up - Design   Forward - Protocol 

fhttpd user processes modules

fhttpd is running as one process with a nonblocking processing loop. Since no file I/O is done inside this loop there are no delays caused by it, and one process can handle all requests simultaneously. Requests are parsed while the data is being received, and finished requests are resolved, checked against access rights lists and processed in one of the following ways:

  1. Rejected. Negative result is sent to the client immediately.
  2. Answered by sending the content of preloaded into the memory file.
  3. Request is placed into the requests queue of some application.

Each application has some (sometimes zero) number of module processes running. If the request is placed into the requests queue, it is then sent to some running process through the pipe, AF_UNIX socket or TCP/IP socket. Request is processed by the process while its descriptor (but not the data) is kept in the main process. Module process sends responses to the main process, and main process either places the returned data into the output queue of the socket, connected to the client or finishes the request processing and deletes the request descriptor. Module processes also can send other messages as described in the protocol specification. If the application uses AF_UNIX socket, it also receives the file descriptor of the socket, connected to the client. Process then can send data back either using that file descriptor or the main process.


Postscript
PDF
XFig 3.2 source

Application definition in the configuration

Configuration file should contain applications definition in the format (from fhttpd configuration documentation):
Application name pathmask username maxinstances maxqueue mappedpathmask [executable [[-p|-s [arguments]]]]
Defines application module, implemented as a process.

pathmask is only used to check for trailing slash matching (if pathmask just contains trailing slash, only URLs with trailing slash or mentioning index files will match, and vice versa) while remapping is done by mappedpathmask. "-" as the pathmask disables distinguishing between requests with and without trailing slash.

If executable is omitted, application is assumed to be remote, connected by TCP socket, and username is used for authentication (with the username and the password of that user). Executable can connect from anywhere, if the authentication succeeds, and different instances of the same program may be connected from different hosts (for example, to distribute the load), but the total number of connected instances can't exceed maxinstances.

If executable is mentioned, it is executed on startup as username, and server uses pipes or AF_UNIX sockets to its stdin and stdout for communication. Additional copies of executable will be started if the requests number will require that, but the maxinstances number limits the possible number of them.

maxqueue is the number of requests in the queue (sent to the application, but not answered). Value 1 implies synchronous-only operations.

-p option specifies communication through pipes, and -s option specifies communication through AF_UNIX sockets. All arguments starting from -s or -p are passed as the command line to the process. The number of arguments can't exceed 12.

fhttpd file I/O and CGI support module is implemented as fhttpd-file application module since version 0.3.0, so all servers should have it mentioned if they support files and/or CGI access.

Configuration file, managed by the server administrator, should contain definitions of all applications, running on the server.
Alex Belits
Last modified: Wed Jun 23 02:27:06 PDT 1999
 Up - Design   Forward - Protocol 

 Home   Info   Documentation   Installation   Configuration   History   Download   Mailing list   Feedback