Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
InetHTTPDaemon


NAME

InetHTTPDaemon - receive HTTP connections from clients

SYNOPSIS

TYPE HTTPD = POINTER TO HTTPDRec;
TYPE HTTPDRec =
   RECORD
      (Disciplines.ObjectRec)
   END;


CONST cantWriteTexts = 0; CONST cantTruncTexts = 1; CONST cantSeekOnTexts = 2; CONST errorcodes = 3; TYPE ErrorCode = SHORTINT; (* cantWriteTexts..cantSeekOnTexts *) TYPE ErrorEvent = POINTER TO ErrorEventRec; TYPE ErrorEventRec = RECORD (Events.EventRec) errorcode: ErrorCode; END; VAR errorMessages: ARRAY errorcodes OF Events.Message; VAR error: Events.EventType;

PROCEDURE Start(httpD: HTTPD): BOOLEAN; PROCEDURE Terminate(httpD: HTTPD); PROCEDURE Create(VAR httpD: HTTPD; port: Networks.Address; handler: WebHandlers.Handler);

DESCRIPTION

The InetHTTPDaemon module waits for clients to connect to it via network. For each connection a task is created to read and parse the request of a client. After splitting the request into pieces (method, URL, version, header fields and body) the parts are transfered to a web handler for further processing. Persistent connections are supported.

Create creates a new daemon. It will wait an port for connecting clients. After a request is split into pieces the given handler is called to process the request.

Start starts a daemon. The procedure will return FALSE if the desired port is not available. Terminate stops a running daemon.

DIAGNOSTICS

Errors are related to the daemon-object. The following error codes can occur:
cantWriteTexts
can't write to a Texts-stream
cantTruncTexts
problems truncing a Texts-stream at position zero
cantSeekOnTexts
unable to call Streams.Seek with a Texts-stream

SEE ALSO

HTTPHeaders
manage HTTP-header fields
Networks
general abstraction for network connections
RelatedEvents
error handling
Tasks
general tasks management
WebHandlers
processing of HTTP requests

AUTHOR

Manfred Rueß, University of Ulm
Edited by: borchert, last change: 1998/04/24, revision: 1.1, converted to HTML: 1998/04/24

Oberon || Library || Module Index || Search Engine || Definition || Module