class type http_response =Encapsultation of the HTTP response for a single request
This class has an internal
queue of response tokens that are not yet processed. One can easily add
new tokens to the end of the queue (
The class is responsible for determining the transfer encoding:
TErequest header is not taken into account. The trailer is always empty.
The following headers are set (or removed) by this class:
Server(it is appended to this field)
Responses for other requests that must not include a body must set
Content-Length to 0.
These methods can be called by the content provider:
method state :
method bidirectional_phase :
method send :
resp_token -> unit
method send_queue_empty :
`Inhibited, this method fakes an empty queue.
method protocol :
method close_connection :
`Resp_endfront token has been reached.
method transfer_encoding :
method front_token :
Send_queue_emptywhen there is currently no front token, or the state is
`Inhibited. If there is a front token, it will never have length 0.
Unix_error exceptions can be raised when
tokens are processed.
method set_callback :
(unit -> unit) -> unit
set_statechanges the state, or when the send queue becomes empty. Note that the callback must never fail, it is called in situations that make it hard to recover from errors.
method body_size :
method set_state :
resp_state -> unit
method advance :
int -> unit
nbytes of the front token could be really sent using
Unix.write. If this means that the whole front token has been sent, the next token is pulled from the queue and is made the new front token. Otherwise, the data chunk representing the front token is modified such that the position is advanced by
n, and the length is reduced by