Plasma GitLab Archive
Projects Blog Knowledge

Module Nethttpd_reactor


module Nethttpd_reactor: sig .. end

The reactive encapsulation of the HTTP daemon

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 = object .. end
class type http_reactor_config = object .. end
class type internal_environment = object .. end
For private use only
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) -> internal_environment
For private use only
class type http_reactive_request = object .. end
class http_reactor : #http_reactor_config -> Unix.file_descr -> object .. end
The http_reactor allows one to pull the next request from a connected client, and to deliver the response to the protocol engine.
val process_connection : #http_reactor_config ->
Unix.file_descr -> 'a Nethttpd_types.http_service -> unit
Processes all HTTP requests in turn arriving at the file descriptor, and calls the service provider for every request. Finally, the descriptor is closed.

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.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml