# Module Nethttpd_engine

    module Nethttpd_engine: sig .. end

## The event-based encapsulation of the HTTP daemon

This is a user-friendlier encapsulation of the HTTP daemon. It uses the engine module defined in `Uq_engines`.

    type engine_req_state = [ `Finishing | `Received_header | `Received_request | `Receiving_body ]

    class type http_engine_config = object .. end

    val default_http_engine_config : http_engine_config

The default config:

- `config_input_flow_control=false`
- `config_output_flow_control=true`

    class modify_http_engine_config : ?modify_http_protocol_config:Nethttpd_kernel.http_protocol_config -> Nethttpd_kernel.http_protocol_config -> ?modify_http_processor_config:Nethttpd_reactor.http_processor_config ->
           Nethttpd_reactor.http_processor_config -> ?config_input_flow_control:bool -> ?config_output_flow_control:bool -> http_engine_config -> http_engine_config

Modifies the passed config object as specified by the optional arguments.

    class type extended_async_environment = object .. end

    class type http_request_header_notification = object .. end

    class type http_request_notification = object .. end

    class http_engine : ?config_hooks:Nethttpd_kernel.http_protocol_hooks -> unit -> on_request_header:(http_request_header_notification -> unit) -> unit -> #http_engine_config -> Unix.file_descr -> Unixqueue.unix_event_system -> [unit] Uq_engines.engine

This engine processes the requests arriving on the file descriptor using the Unix event system.

    class type http_engine_processing_config = object .. end

    class buffering_engine_processing_config : http_engine_processing_config

Implements the synchronisation by buffering

    class type http_engine_processing_context = object .. end

    val process_connection : ?config_hooks:(Nethttpd_kernel.http_protocol_hooks -> unit) ->
           #Nethttpd_reactor.http_processor_config ->
           #http_engine_processing_config ->
           Unix.file_descr ->
           Unixqueue.unix_event_system ->
           'a Nethttpd_types.http_service ->
           http_engine_processing_context

Sets up an engine that processes all requests using the service description. This function returns immediately, one needs to `Unixqueue.run` the event system to start the engine.

The passed `http_engine_processing_config` is crucial for good performance. XXX

## Debugging

    module Debug: sig .. end