class type ['a]
http_service = object
.. end
method name : string
The name of the type of the service provider
method def_term : 'a
The definition term
method print : Format.formatter -> unit
Outputs the definition term to a formatter
method process_header : extended_environment -> http_service_reaction
First stage of HTTP processing:
This method is called when the HTTP header has been received. This method
must return quickly without blocking the thread how to go on. For example,
this could look as follows:
- Check whether the client is allowed to access this resource. If this
can be done immediately, it should be done now. (If an external service
must be queried, the check must not be done now, but deferred to the
second or third stage.) If the access is denied, an error response can
be sent back using
`Static
, `File
, or, if computed, using `Reject_body
.
- Check whether the request is delegated to another service provider
(e.g. lookup by hostname, by port number, or by URI). In this case,
the result of this
process_header
call is simply the result of the
process_header
call of the other service provider.
- If this service provider generates the contents, there are mainly two
types of reaction. If the contents are stored in a file, one can simply
return
`File
. Otherwise, return `Accept_body
to continue with the
second stage. Note that even if no body is expected to arrive, one must
go through the second stage, and drop any unexpected body.
The argument of this function is the Netcgi environment. The header is
complete, including the request method. One cannot access the input and
output channels at this stage of processing.