HTTPHandler


Derived from: none

Declared in: HTTPHandler.h

Library: libHTTP.so


Overview


HTTPHandler objects are responsible for handling request messages. When a request needs to be processed, the handler is passed a HTTPRequest message through its MessageReceived() method. See HTTPListener for more information on the relation of HTTPListener to HTTPHandler.


Constructor and Destructor


HTTPHandler()


	HTTPHandler( void )


Member Functions


MessageReceived()


	virtual bool MessageReceived( HTTPRequest *request )

MessageReceived() is called when a HTTPListener needs to proccess a request. It is the responsibility of the handler to send any reply which may be needed. The return value is used to control the connection. By default, the listener-created connection thread will maintain a HTTP/1.1 connection when a HTTP/1.1 request is received. The connection-thread's will send the required HTTP/1.1 100 Continue message before it calls MessageReceived(). If for some reason the connection should need to be closed after the MessageReceived() is called, MessageReceived() should return false. Otherwise it should return true if a persistant connection can be maintained. The connection should be closed if the response sent did not include a content-length header as may be the case when CGIs and other dynamic content are involved. If the response message sent to the client did not include a content-length header it MUST contain a "Connection: close" header and MessageReceived() MUST return false in order for the client to know where the end of the entity-body is.


NewCopy()


	virtual HTTPHandler *NewCopy( void )

Create and return a new copy of this object.


ConnectionOpened()


	virtual void ConnectionOpened( const char *remote_addr )

This user hook is called when the connection is opened. remote_addr is the IP address of the remote host.


ConnectionClosed()


	virtual void ConnectionClosed( status_t status )

This user hook is called when the connection is closed. status is not used at this time.


libHTTP - A high-level HTTP API for the BeOS


Copyright (C) 1999 Joe Kloss