Table of Contents

OIL2 Class Standard.HTTPdaemon

class Standard . HTTPdaemon {
        int32   connectionsAccepted;
        oid     listenObj;
        string  receiveClass;
        oid     urlDirectory;
        string  virtualHostName;
} inherits from Object;


The HTTPdaemon class configures and starts the objects needed to implement a web site. In normal use, the HTTPdaemon creates an IOobject to accept incoming HTTP connections. Each physical web server has one IOobject that receives incoming client connections. By default, incoming HTTP connections are processed by a HTTPfastReceive object, which is capable of handling both HTTP/1.0- and HTTP/1.1-based sessions and implements many capabilties that are not required by the various HTTP RFCs.

Through the use the HTTP Host: directive (which is mandatory in HTTP/1.1, but also provided by some HTTP/1.0 implementations), a single physical HTTP port can be used to implement multiple logical web sites. Each site is configured in an identical fashion, but the second and subsequent sites set the dontDoListen flag to avoid creating duplicate IOobject objects that perform the listen for incoming HTTP connections. See create for details.



HTTPdaemon:create(string serverProfile, optional string address, optional string overrideName, optional int32 dontDoListen)

Method Description

The create method requires one mandatory argument, serverProfile, which is the name of a file that will be processed by a ParseParameterFile object. If not otherwise specified, the server's listen address is derived from the values of SERVER_NAME and SERVER_PORT and assumed to be using IP version 4 TCP. This assumed address can be overriden by the address argument. In addition to IP version 4, the implementation supports the use of any stream-oriented protocol (such as IP version 6, Unix file domain stream sockets, etc.) that is recognized by IOobject.

The logical name of the site is normally obtained from the ServerName attribute of the serverProfile file. It can be overridden by the overrideName argument. If the logical name is specified as "-", then the name is obtained from the actual name of the underlying host (system information attribute "hostName").

Multiple logical sites can be implemented using a single physical listen port via multiplexing based on the value of the HTTP Host: directive (its presence is mandatory for HTTP/1.1-based connections and many HTTP/1.0 clients include the directive as well). Second and subsequent sites avoid the creation of a conflicting IOobject listen port by specifying Boolean dontDoListen flag as the integer value 1.

A complete example of a parameter file appears below:

directoryRoot = /home/httpd/html/ab
ServerName =
ServerPort = 80
MIMEtypeFile = $VISTA_ROOT/config/mime.types
TolerateBadHTTP11 = 1
ReceiveClass = HTTPfastReceive

SECTION DefaultEnvironment
#MaximumCacheableSize =	65536
MaximumConnectionIdleTime	30
MaximumPersistentConnections	600
#MaximumEntitySize = 32768

SECTION CustomErrorPages
404 = /error404.html

A URLdirectory object is created to handle the registration of cached objects and services associated with portions of the web sites document tree. If dontDoListen is not equal to 1, then a AcceptConnection object is created using a suitably modified value of address. New connections are processed via the connectionAccepted method. When a new connection is accepted, an object is created to process the client session and passed the object Id of the session's IOobject. By default, these objects are of class HTTPfastReceive, but this can be altered by the ReceiveClass parameter.

The example profile above illustrates the full range of configuration options. The DefaultEnvironment section enables the specification of environment variables that will be provided to applications that process HTTP requests. Some variables are examined to obtain alternate values for configuration parameters. These are listed below:

maximum sizes in bytes of a cacheable document. If a document is greater than this size, it will not be read into memory in its entirety. Instead, a SendFile object will be used to perform the transfer to outgoing client connection.
maximum size of an pre-read entity body. If an entity body provided by a client (e.g., in a PUT or POST) is greater than this limit, the pre-read portion will be placed in the environment as ENTITY_CONTENT and the object Id of the IOobject will be placed in environment as ENTITY_OBJECT.
maximum number of simultaneous persistent connections. If the number of simultaneous connections goes over this limit, keep-alive requests will not be honored and the server will process one request per connection.
the maximum number of seconds an idle connection will be maintained. If no activity takes place within the specified period of time, it will be closed by a HTTPpurgeCache service object.



Method Description

Because it provides a long-running service, HTTPdaemon objects register themselves with the ShutdownService, which sends a systemShutdown notification when a graceful shutdown is requested.


HTTPdaemon:connectionAccepted(oid newSocket)

Method Description

When new HTTP connections are received, the connectionAccepted method creates a HTTPfastReceive object to handle the I/O and processing of any requests.

Generated: Wed, 14 Mar 2012 02:52:22 EDT
Support Information