Release Date: 1 February 2008
Object Synopsishttp -- HTTP server object
DescriptionAn HTTP object represents a server which communicates via HTTP, i.e., an httpd-like program. An HTTP object is created with dt_http_alloc(3) and supports HTTP/0.9 and HTTP/1.0 protocols. A request from a client (e.g., a browser) are received by the server (an HTTP object) using dt_http_get(3). Communication via HTTP has the great advantage of operating over a logical network which may be local to a machine, between machines on a LAN, or global in scope (World Wide Web). The HTTP object encapsulates this process.
Operation of HTTP objects are controlled via named properties which are set via dt_setinteger(3), dt_setstring(3), and dt_appendstring(3). Names for system-defined properties start with "htt_" and are listed below. The only property which is absolutely required is "htt_port" which is set to the value of the `port' argument of dt_alloc_http_server(3). All other property have sensible defaults, so a call to dt_alloc_http_server(3) with a valid 'port' argument will create a reasonable HTTP service.
The date & time of HTTP object allocation, e.g., Mon, 02 Dec 2002 07:40:03 GMT. The format conforms to RFC 822 & RFC 1123. For more information, see http://www.ietf.org/rfc/rfc822.txt and http://www.ietf.org/rfc/rfc1123.txt.
The state of the HTTP service when a TRANSFER object is returned from dt_http_get(3) and will be one of following values:
DX_HTT_OK means a request has been received. The TRANSFER object will be equal to NULL_OB if the request was processed internally. Otherwise, the TRANSFER object will be a valid object for processing.
DX_HTT_TIMEOUT means a request has not been received. The TRANSFER object will be equal to NULL_OB.
DX_HTT_ERROR means an error condition exists. The TRANSFER object will be equal to NULL_OB. Use dt_errors(3) to access error information.
DX_HTT_DONE means the same as DX_HTT_OK and also indicates that the service has completed. This status is useful for breaking a CGI service from a dual-purpose Server/CGI loop. Calling dt_http_get(3) again will result in an error.
The port number on which the service is listening. This value is equal to the argument passed to dt_alloc_http_server(3). Valid values are 0 to 65535 inclusive. Port 0 is interpreted as standard input and causes the service to behave as a CGI.
The name of the local host as viewed from the server using the uname(1) system call, e.g., www.daylight.com.
The IP address of the local host as viewed from the server using gethostbyaddr(3) system call, e.g., 184.108.40.206.
The time in milliseconds the service polls the listening port for a request by using the select(3) system call. In other words, this value determines how long a call to dt_http_get(3) will wait before returning NULL_OB and setting the htt_status property to DX_HTT_TIMEOUT.
A bitwise OR of request method identifiers that are implemented by the service. If a request method received within a call to <TT>dt_http_get</TT> is not implemented, the toolkit will internally process the request with a "<FONT COLOR=red>501 Not Implemented</FONT>" response. This is useful for denying unwanted methods within the toolkit. Valid values for this property are:>DX_HTT_METHOD_HEAD means the service implements the request method HEAD.
DX_HTT_METHOD_GET means the service implements the request method GET.
DX_HTT_METHOD_POST means the service implements the request method POST.
DX_HTT_METHOD_ALL is a bitwise OR of all of the above method identifiers.
DX_HTT_METHOD_ANY disables toolkit internal processing of unimplemented requests.