Ocamlnet 4 Reference Manual : Nethttpd_reactor.http_reactive_request

# Class type Nethttpd_reactor.http_reactive_request

    class type http_reactive_request = object .. end

    method environment : Nethttpd_types.extended_environment

The Netcgi environment representing the request header, the response header, and the channels to receive the request body and to send the response body. The channels are locked until either `accept_body` or `reject_body` have been called - using the channels before raises exceptions.

This environment is not fully CGI-compatible. In particular, the following differences exist:

- There is no `cgi_path_info` and no `cgi_path_translated`.
- The user is always unauthenticated.
- The `Status` response header works as in CGI. The `Location` header, however, must be a full URL when set (only browser redirects)
- When the request body is transmitted by chunked encoding, the header `Content-Length` is not set. In CGI this is interpreted as missing body. It is unlikely that clients send requests with chunked encoding, as this may cause interoperability problems anyway.

    method accept_body : unit -> unit

Call this method to unlock the body channels. In terms of HTTP, this sends the "100 Continue" response when necessary. One can reply with a positive or negative message.

    method reject_body : unit -> unit

Call this method to unlock the body channels. In terms of HTTP, this prevents sending the "100 Continue" response. Any arriving request body is silently discarded. One should immediately reply with an error mesage.

    method finish_request : unit -> unit

Reads the rest of the body (if any), and discards that data

    method finish : unit -> unit

This method should be called after the request has been fully processed. It takes care that the HTTP protocol is fulfilled, and the next request can be properly detected and parsed. If the request body has not been fully read, this is now done, and its data are dropped. If the response is incomplete, it is completed. If the error is not recoverable, a "Server Error" is generated.