Next: , Up: Existing servers   [Contents][Index]


3.4.1 HTTP Server

3.4.1.1 General description

The integrated HTTP server was originally meant to be a simple but fast document server. But now it can even execute CGI scripts. The GET, HEAD and POST methods are fully functional. Additionally Serveez produces directory listings when no standard document file (e.g., index.html) has been found at the requested document node (directory). Furthermore it implements a file cache for speeding up repetitive HTTP request.

In comparison to other web server projects like Apache and Roxen this web server is really fast. Comparative benchmarks will follow. The benchmark system is a 233 MHz Mobile Pentium MMX. Both the server and the client (http_load - multiprocessing http test client) ran on the same computer.

Small files

The small-file test load consists of 1000 files, each 1KB long, requested randomly.

concurrent fetches   1   10   50  100  200  500  1000
hits/second        501  520  481  475  420  390   295
CGI

The CGI test load consists of a trivial “hello world” C program. I noticed GNU/Linux (2.2.17 in this case, probably others too) to throw “Resource temporarily unavailable” errors when forking very fast. This limits the test to about 200 concurrent fetches on the test system.

Large files

The large-file test load consists of 100 files, each 1MB long, requested randomly. Also, each connection is throttled to simulate a 33.6Kbps modem. Note that 1000 33.6Kbps connections is 3/4 of a T3. There was no problem to get 1000+ concurrent fetches.

3.4.1.2 Configuration

The following options can be set from the configuration file.

indexfile (string, default: index.html)

The indexfile parameter is the default file served by the HTTP server when the user does not specify a file but a document node (e.g., http://www.lkcc.org/).

docs (string, default: ../show)

The docs parameter is the document root where the server finds its web documents.

userdir (string, default: public_html)

Each ‘~user’ request gets converted into the given users home directory. The string will be appended to this directory. Its default value is ‘public_html’.

cgi-url (string, default: /cgi-bin)

This parameter is the first part of the URL the HTTP server identifies a CGI request. For instance if you specify here /cgi-bin and the user requests http://www.lkcc.org/cgi-bin/test.pl then the HTTP server tries to execute the program test.pl within the cgi-dir (see below) and pipes its output to the user.

cgi-dir (string, default: ./cgibin)

The cgi-dir is the CGI document root (on the server).

cgi-application (hash, default: empty)

Within the MinGW32 port you can use this hash to associate certain file suffices with applications on your computer (e.g., pl with perl). This is necessary because there is no possibility to check whether a file is executable on Win32.

cache-size (integer, default: 200 kb)

This specifies the size of the document cache in bytes for each cache entry.

cache-entries (integer, default: 64)

This parameter specifies the maximum number of HTTP file cache entries (files). When you instantiate more than one HTTP server the biggest value wins. The HTTP file cache is shared by all HTTP servers.
Please note: If your harddrive/filesystem combination proves to be faster than the HTTP file cache you should disable it by setting both cache-size and cache-entries to zero.

timeout (integer, default: 15)

The timeout value is the amount of time in seconds after which a keep-alive connection (this is a HTTP/1.1 feature) will be closed when it has been idle.

keepalive (integer, default: 10)

On one keep-alive connection can be served the number of keepalive documents at all. Then the connection will be closed. Both this and the timeout value are just to be on the safe side. They protect against idle and high traffic connections.

default-type (string, default: text/plain)

The default-type is the default content type the HTTP server assumes if it can not identify a served file by the types hash and the type-file (see below).

type-file (string, default: /etc/mime.types)

This should be a file like the /etc/mime.types on Unix systems. It associates file suffices with MIME types.

types (hash, default: empty)

If you want to specify special content types do it here. This parameter is a hash map associating file suffices with HTTP content types (MIME types).

admin (string, default: root@localhost)

Your address, where problems with the server should be e-mailed. This address appears on some server-generated pages, such as error documents.

host (string, default: localhost)

This is the host name of your web server. Sometimes the server has to send back its own name to the client. It will use this value. Be aware that you cannot invent such a name.

nslookup (boolean, default: false)

If this is true the HTTP server invokes a reverse DNS lookup for each client connection in order to replace the remote ip address with the remote host name in the access logfile.

ident (boolean, default: false)

If this is true the HTTP server processes identd requests for each client connection for logging purposes.

logfile (string, default: http-access.log)

The location of the access logfile. For each HTTP request a line gets appended to this file.

logformat (string, default: CLF)

The format of the access logfile. There are special placeholders for different kinds of logging information. The default log format is the Common Log Format (CLF). It contains a separate line for each request. A line is composed of several tokens separated by spaces.

CLF = host ident authuser date request status bytes

If a token does not have a value then it is represented by a hyphen (-). The meanings and values of these tokens are as follows:

%h (host)

The fully-qualified domain name of the client, or its IP number if the name is not available.

%i (ident)

This is the identity information reported by the client. Not active, so we will see a hyphen (-).

%u (authuser)

If the request was for an password protected document, then this is the userid used in the request.

%t (date)

The date and time of the request, in the following format:

date   = [day/month/year:hour:minute:second zone]
day    = 2*digit
month  = 3*letter
year   = 4*digit
hour   = 2*digit
minute = 2*digit
second = 2*digit
zone   = (`+' | `-') 4*digit
%R (request)

The request line from the client, enclosed in double quotes (").

%r (referrer)

Which document referred to this document.

%a (agent)

What kind of web browser did the remote client use.

%c (status)

The three digit status code returned to the client.

%l (bytes)

The number of bytes in the object returned to the client, not including any headers.


Next: IRC Server, Up: Existing servers   [Contents][Index]