module Convenience:sig
..end
open Nethttp_client.Convenience
for simple applications.open Nethttp_client.Convenience
for simple applications.
The environment variables http_proxy
and no_proxy
determine
the proxy settings. http_proxy
must be an http-URL that contains
the proxy's name, its port, and optionally user and password.
E.g. "http://eric:ericspassword@proxy:8080/".
The variable no_proxy
is a comma-separated list of hosts and
domains for which no proxy must be used.
E.g. "localhost, sun, moon, .intra.net"
There is a default behaviour for authentication. Both "basic" and
"digest" methods are enabled. Two global variables, http_user
and
http_password
set the user and password if the URL does not specify
them. In the case that user and password are included in the URL,
these values are always
used. Note that basic authentication is by default only enabled over
connections that are secured via TLS! You can change that with the
function configure
, see below.
There is a default error behaviour. If a request fails, it is
automatically repeated. The variable http_trials
specifies the number
of times a request is submitted at most.
Requests are not repeated if there is a HTTP return code that indicates
a normal operating condition.
POST and DELETE requests are never repeated.
Error codes are reported as Nethttp_client.Http_error
. Note that
this is different than what the pipeline core does.
Convenience module for simple applications
Do open Nethttp_client.Convenience
for simple applications.
The functions of this module share the following behaviour:
The environment variables http_proxy
and no_proxy
determine
the proxy settings. http_proxy
must be an http-URL that contains
the proxy's name, its port, and optionally user and password.
E.g. "http://eric:ericspassword@proxy:8080/".
The variable no_proxy
is a comma-separated list of hosts and
domains for which no proxy must be used.
E.g. "localhost, sun, moon, .intra.net"
There is a default behaviour for authentication. Both "basic" and
"digest" methods are enabled. Two global variables, http_user
and
http_password
set the user and password if the URL does not specify
them. In the case that user and password are included in the URL,
these values are always
used. Note that basic authentication is by default only enabled over
connections that are secured via TLS! You can change that with the
function configure
, see below.
There is a default error behaviour. If a request fails, it is
automatically repeated. The variable http_trials
specifies the number
of times a request is submitted at most.
Requests are not repeated if there is a HTTP return code that indicates
a normal operating condition.
POST and DELETE requests are never repeated.
Error codes are reported as Nethttp_client.Http_error
. Note that
this is different than what the pipeline core does.
Thread safety
The Convenience module is fully thread-safe with the exception of the
exported variables (http_trials, http_user, and http_password). Note
that all threads share the same pipeline, and access to the pipeline
is serialized.
The latter simply means that it always works, but that threads may
block each other (i.e. the program slows down if more than one thread
wants to open http connections at the same time).
val http_trials : int Pervasives.ref
val http_user : string Pervasives.ref
val http_password : string Pervasives.ref
val configure : ?insecure:bool -> unit -> unit
insecure
: whether basic authentication over non-TLS connections
is enabledval configure_pipeline : (Nethttp_client.pipeline -> unit) -> unit
val http_get_message : string -> Nethttp_client.http_call
val http_head_message : string -> Nethttp_client.http_call
val http_post_message : string -> (string * string) list -> Nethttp_client.http_call
val http_put_message : string -> string -> Nethttp_client.http_call
val http_delete_message : string -> Nethttp_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