Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Ocsigen_http_frame

module Ocsigen_http_frame : sig..end

compute_new_ri_cookies now path ri_cookies cookies_to_set adds the cookies from cookies_to_set to ri_cookies, as if the cookies had been send to the browser and the browser was doing a new request to the url path. Only the cookies that match path (current path) are added.


type etag = string
val compute_new_ri_cookies : 
  float ->
  string list ->
  string Ocsigen_lib.String.Table.t ->
  Ocsigen_cookies.cookie Ocsigen_lib.String.Table.t
  Ocsigen_cookies.Cookies.t -> string Ocsigen_lib.String.Table.t

compute_new_ri_cookies now path ri_cookies cookies_to_set adds the cookies from cookies_to_set to ri_cookies, as if the cookies had been send to the browser and the browser was doing a new request to the url path. Only the cookies that match path (current path) are added.

type result = {
  res_cookies: Ocsigen_cookies.cookieset;(* cookies to set *)  res_lastmodified: float option;(* Default: None *)  res_etag: etag option;  res_code: int;(* HTTP code, if not 200 *)  res_stream: 
    string Ocsigen_stream.t *
    (string Ocsigen_stream.t ->
     int64 -> string Ocsigen_stream.step Lwt.t)
    option
;
(* Default: empty stream. The second field is (optionaly) the function used to skip a part of the stream, if you do not you want to use a basic reading of the stream. For example, for static files, you can optimize it by using a seek function. *)
  res_content_length: int64 option;(* None means Transfer-encoding: chunked *)  res_content_type: string option;  res_headers: Http_headers.t;(* The headers you want to add *)  res_charset: string option;(* Default: None *)  res_location: string option;(* Default: None *)
}

The type of answers to send

val default_result : unit -> result

Default result to use as a base for constructing others.

val empty_result : unit -> result

result for an empty page.

module type HTTP_CONTENT = sig..end
module Http_header : sig..end
module Http_error : sig..end
type t = {
  frame_header: Http_header.http_header;  frame_content: string Ocsigen_stream.t option;  frame_abort: unit -> unit Lwt.t;}

The type of HTTP frames. The content may be void (no body) or a stream. While sending, a stream will be sent with chunked encoding if no content-length is supplied. abort is the function to be called if you want to cancel the stream reading (closes the connection).