sig
type version = [ `HTTP_1_0 | `HTTP_1_1 ]
type meth = [ `GET | `POST ]
type daemon_mode = [ `Fork | `Single | `Thread ]
type tcp_server =
sockaddr:Unix.sockaddr ->
timeout:int option ->
(Pervasives.in_channel -> Pervasives.out_channel -> unit) -> unit
type auth_info = [ `Basic of string * string ]
type informational_substatus = [ `Continue | `Switching_protocols ]
type success_substatus =
[ `Accepted
| `Created
| `No_content
| `Non_authoritative_information
| `OK
| `Partial_content
| `Reset_content ]
type redirection_substatus =
[ `Found
| `Moved_permanently
| `Multiple_choices
| `Not_modified
| `See_other
| `Temporary_redirect
| `Use_proxy ]
type client_error_substatus =
[ `Bad_request
| `Conflict
| `Expectation_failed
| `Forbidden
| `Gone
| `Length_required
| `Method_not_allowed
| `Not_acceptable
| `Not_found
| `Payment_required
| `Precondition_failed
| `Proxy_authentication_required
| `Request_URI_too_large
| `Request_entity_too_large
| `Request_time_out
| `Requested_range_not_satisfiable
| `Unauthorized
| `Unsupported_media_type ]
type server_error_substatus =
[ `Bad_gateway
| `Gateway_time_out
| `HTTP_version_not_supported
| `Internal_server_error
| `Not_implemented
| `Service_unavailable ]
type informational_status =
[ `Informational of Http_types.informational_substatus ]
type success_status = [ `Success of Http_types.success_substatus ]
type redirection_status =
[ `Redirection of Http_types.redirection_substatus ]
type client_error_status =
[ `Client_error of Http_types.client_error_substatus ]
type server_error_status =
[ `Server_error of Http_types.server_error_substatus ]
type error_status =
[ `Client_error of Http_types.client_error_substatus
| `Server_error of Http_types.server_error_substatus ]
type status =
[ `Client_error of Http_types.client_error_substatus
| `Informational of Http_types.informational_substatus
| `Redirection of Http_types.redirection_substatus
| `Server_error of Http_types.server_error_substatus
| `Success of Http_types.success_substatus ]
type status_code = [ `Code of int | `Status of Http_types.status ]
type file_source = FileSrc of string | InChanSrc of Pervasives.in_channel
exception Invalid_header of string
exception Invalid_header_name of string
exception Invalid_header_value of string
exception Invalid_HTTP_version of string
exception Invalid_HTTP_method of string
exception Invalid_code of int
exception Malformed_URL of string
exception Malformed_query of string
exception Malformed_query_part of string * string
exception Malformed_request_URI of string
exception Malformed_request of string
exception Malformed_response of string
exception Param_not_found of string
exception Invalid_status_line of string
exception Header_not_found of string
exception Quit
exception Unauthorized of string
class type message =
object
method addBody : string -> unit
method addBodyBuf : Buffer.t -> unit
method addHeader : name:string -> value:string -> unit
method addHeaders : (string * string) list -> unit
method body : string
method bodyBuf : Buffer.t
method clientAddr : string
method clientPort : int
method clientSockaddr : Unix.sockaddr
method hasHeader : name:string -> bool
method header : name:string -> string
method headers : (string * string) list
method removeHeader : name:string -> unit
method replaceHeader : name:string -> value:string -> unit
method replaceHeaders : (string * string) list -> unit
method serialize : Pervasives.out_channel -> unit
method serverAddr : string
method serverPort : int
method serverSockaddr : Unix.sockaddr
method setBody : string -> unit
method setBodyBuf : Buffer.t -> unit
method setVersion : Http_types.version -> unit
method toString : string
method version : Http_types.version option
end
class type request =
object
method addBody : string -> unit
method addBodyBuf : Buffer.t -> unit
method addHeader : name:string -> value:string -> unit
method addHeaders : (string * string) list -> unit
method authorization : Http_types.auth_info option
method body : string
method bodyBuf : Buffer.t
method clientAddr : string
method clientPort : int
method clientSockaddr : Unix.sockaddr
method hasHeader : name:string -> bool
method header : name:string -> string
method headers : (string * string) list
method meth : Http_types.meth
method param :
?meth:Http_types.meth -> ?default:string -> string -> string
method paramAll : ?meth:Http_types.meth -> string -> string list
method params : (string * string) list
method params_GET : (string * string) list
method params_POST : (string * string) list
method path : string
method removeHeader : name:string -> unit
method replaceHeader : name:string -> value:string -> unit
method replaceHeaders : (string * string) list -> unit
method serialize : out_channel -> unit
method serverAddr : string
method serverPort : int
method serverSockaddr : Unix.sockaddr
method setBody : string -> unit
method setBodyBuf : Buffer.t -> unit
method setVersion : version -> unit
method toString : string
method uri : string
method version : version option
end
class type response =
object
method addBasicHeaders : unit
method addBody : string -> unit
method addBodyBuf : Buffer.t -> unit
method addHeader : name:string -> value:string -> unit
method addHeaders : (string * string) list -> unit
method body : string
method bodyBuf : Buffer.t
method clientAddr : string
method clientPort : int
method clientSockaddr : Unix.sockaddr
method code : int
method contentEncoding : string
method contentType : string
method date : string
method expires : string
method hasHeader : name:string -> bool
method header : name:string -> string
method headers : (string * string) list
method isClientError : bool
method isError : bool
method isInformational : bool
method isRedirection : bool
method isServerError : bool
method isSuccess : bool
method reason : string
method removeHeader : name:string -> unit
method replaceHeader : name:string -> value:string -> unit
method replaceHeaders : (string * string) list -> unit
method serialize : out_channel -> unit
method server : string
method serverAddr : string
method serverPort : int
method serverSockaddr : Unix.sockaddr
method setBody : string -> unit
method setBodyBuf : Buffer.t -> unit
method setCode : int -> unit
method setContentEncoding : string -> unit
method setContentType : string -> unit
method setDate : string -> unit
method setExpires : string -> unit
method setReason : string -> unit
method setServer : string -> unit
method setStatus : Http_types.status -> unit
method setStatusLine : string -> unit
method setVersion : version -> unit
method status : Http_types.status
method statusLine : string
method toString : string
method version : version option
end
type daemon_spec = {
address : string;
auth : (string * Http_types.auth_info) option;
callback : Http_types.request -> Pervasives.out_channel -> unit;
mode : Http_types.daemon_mode;
port : int;
root_dir : string option;
exn_handler : (exn -> Pervasives.out_channel -> unit) option;
timeout : int option;
auto_close : bool;
}
class type connection =
object
method close : unit
method getRequest : Http_types.request option
method respond_with : Http_types.response -> unit
end
class type daemon =
object
method accept : Http_types.connection
method getRequest : Http_types.request * Http_types.connection
end
end