Ocamlnet 3 Reference Manual : Http_client

`sig
exception Bad_message of string
exception No_reply
exception Too_many_redirections
exception Name_resolution_error of string
exception URL_syntax_error of string
exception Timeout of string
exception Proxy_error of int
exception Response_too_large
exception Http_protocol of exn
exception Http_error of (int * string)
type status =
[ `Client_error
| `Http_protocol_error of exn
| `Redirection
| `Server_error
| `Successful
| `Unserved ]
type 'message_class how_to_reconnect =
Send_again
| Request_fails
| Inquire of ('message_class -> bool)
| Send_again_if_idem
type 'message_class how_to_redirect =
Redirect
| Do_not_redirect
| Redirect_inquire of ('message_class -> bool)
| Redirect_if_idem
type private_api
type response_body_storage =
[ `Body of unit -> Netmime.mime_body
| `Device of unit -> Uq_io.out_device
| `File of unit -> string
| `Memory ]
type synchronization = Sync | Pipeline of int
type resolver =
Unixqueue.unix_event_system ->
string -> (Unix.inet_addr option -> unit) -> unit
type channel_binding_id = int
type http_options = {
synchronization : Http_client.synchronization;
maximum_connection_failures : int;
maximum_message_errors : int;
inhibit_persistency : bool;
connection_timeout : float;
number_of_parallel_connections : int;
maximum_redirections : int;
handshake_timeout : float;
resolver : Http_client.resolver;
configure_socket : Unix.file_descr -> unit;
schemes :
(string * Neturl.url_syntax * int option *
Http_client.channel_binding_id)
list;
verbose_status : bool;
verbose_request_header : bool;
verbose_response_header : bool;
verbose_request_contents : bool;
verbose_response_contents : bool;
verbose_connection : bool;
verbose_events : bool;
}
type header_kind = [ `Base | `Effective ]
class type http_call =
object
method assoc_multi_req_header : string -> string list
method assoc_multi_resp_header : string -> string list
method assoc_req_header : string -> string
method assoc_resp_header : string -> string
method dest_status : unit -> string * int * string
method effective_request_uri : string
method empty_path_replacement : string
method get_host : unit -> string
method get_path : unit -> string
method get_port : unit -> int
method get_reconnect_mode :
Http_client.http_call Http_client.how_to_reconnect
method get_redirect_mode :
Http_client.http_call Http_client.how_to_redirect
method get_req_body : unit -> string
method get_req_header : unit -> (string * string) list
method get_req_method : unit -> string
method get_resp_body : unit -> string
method get_resp_header : unit -> (string * string) list
method get_uri : unit -> string
method has_req_body : bool
method has_resp_body : bool
method is_idempotent : bool
method is_proxy_allowed : unit -> bool
method is_served : bool
method max_response_body_length : int64
method no_proxy : unit -> unit
method private_api : Http_client.private_api
method proxy_enabled : bool
method proxy_use_connect : bool
method request_body : Netmime.mime_body
method request_header : Http_client.header_kind -> Netmime.mime_header
method request_method : string
method request_uri : string
method response_body : Netmime.mime_body
method response_body_storage : Http_client.response_body_storage
method response_header : Netmime.mime_header
method response_protocol : string
method response_status : Nethttp.http_status
method response_status_code : int
method response_status_text : string
method same_call : unit -> Http_client.http_call
method set_accept_encoding : unit -> unit
method set_channel_binding : Http_client.channel_binding_id -> unit
method set_chunked_request : unit -> unit
method set_expect_handshake : unit -> unit
method set_max_response_body_length : int64 -> unit
method set_proxy_enabled : bool -> unit
method set_reconnect_mode :
Http_client.http_call Http_client.how_to_reconnect -> unit
method set_redirect_mode :
Http_client.http_call Http_client.how_to_redirect -> unit
method set_req_header : string -> string -> unit
method set_request_body : Netmime.mime_body -> unit
method set_request_device : (unit -> Uq_io.in_device) -> unit
method set_request_header : Netmime.mime_header -> unit
method set_request_uri : string -> unit
method set_response_body_storage :
Http_client.response_body_storage -> unit
method status : Http_client.status
end
class type transport_channel_type =
object
method continue :
Unix.file_descr ->
Http_client.channel_binding_id ->
float ->
exn ->
string ->
int -> Unixqueue.event_system -> Uq_engines.multiplex_controller
method setup_e :
Unix.file_descr ->
Http_client.channel_binding_id ->
float ->
exn ->
string ->
int ->
Unixqueue.event_system ->
Uq_engines.multiplex_controller Uq_engines.engine
end
class virtual generic_call :
object
method assoc_multi_req_header : string -> string list
method assoc_multi_resp_header : string -> string list
method assoc_req_header : string -> string
method assoc_resp_header : string -> string
method private virtual def_empty_path_replacement : string
method private virtual def_has_req_body : bool
method private virtual def_has_resp_body : bool
method private virtual def_is_idempotent : bool
method private virtual def_request_method : string
method dest_status : unit -> string * int * string
method effective_request_uri : string
method empty_path_replacement : string
method private virtual fixup_request : unit -> unit
method get_host : unit -> string
method get_path : unit -> string
method get_port : unit -> int
method get_reconnect_mode : http_call how_to_reconnect
method get_redirect_mode : http_call how_to_redirect
method get_req_body : unit -> string
method get_req_header : unit -> (string * string) list
method get_req_method : unit -> string
method get_resp_body : unit -> string
method get_resp_header : unit -> (string * string) list
method get_uri : unit -> string
method has_req_body : bool
method has_resp_body : bool
method is_idempotent : bool
method is_proxy_allowed : unit -> bool
method is_served : bool
method max_response_body_length : int64
method no_proxy : unit -> unit
method private_api : private_api
method proxy_enabled : bool
method proxy_use_connect : bool
method request_body : Netmime.mime_body
method request_header : header_kind -> Netmime.mime_header
method request_method : string
method request_uri : string
method response_body : Netmime.mime_body
method response_body_storage : response_body_storage
method response_header : Netmime.mime_header
method response_protocol : string
method response_status : Nethttp.http_status
method response_status_code : int
method response_status_text : string
method same_call : unit -> http_call
method set_accept_encoding : unit -> unit
method set_channel_binding : channel_binding_id -> unit
method set_chunked_request : unit -> unit
method set_expect_handshake : unit -> unit
method set_max_response_body_length : int64 -> unit
method set_proxy_enabled : bool -> unit
method set_reconnect_mode : http_call how_to_reconnect -> unit
method set_redirect_mode : http_call how_to_redirect -> unit
method set_req_header : string -> string -> unit
method set_request_body : Netmime.mime_body -> unit
method set_request_device : (unit -> Uq_io.in_device) -> unit
method set_request_header : Netmime.mime_header -> unit
method set_request_uri : string -> unit
method set_response_body_storage : response_body_storage -> unit
method status : status
end
class get_call : http_call
class trace_call : http_call
class options_call : http_call
class head_call : http_call
class post_call : http_call
class put_call : http_call
class delete_call : http_call
class get : string -> http_call
class trace : string -> int -> http_call
class options : string -> http_call
class head : string -> http_call
class post : string -> (string * string) list -> http_call
class post_raw : string -> string -> http_call
class put : string -> string -> http_call
class delete : string -> http_call
class type key =
object
method domain : string list
method password : string
method realm : string
method user : string
end
val key :
user:string ->
password:string -> realm:string -> domain:string list -> Http_client.key
class type key_handler =
object
method inquire_key :
domain:string list ->
realms:string list -> auth:string -> Http_client.key
method invalidate_key : Http_client.key -> unit
end
class key_ring :
?uplink:#Http_client.key_handler ->
unit ->
object
method add_key : Http_client.key -> unit
method clear : unit -> unit
method inquire_key :
domain:string list -> realms:string list -> auth:string -> key
method invalidate_key : key -> unit
method keys : Http_client.key list
end
class type auth_session =
object
method auth_domain : Neturl.url list
method auth_in_advance : bool
method auth_realm : string
method auth_scheme : string
method auth_user : string
method authenticate : Http_client.http_call -> (string * string) list
method invalidate : Http_client.http_call -> bool
end
class type auth_handler =
object
method create_proxy_session :
Http_client.http_call ->
Http_client.http_options Pervasives.ref ->
Http_client.auth_session option
method create_session :
Http_client.http_call ->
Http_client.http_options Pervasives.ref ->
Http_client.auth_session option
method skip_challenge : string option
method skip_challenge_session :
Http_client.http_call ->
Http_client.http_options Pervasives.ref ->
Http_client.auth_session option
end
class basic_auth_handler :
?enable_auth_in_advance:bool ->
?skip_challenge:string option -> #Http_client.key_handler -> auth_handler
class digest_auth_handler :
?enable_auth_in_advance:bool -> #Http_client.key_handler -> auth_handler
class unified_auth_handler : #Http_client.key_handler -> auth_handler
class basic_auth_method :
object
method as_auth_handler : Http_client.auth_handler
method name : string
method set_realm : string -> string -> string -> unit
end
class digest_auth_method : basic_auth_method
type connection_cache = Http_client_conncache.connection_cache
val close_connection_cache : Http_client.connection_cache -> unit
val create_restrictive_cache : unit -> Http_client.connection_cache
val create_aggressive_cache : unit -> Http_client.connection_cache
val http_cb_id : Http_client.channel_binding_id
val https_cb_id : Http_client.channel_binding_id
val proxy_only_cb_id : Http_client.channel_binding_id
val new_cb_id : unit -> Http_client.channel_binding_id
val http_transport_channel_type : Http_client.transport_channel_type
type proxy_type = [ `Http_proxy | `Socks5 ]
class pipeline :
object
method add : Http_client.http_call -> unit
method add_auth_handler : Http_client.auth_handler -> unit
method add_authentication_method :
Http_client.basic_auth_method -> unit
method add_e :
Http_client.http_call -> Http_client.http_call Uq_engines.engine
method add_with_callback :
Http_client.http_call -> (Http_client.http_call -> unit) -> unit
method avoid_proxy_for : string list -> unit
method channel_binding :
Http_client.http_call -> Http_client.channel_binding_id
method cnt_crashed_connections : int
method cnt_failed_connections : int
method cnt_new_connections : int
method cnt_server_eof_connections : int
method cnt_successful_connections : int
method cnt_timed_out_connections : int
method configure_transport :
Http_client.channel_binding_id ->
Http_client.transport_channel_type -> unit
method connection_cache : Http_client.connection_cache
method connections : (string * int * int) list
method event_system : Unixqueue.event_system
method get_options : Http_client.http_options
method number_of_open_connections : int
method number_of_open_messages : int
method proxy_type : string -> Http_client.proxy_type option
method proxy_type_of_call :
Http_client.http_call -> Http_client.proxy_type option
method reset : unit -> unit
method reset_counters : unit -> unit
method run : unit -> unit
method set_connection_cache : Http_client.connection_cache -> unit
method set_event_system : Unixqueue.event_system -> unit
method set_options : Http_client.http_options -> unit
method set_proxy : string -> int -> unit
method set_proxy_auth : string -> string -> unit
method set_proxy_from_environment : unit -> unit
method set_socks5_proxy : string -> int -> unit
method set_transport_proxy :
Http_client.channel_binding_id ->
string ->
int -> (string * string) option -> Http_client.proxy_type -> unit
method set_transport_proxy_from_environment :
(string * Http_client.channel_binding_id) list -> unit
end
val parse_proxy_setting : string -> string * int * (string * string) option
val parse_no_proxy : string -> string list
module Convenience :
sig
val http_trials : int Pervasives.ref
val http_user : string Pervasives.ref
val http_password : string Pervasives.ref
val configure_pipeline : (Http_client.pipeline -> unit) -> unit
val http_get_message : string -> Http_client.http_call
val http_head_message : string -> Http_client.http_call
val http_post_message :
string -> (string * string) list -> Http_client.http_call
val http_put_message : string -> string -> Http_client.http_call
val http_delete_message : string -> Http_client.http_call
val http_get : string -> string
val http_post : string -> (string * string) list -> string
val http_put : string -> string -> string
val http_delete : string -> string
val http_verbose :
?verbose_status:bool ->
?verbose_request_header:bool ->
?verbose_response_header:bool ->
?verbose_request_contents:bool ->
?verbose_response_contents:bool ->
?verbose_connection:bool -> ?verbose_events:bool -> unit -> unit
end
module Debug : sig val enable : bool Pervasives.ref end
end`