This is a user-friendlier encapsulation of the HTTP daemon. It uses a
"pull model": One pulls HTTP requests from the "reactor" one after the
other. Request/response pairs have a common environment that represents
the input and output facilities. Input and output are realised by
Netchannels, and the implementation details are completely hidden.
This encapsulation can be easily used in a multi-threaded environment
when for every arriving HTTP connection a separate thread is used.
class type http_processor_config =
class type http_reactor_config =
class type internal_environment =
class http_environment :
#http_processor_config -> string -> string -> Nethttp.protocol -> Nethttp.http_header -> Unix.sockaddr -> Unix.sockaddr -> Netchannels.in_obj_channel -> Netchannels.out_obj_channel -> Nethttpd_kernel.http_response -> (unit -> unit) ->
class type http_reactive_request =
class http_reactor :
#http_reactor_config -> Unix.file_descr ->
http_reactorallows one to pull the next request from a connected client, and to deliver the response to the protocol engine.
val process_connection :
Unix.file_descr -> 'a Nethttpd_types.http_service -> unit
All stages of HTTP processing, as defined by the service provider, are executed in the current thread.
Any exceptions are caught and logged. The connection is immediately closed
in this case.